chore: Add reset button for config viewer
This commit is contained in:
parent
bad0a549cb
commit
a3a2a37a14
3 changed files with 23 additions and 2 deletions
|
|
@ -48,6 +48,11 @@ class _ConfigViewerState extends State<ConfigViewer> {
|
|||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void> _reset() async {
|
||||
await AppSettings.reset();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
|
@ -55,8 +60,12 @@ class _ConfigViewerState extends State<ConfigViewer> {
|
|||
appBar: AppBar(
|
||||
title: Text(L10n.of(context).advancedConfigurations),
|
||||
leading: BackButton(onPressed: () => context.go('/')),
|
||||
actions: [
|
||||
TextButton(onPressed: _reset, child: Text(L10n.of(context).reset)),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: .stretch,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
|
|
@ -81,7 +90,13 @@ class _ConfigViewerState extends State<ConfigViewer> {
|
|||
value = appSetting.value.toString();
|
||||
}
|
||||
if (appSetting is AppSettings<bool>) {
|
||||
value = appSetting.value.toString();
|
||||
return SwitchListTile.adaptive(
|
||||
title: Text(appSetting.name),
|
||||
subtitle: Text(value),
|
||||
value: appSetting.value,
|
||||
onChanged: (value) =>
|
||||
_changeSetting(appSetting, store, (!value).toString()),
|
||||
);
|
||||
}
|
||||
if (appSetting is AppSettings<double>) {
|
||||
value = appSetting.value.toString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue