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) { List<Validator> getSettingValidators(String settingPath) {
switch (settingPath) { switch (settingPath) {
case 'ApiAuth':
return [(value) => value.isNotEmpty];
case 'EncryptConfig.EncryptionToken': case 'EncryptConfig.EncryptionToken':
return [(value) => value.isNotEmpty]; return [(value) => value.isNotEmpty];
case 'EncryptConfig.Path': case 'EncryptConfig.Path':

View File

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