continue settings
This commit is contained in:
parent
a957126d90
commit
734f2d3ffe
@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:repertory/constants.dart' as constants;
|
||||
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_settings.dart';
|
||||
|
||||
@ -24,10 +25,13 @@ class MyApp extends StatelessWidget {
|
||||
routes: {'/': (context) => const MyHomePage(title: constants.appTitle)},
|
||||
onGenerateRoute: (settings) {
|
||||
if (settings.name == '/settings') {
|
||||
// final args = settings.arguments as ScreenArguments;
|
||||
final mountConfig = settings.arguments as MountConfig;
|
||||
return MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return MountSettingsWidget(title: constants.appTitle);
|
||||
return MountSettingsWidget(
|
||||
title: constants.appTitle,
|
||||
config: mountConfig,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -1,38 +1,82 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:repertory/types/mount_config.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
class MountSettingsWidget extends StatelessWidget {
|
||||
class MountSettingsWidget extends StatefulWidget {
|
||||
final String title;
|
||||
const MountSettingsWidget({super.key, required this.title});
|
||||
final MountConfig config;
|
||||
const MountSettingsWidget({
|
||||
super.key,
|
||||
required this.config,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MountSettingsWidget> createState() => _MountSettingsWidgetState();
|
||||
}
|
||||
|
||||
class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
||||
MountConfig? config;
|
||||
|
||||
@override
|
||||
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(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(title),
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: SettingsList(
|
||||
shrinkWrap: false,
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: Text('Common'),
|
||||
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'),
|
||||
),
|
||||
],
|
||||
title: Text('Common Settings'),
|
||||
tiles: commonSettings.toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
config = widget.config;
|
||||
super.initState();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,11 @@ class _MountWidgetState extends State<MountWidget> {
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.settings, color: textColor),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, '/settings');
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/settings',
|
||||
arguments: mount.mountConfig,
|
||||
);
|
||||
},
|
||||
),
|
||||
subtitle:
|
||||
|
@ -5,10 +5,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
|
||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.12.0"
|
||||
version: "2.13.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -53,10 +53,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
|
||||
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
version: "1.3.3"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -95,10 +95,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
|
||||
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.8"
|
||||
version: "10.0.9"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -252,10 +252,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
|
||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.3.1"
|
||||
version: "15.0.0"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
Loading…
x
Reference in New Issue
Block a user