Create management portal in Flutter #39

This commit is contained in:
Scott E. Graves 2025-03-14 15:24:01 -05:00
parent 6602e7eff6
commit 637f123c24
2 changed files with 5 additions and 2 deletions

View File

@ -144,14 +144,12 @@ bool validateSettings(
settings.forEach((key, value) {
final checkKey = rootKey == null ? key : '$rootKey.$key';
if (value is Map) {
debugPrint('nested: $checkKey');
validateSettings(
value as Map<String, dynamic>,
failed,
rootKey: checkKey,
);
} else {
debugPrint('validate: $checkKey--$value');
for (var validator in getSettingValidators(checkKey)) {
if (!validator(value.toString())) {
failed.add(checkKey);

View File

@ -127,6 +127,11 @@ class _AddMountScreenState extends State<AddMountScreen> {
onPressed: () {
List<String> failed = [];
if (!validateSettings(_settings[_mountType]!, failed)) {
for (var key in failed) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("'$key' is not valid")),
);
}
return;
}