Compare commits
No commits in common. "b6ded4d0269c398e710cbdfc9d60747c0ef91115" and "a957126d908b412fdb4d5b139c98d56a8cd4667e" have entirely different histories.
b6ded4d026
...
a957126d90
@ -1,3 +1,2 @@
|
|||||||
cupertino
|
cupertino
|
||||||
cupertinoicons
|
cupertinoicons
|
||||||
onetwothree
|
|
@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:repertory/constants.dart' as constants;
|
import 'package:repertory/constants.dart' as constants;
|
||||||
import 'package:repertory/helpers.dart';
|
|
||||||
import 'package:repertory/models/mount_list.dart';
|
import 'package:repertory/models/mount_list.dart';
|
||||||
import 'package:repertory/types/mount_config.dart';
|
|
||||||
import 'package:repertory/widgets/mount_list_widget.dart';
|
import 'package:repertory/widgets/mount_list_widget.dart';
|
||||||
import 'package:repertory/widgets/mount_settings.dart';
|
import 'package:repertory/widgets/mount_settings.dart';
|
||||||
|
|
||||||
@ -26,14 +24,10 @@ class MyApp extends StatelessWidget {
|
|||||||
routes: {'/': (context) => const MyHomePage(title: constants.appTitle)},
|
routes: {'/': (context) => const MyHomePage(title: constants.appTitle)},
|
||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
if (settings.name == '/settings') {
|
if (settings.name == '/settings') {
|
||||||
final mountConfig = settings.arguments as MountConfig;
|
// final args = settings.arguments as ScreenArguments;
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MountSettingsWidget(
|
return MountSettingsWidget(title: constants.appTitle);
|
||||||
title:
|
|
||||||
'${initialCaps(mountConfig.type)} [${formatMountName(mountConfig.type, mountConfig.name)}] Settings',
|
|
||||||
config: mountConfig,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,82 +1,38 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:repertory/types/mount_config.dart';
|
|
||||||
import 'package:settings_ui/settings_ui.dart';
|
import 'package:settings_ui/settings_ui.dart';
|
||||||
|
|
||||||
class MountSettingsWidget extends StatefulWidget {
|
class MountSettingsWidget extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final MountConfig config;
|
const MountSettingsWidget({super.key, required this.title});
|
||||||
const MountSettingsWidget({
|
|
||||||
super.key,
|
|
||||||
required this.config,
|
|
||||||
required this.title,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MountSettingsWidget> createState() => _MountSettingsWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|
||||||
MountConfig? config;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<SettingsTile> commonSettings = [];
|
|
||||||
config?.settings.forEach((key, value) {
|
|
||||||
if (key == "ApiAuth") {
|
|
||||||
commonSettings.add(
|
|
||||||
SettingsTile.navigation(
|
|
||||||
leading: Icon(Icons.password),
|
|
||||||
title: Text(key),
|
|
||||||
value: Text('*' * (value as String).length),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (key == "ApiPort") {
|
|
||||||
commonSettings.add(
|
|
||||||
SettingsTile.navigation(
|
|
||||||
leading: Icon(Icons.onetwothree),
|
|
||||||
title: Text(key),
|
|
||||||
value: Text((value as int).toString()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (key == "ApiUser") {
|
|
||||||
commonSettings.add(
|
|
||||||
SettingsTile.navigation(
|
|
||||||
leading: Icon(Icons.person),
|
|
||||||
title: Text(key),
|
|
||||||
value: Text(value),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (key == "DatabaseType") {
|
|
||||||
commonSettings.add(
|
|
||||||
SettingsTile.navigation(
|
|
||||||
leading: Icon(Icons.dataset),
|
|
||||||
title: Text(key),
|
|
||||||
value: Text(value),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
title: Text(widget.title),
|
title: Text(title),
|
||||||
),
|
),
|
||||||
body: SettingsList(
|
body: SettingsList(
|
||||||
shrinkWrap: false,
|
shrinkWrap: false,
|
||||||
sections: [
|
sections: [
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: Text('Common Settings'),
|
title: Text('Common'),
|
||||||
tiles: commonSettings.toList(),
|
tiles: <SettingsTile>[
|
||||||
|
SettingsTile.navigation(
|
||||||
|
leading: Icon(Icons.language),
|
||||||
|
title: Text('Language'),
|
||||||
|
value: Text('English'),
|
||||||
|
),
|
||||||
|
SettingsTile.switchTile(
|
||||||
|
onToggle: (value) {},
|
||||||
|
initialValue: true,
|
||||||
|
leading: Icon(Icons.format_paint),
|
||||||
|
title: Text('Enable custom theme'),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
config = widget.config;
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,7 @@ class _MountWidgetState extends State<MountWidget> {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.settings, color: textColor),
|
icon: Icon(Icons.settings, color: textColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, '/settings');
|
||||||
context,
|
|
||||||
'/settings',
|
|
||||||
arguments: mount.mountConfig,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
subtitle:
|
subtitle:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user