refactor settings
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
f165919ed4
commit
5a19ada15d
@ -81,6 +81,35 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _addIntListSetting(
|
||||||
|
list,
|
||||||
|
root,
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
List<String> valueList,
|
||||||
|
defaultValue,
|
||||||
|
icon,
|
||||||
|
) {
|
||||||
|
list.add(
|
||||||
|
SettingsTile.navigation(
|
||||||
|
title: Text(key),
|
||||||
|
leading: Icon(icon),
|
||||||
|
value: DropdownButton<String>(
|
||||||
|
value: value.toString(),
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
root?[key] = int.parse(newValue ?? defaultValue.toString());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items:
|
||||||
|
valueList.map<DropdownMenuItem<String>>((item) {
|
||||||
|
return DropdownMenuItem<String>(value: item, child: Text(item));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _addListSetting(list, root, key, value, List<String> valueList, icon) {
|
void _addListSetting(list, root, key, value, List<String> valueList, icon) {
|
||||||
list.add(
|
list.add(
|
||||||
SettingsTile.navigation(
|
SettingsTile.navigation(
|
||||||
@ -213,7 +242,15 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
} else if (key == "RetryReadCount") {
|
} else if (key == "RetryReadCount") {
|
||||||
_addIntSetting(commonSettings, _settings, key, value);
|
_addIntSetting(commonSettings, _settings, key, value);
|
||||||
} else if (key == "RingBufferFileSize") {
|
} else if (key == "RingBufferFileSize") {
|
||||||
_addIntSetting(commonSettings, _settings, key, value);
|
_addIntListSetting(
|
||||||
|
commonSettings,
|
||||||
|
_settings,
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
["128", "256", "512", "1024", "2048"],
|
||||||
|
512,
|
||||||
|
Icons.animation,
|
||||||
|
);
|
||||||
} else if (key == "EncryptConfig") {
|
} else if (key == "EncryptConfig") {
|
||||||
value.forEach((subKey, subValue) {
|
value.forEach((subKey, subValue) {
|
||||||
if (subKey == "EncryptionToken") {
|
if (subKey == "EncryptionToken") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user