password dialog

This commit is contained in:
NicKoehler 2023-02-28 16:36:44 +01:00
parent 7bf728bdad
commit 18339cf343
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58
2 changed files with 118 additions and 65 deletions

View File

@ -655,7 +655,13 @@ class _ControlMenu extends StatelessWidget {
} }
return CustomAlertDialog( return CustomAlertDialog(
title: Text(translate('OS Password')), title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.password_rounded, color: MyTheme.accent),
Text(translate('OS Password')).paddingOnly(left: 10),
],
),
content: Column(mainAxisSize: MainAxisSize.min, children: [ content: Column(mainAxisSize: MainAxisSize.min, children: [
PasswordWidget(controller: controller), PasswordWidget(controller: controller),
CheckboxListTile( CheckboxListTile(
@ -671,11 +677,22 @@ class _ControlMenu extends StatelessWidget {
setState(() => autoLogin = v); setState(() => autoLogin = v);
}, },
), ),
]), Row(
actions: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
dialogButton('Cancel', onPressed: close, isOutline: true), children: [
dialogButton('OK', onPressed: submit), ElevatedButton.icon(
icon: Icon(Icons.close_rounded),
label: Text(translate("Cancel")),
onPressed: close,
),
ElevatedButton.icon(
icon: Icon(Icons.done_rounded),
label: Text(translate("Ok")),
onPressed: submit,
),
], ],
).paddingOnly(top: 20)
]),
onSubmit: submit, onSubmit: submit,
onCancel: close, onCancel: close,
); );

View File

@ -75,10 +75,20 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
} }
return CustomAlertDialog( return CustomAlertDialog(
title: Text(translate('Set your own password')), title: Column(
content: Form( mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.password_rounded, color: MyTheme.accent),
Text(translate('Set your own password')).paddingOnly(left: 10),
],
),
content: Column(
children: [
Form(
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
child: Column(mainAxisSize: MainAxisSize.min, children: [ child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextFormField( TextFormField(
autofocus: true, autofocus: true,
obscureText: true, obscureText: true,
@ -119,20 +129,29 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
: translate('The confirmation is not identical.'); : translate('The confirmation is not identical.');
}, },
), ),
])), Row(
onCancel: close, mainAxisAlignment: MainAxisAlignment.spaceBetween,
onSubmit: (validateLength && validateSame) ? submit : null, children: [
actions: [ ElevatedButton.icon(
dialogButton( icon: Icon(Icons.close_rounded),
'Cancel', label: Text(translate("Cancel")),
onPressed: close, onPressed: close,
isOutline: true,
), ),
dialogButton( ElevatedButton.icon(
'OK', icon: Icon(Icons.done_rounded),
onPressed: (validateLength && validateSame) ? submit : null, label: Text(translate("Ok")),
onPressed:
(validateLength && validateSame) ? submit : null,
), ),
], ],
).paddingOnly(top: 20)
],
),
),
],
),
onCancel: close,
onSubmit: (validateLength && validateSame) ? submit : null,
); );
}); });
} }
@ -191,7 +210,13 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
} }
return CustomAlertDialog( return CustomAlertDialog(
title: Text(translate('Password Required')), title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.password_rounded, color: MyTheme.accent),
Text(translate('Password Required')).paddingOnly(left: 10),
],
),
content: Column(mainAxisSize: MainAxisSize.min, children: [ content: Column(mainAxisSize: MainAxisSize.min, children: [
PasswordWidget(controller: controller), PasswordWidget(controller: controller),
CheckboxListTile( CheckboxListTile(
@ -208,11 +233,22 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
} }
}, },
), ),
]), Row(
actions: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
dialogButton('Cancel', onPressed: cancel, isOutline: true), children: [
dialogButton('OK', onPressed: submit), ElevatedButton.icon(
icon: Icon(Icons.close_rounded),
label: Text(translate("Cancel")),
onPressed: close,
),
ElevatedButton.icon(
icon: Icon(Icons.done_rounded),
label: Text(translate("Ok")),
onPressed: submit,
),
], ],
).paddingOnly(top: 20)
]),
onSubmit: submit, onSubmit: submit,
onCancel: cancel, onCancel: cancel,
); );