Create management portal in Flutter #39
This commit is contained in:
parent
6602e7eff6
commit
637f123c24
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user