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

View File

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

View File

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