Create management portal in Flutter #39

This commit is contained in:
Scott E. Graves 2025-03-14 14:47:23 -05:00
parent edd27e3e34
commit d920a55fc0
2 changed files with 38 additions and 19 deletions

View File

@ -79,6 +79,8 @@ String getBaseUri() {
List<Validator> getSettingValidators(String settingPath) {
switch (settingPath) {
case 'ApiAuth':
return [(value) => value.isNotEmpty];
case 'EncryptConfig.EncryptionToken':
return [(value) => value.isNotEmpty];
case 'EncryptConfig.Path':

View File

@ -237,24 +237,34 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
},
),
],
content: Row(
children: [
TextField(
autofocus: true,
controller: TextEditingController(text: updatedValue1),
obscureText: true,
obscuringCharacter: '*',
onChanged: (value) => updatedValue1 = value,
),
const SizedBox(height: _padding),
TextField(
autofocus: true,
controller: TextEditingController(text: updatedValue2),
obscureText: true,
obscuringCharacter: '*',
onChanged: (value) => updatedValue2 = value,
),
],
content: Container(
constraints: BoxConstraints(maxWidth: 200, maxHeight: 200),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
TextField(
autofocus: true,
controller: TextEditingController(
text: updatedValue1,
),
obscureText: true,
obscuringCharacter: '*',
onChanged: (value) => updatedValue1 = value,
),
const SizedBox(height: _padding, width: _padding),
TextField(
autofocus: false,
controller: TextEditingController(
text: updatedValue2,
),
obscureText: true,
obscuringCharacter: '*',
onChanged: (value) => updatedValue2 = value,
),
],
),
),
title: Text(key),
);
@ -342,7 +352,14 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
widget.settings.forEach((key, value) {
if (key == 'ApiAuth') {
_addPasswordSetting(commonSettings, widget.settings, key, value, true);
_addPasswordSetting(
commonSettings,
widget.settings,
key,
value,
true,
validators: getSettingValidators(key),
);
} else if (key == 'ApiPort') {
_addIntSetting(
commonSettings,