save ui settings

This commit is contained in:
Scott E. Graves 2025-03-16 15:41:50 -05:00
parent 9afc8e3cb6
commit c75ce9ad21
3 changed files with 1 additions and 10 deletions

View File

@ -26,12 +26,10 @@ void createBooleanSetting(
onPressed: onPressed:
(_) => setState(() { (_) => setState(() {
settings[key] = !value; settings[key] = !value;
widget.onChanged?.call(widget.settings);
}), }),
onToggle: (bool nextValue) { onToggle: (bool nextValue) {
setState(() { setState(() {
settings[key] = nextValue; settings[key] = nextValue;
widget.onChanged?.call(widget.settings);
}); });
}, },
), ),
@ -64,7 +62,6 @@ void createIntListSetting(
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
settings[key] = int.parse(newValue ?? defaultValue.toString()); settings[key] = int.parse(newValue ?? defaultValue.toString());
widget.onChanged?.call(widget.settings);
}); });
}, },
items: items:
@ -121,7 +118,6 @@ void createIntSetting(
} }
setState(() { setState(() {
settings[key] = int.parse(updatedValue); settings[key] = int.parse(updatedValue);
widget.onChanged?.call(widget.settings);
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -197,7 +193,6 @@ void createPasswordSetting(
setState(() { setState(() {
settings[key] = updatedValue1; settings[key] = updatedValue1;
widget.onChanged?.call(widget.settings);
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -279,7 +274,6 @@ void createStringListSetting(
onChanged: onChanged:
(newValue) => setState(() { (newValue) => setState(() {
settings[key] = newValue; settings[key] = newValue;
widget.onChanged?.call(widget.settings);
}), }),
items: items:
valueList.map<DropdownMenuItem<String>>((item) { valueList.map<DropdownMenuItem<String>>((item) {
@ -336,7 +330,6 @@ void createStringSetting(
} }
setState(() { setState(() {
settings[key] = updatedValue; settings[key] = updatedValue;
widget.onChanged?.call(widget.settings);
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View File

@ -13,13 +13,11 @@ class MountSettingsWidget extends StatefulWidget {
final bool isAdd; final bool isAdd;
final bool showAdvanced; final bool showAdvanced;
final Mount mount; final Mount mount;
final Function? onChanged;
final Map<String, dynamic> settings; final Map<String, dynamic> settings;
const MountSettingsWidget({ const MountSettingsWidget({
super.key, super.key,
this.isAdd = false, this.isAdd = false,
required this.mount, required this.mount,
this.onChanged,
required this.settings, required this.settings,
required this.showAdvanced, required this.showAdvanced,
}); });

View File

@ -105,7 +105,7 @@ class _UISettingsWidgetState extends State<UISettingsWidget> {
.put( .put(
Uri.parse( Uri.parse(
Uri.encodeFull( Uri.encodeFull(
'${getBaseUri()}/api/v1/settings?data=${convertAllToString(widget.settings)})', '${getBaseUri()}/api/v1/settings?data=${jsonEncode(convertAllToString(widget.settings))})',
), ),
), ),
) )