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(
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: [
PasswordWidget(controller: controller),
CheckboxListTile(
@ -671,11 +677,22 @@ class _ControlMenu extends StatelessWidget {
setState(() => autoLogin = v);
},
),
]),
actions: [
dialogButton('Cancel', onPressed: close, isOutline: true),
dialogButton('OK', onPressed: submit),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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,
onCancel: close,
);

View File

@ -75,10 +75,20 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
}
return CustomAlertDialog(
title: Text(translate('Set your own password')),
content: Form(
title: Column(
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,
child: Column(mainAxisSize: MainAxisSize.min, children: [
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextFormField(
autofocus: true,
obscureText: true,
@ -119,20 +129,29 @@ void setPermanentPasswordDialog(OverlayDialogManager dialogManager) async {
: translate('The confirmation is not identical.');
},
),
])),
onCancel: close,
onSubmit: (validateLength && validateSame) ? submit : null,
actions: [
dialogButton(
'Cancel',
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ElevatedButton.icon(
icon: Icon(Icons.close_rounded),
label: Text(translate("Cancel")),
onPressed: close,
isOutline: true,
),
dialogButton(
'OK',
onPressed: (validateLength && validateSame) ? submit : null,
ElevatedButton.icon(
icon: Icon(Icons.done_rounded),
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(
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: [
PasswordWidget(controller: controller),
CheckboxListTile(
@ -208,11 +233,22 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
}
},
),
]),
actions: [
dialogButton('Cancel', onPressed: cancel, isOutline: true),
dialogButton('OK', onPressed: submit),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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,
onCancel: cancel,
);