refactor
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
Scott E. Graves 2025-03-19 08:17:04 -05:00
parent bced895ea1
commit f015647b71

View File

@ -23,14 +23,9 @@ void createBooleanSetting(
leading: const Icon(Icons.quiz), leading: const Icon(Icons.quiz),
title: createSettingTitle(context, key, description), title: createSettingTitle(context, key, description),
initialValue: (value as bool), initialValue: (value as bool),
onPressed: onPressed: (_) => setState(() => settings[key] = !value),
(_) => setState(() {
settings[key] = !value;
}),
onToggle: (bool nextValue) { onToggle: (bool nextValue) {
setState(() { setState(() => settings[key] = nextValue);
settings[key] = nextValue;
});
}, },
), ),
); );
@ -60,9 +55,12 @@ void createIntListSetting(
value: DropdownButton<String>( value: DropdownButton<String>(
value: value.toString(), value: value.toString(),
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(
settings[key] = int.parse(newValue ?? defaultValue.toString()); () =>
}); settings[key] = int.parse(
newValue ?? defaultValue.toString(),
),
);
}, },
items: items:
valueList.map<DropdownMenuItem<String>>((item) { valueList.map<DropdownMenuItem<String>>((item) {
@ -116,9 +114,7 @@ void createIntSetting(
"Setting '$key' is not valid", "Setting '$key' is not valid",
); );
} }
setState(() { setState(() => settings[key] = int.parse(updatedValue));
settings[key] = int.parse(updatedValue);
});
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
@ -191,9 +187,7 @@ void createPasswordSetting(
); );
} }
setState(() { setState(() => settings[key] = updatedValue1);
settings[key] = updatedValue1;
});
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
@ -271,10 +265,7 @@ void createStringListSetting(
leading: Icon(icon), leading: Icon(icon),
value: DropdownButton<String>( value: DropdownButton<String>(
value: value, value: value,
onChanged: onChanged: (newValue) => setState(() => settings[key] = newValue),
(newValue) => setState(() {
settings[key] = newValue;
}),
items: items:
valueList.map<DropdownMenuItem<String>>((item) { valueList.map<DropdownMenuItem<String>>((item) {
return DropdownMenuItem<String>(value: item, child: Text(item)); return DropdownMenuItem<String>(value: item, child: Text(item));
@ -328,9 +319,7 @@ void createStringSetting(
"Setting '$key' is not valid", "Setting '$key' is not valid",
); );
} }
setState(() { setState(() => settings[key] = updatedValue);
settings[key] = updatedValue;
});
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),