added show/hide password buttons
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-03-21 17:56:31 -05:00
parent f5b912b16f
commit 1cc3e6baf0
2 changed files with 96 additions and 52 deletions

View File

@ -347,7 +347,7 @@ Future<String?> promptPassword() async {
obscuringCharacter: '*', obscuringCharacter: '*',
onChanged: (value) => password = value, onChanged: (value) => password = value,
), ),
title: const Text('Enter Authentication Password'), title: const Text('Enter Repertory Portal Password'),
); );
}, },
); );

View File

@ -161,9 +161,13 @@ void createPasswordSetting(
onPressed: (_) { onPressed: (_) {
String updatedValue1 = value; String updatedValue1 = value;
String updatedValue2 = value; String updatedValue2 = value;
bool hidePassword1 = true;
bool hidePassword2 = true;
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return StatefulBuilder(
builder: (context, setDialogState) {
return AlertDialog( return AlertDialog(
actions: [ actions: [
TextButton( TextButton(
@ -200,21 +204,59 @@ void createPasswordSetting(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
TextField( Row(
children: [
Expanded(
child: TextField(
autofocus: true, autofocus: true,
controller: TextEditingController(text: updatedValue1), controller: TextEditingController(
obscureText: true, text: updatedValue1,
),
obscureText: hidePassword1,
obscuringCharacter: '*', obscuringCharacter: '*',
onChanged: (value) => updatedValue1 = value, onChanged: (value) => updatedValue1 = value,
), ),
),
IconButton(
onPressed:
() => setDialogState(
() => hidePassword1 = !hidePassword1,
),
icon: Icon(
hidePassword1
? Icons.visibility
: Icons.visibility_off,
),
),
],
),
const SizedBox(height: constants.padding), const SizedBox(height: constants.padding),
TextField( Row(
children: [
Expanded(
child: TextField(
autofocus: false, autofocus: false,
controller: TextEditingController(text: updatedValue2), controller: TextEditingController(
obscureText: true, text: updatedValue2,
),
obscureText: hidePassword2,
obscuringCharacter: '*', obscuringCharacter: '*',
onChanged: (value) => updatedValue2 = value, onChanged: (value) => updatedValue2 = value,
), ),
),
IconButton(
onPressed:
() => setDialogState(
() => hidePassword2 = !hidePassword2,
),
icon: Icon(
hidePassword2
? Icons.visibility
: Icons.visibility_off,
),
),
],
),
], ],
), ),
title: createSettingTitle(context, key, description), title: createSettingTitle(context, key, description),
@ -222,6 +264,8 @@ void createPasswordSetting(
}, },
); );
}, },
);
},
), ),
); );
} }