Create management portal in Flutter #39
This commit is contained in:
parent
edd27e3e34
commit
d920a55fc0
@ -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':
|
||||
|
@ -237,25 +237,35 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
||||
},
|
||||
),
|
||||
],
|
||||
content: Row(
|
||||
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),
|
||||
controller: TextEditingController(
|
||||
text: updatedValue1,
|
||||
),
|
||||
obscureText: true,
|
||||
obscuringCharacter: '*',
|
||||
onChanged: (value) => updatedValue1 = value,
|
||||
),
|
||||
const SizedBox(height: _padding),
|
||||
const SizedBox(height: _padding, width: _padding),
|
||||
TextField(
|
||||
autofocus: true,
|
||||
controller: TextEditingController(text: updatedValue2),
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user