refactor
This commit is contained in:
parent
b5aa5136e9
commit
c817d432c0
@ -32,10 +32,14 @@ class MyApp extends StatelessWidget {
|
||||
final mountConfig = settings.arguments as MountConfig;
|
||||
return MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return MountSettingsWidget(
|
||||
title:
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(
|
||||
'${initialCaps(mountConfig.type)} [${formatMountName(mountConfig.type, mountConfig.name)}] Settings',
|
||||
config: mountConfig,
|
||||
),
|
||||
),
|
||||
body: MountSettingsWidget(config: mountConfig),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -3,13 +3,8 @@ import 'package:repertory/types/mount_config.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
class MountSettingsWidget extends StatefulWidget {
|
||||
final String title;
|
||||
final MountConfig config;
|
||||
const MountSettingsWidget({
|
||||
super.key,
|
||||
required this.config,
|
||||
required this.title,
|
||||
});
|
||||
const MountSettingsWidget({super.key, required this.config});
|
||||
|
||||
@override
|
||||
State<MountSettingsWidget> createState() => _MountSettingsWidgetState();
|
||||
@ -388,47 +383,41 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
||||
}
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: SettingsList(
|
||||
shrinkWrap: false,
|
||||
sections: [
|
||||
if (encryptConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Encrypt Config'),
|
||||
tiles: encryptConfigSettings,
|
||||
),
|
||||
if (hostConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Host Config'),
|
||||
tiles: hostConfigSettings,
|
||||
),
|
||||
if (remoteConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Remote Config'),
|
||||
tiles: remoteConfigSettings,
|
||||
),
|
||||
if (remoteMountSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Remote Mount'),
|
||||
tiles: remoteMountSettings,
|
||||
),
|
||||
if (s3ConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('S3 Config'),
|
||||
tiles: s3ConfigSettings,
|
||||
),
|
||||
if (siaConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Sia Config'),
|
||||
tiles: siaConfigSettings,
|
||||
),
|
||||
SettingsSection(title: const Text('Settings'), tiles: commonSettings),
|
||||
],
|
||||
),
|
||||
return SettingsList(
|
||||
shrinkWrap: false,
|
||||
sections: [
|
||||
if (encryptConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Encrypt Config'),
|
||||
tiles: encryptConfigSettings,
|
||||
),
|
||||
if (hostConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Host Config'),
|
||||
tiles: hostConfigSettings,
|
||||
),
|
||||
if (remoteConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Remote Config'),
|
||||
tiles: remoteConfigSettings,
|
||||
),
|
||||
if (remoteMountSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Remote Mount'),
|
||||
tiles: remoteMountSettings,
|
||||
),
|
||||
if (s3ConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('S3 Config'),
|
||||
tiles: s3ConfigSettings,
|
||||
),
|
||||
if (siaConfigSettings.isNotEmpty)
|
||||
SettingsSection(
|
||||
title: const Text('Sia Config'),
|
||||
tiles: siaConfigSettings,
|
||||
),
|
||||
SettingsSection(title: const Text('Settings'), tiles: commonSettings),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user