more on enter password
This commit is contained in:
parent
a110db32e9
commit
52139dc84b
@ -179,6 +179,7 @@ void showSuccess(String text) {
|
|||||||
// https://material.io/develop/flutter/components/dialogs
|
// https://material.io/develop/flutter/components/dialogs
|
||||||
void enterPasswordDialog(String id, BuildContext context) {
|
void enterPasswordDialog(String id, BuildContext context) {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
|
final controller = TextEditingController();
|
||||||
var remember = FFI.getByName('remember', arg: id) == 'true';
|
var remember = FFI.getByName('remember', arg: id) == 'true';
|
||||||
var dialog = AlertDialog(
|
var dialog = AlertDialog(
|
||||||
title: Text('Please enter your password'),
|
title: Text('Please enter your password'),
|
||||||
@ -187,7 +188,9 @@ void enterPasswordDialog(String id, BuildContext context) {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
|
autofocus: true,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
|
controller: controller,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
),
|
),
|
||||||
@ -198,7 +201,9 @@ void enterPasswordDialog(String id, BuildContext context) {
|
|||||||
),
|
),
|
||||||
leading: Checkbox(
|
leading: Checkbox(
|
||||||
value: remember,
|
value: remember,
|
||||||
onChanged: (_) {},
|
onChanged: (v) {
|
||||||
|
remember = v;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -206,12 +211,21 @@ void enterPasswordDialog(String id, BuildContext context) {
|
|||||||
actions: [
|
actions: [
|
||||||
FlatButton(
|
FlatButton(
|
||||||
textColor: MyTheme.accent,
|
textColor: MyTheme.accent,
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
child: Text('Cancel'),
|
child: Text('Cancel'),
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
textColor: MyTheme.accent,
|
textColor: MyTheme.accent,
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () {
|
||||||
|
var text = controller.text.trim();
|
||||||
|
if (text == '') return;
|
||||||
|
FFI.login(text, remember);
|
||||||
|
showLoading('Logging in...');
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -222,7 +236,7 @@ void enterPasswordDialog(String id, BuildContext context) {
|
|||||||
void wrongPasswordDialog(String id, BuildContext context) {
|
void wrongPasswordDialog(String id, BuildContext context) {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
var dialog = AlertDialog(
|
var dialog = AlertDialog(
|
||||||
title: Text('Please enter your password'),
|
title: Text('Wrong Password'),
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
content: Text('Do you want to enter again?'),
|
content: Text('Do you want to enter again?'),
|
||||||
actions: [
|
actions: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user