From b195b649a3b30beb40608e096e341b56ca3a8408 Mon Sep 17 00:00:00 2001 From: open-trade Date: Mon, 16 Nov 2020 22:12:32 +0800 Subject: [PATCH] wrongPasswordDialog --- flutter_hbb/lib/common.dart | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/flutter_hbb/lib/common.dart b/flutter_hbb/lib/common.dart index 209655daf..21d3e1a40 100644 --- a/flutter_hbb/lib/common.dart +++ b/flutter_hbb/lib/common.dart @@ -117,10 +117,14 @@ void dismissLoading() { EasyLoading.dismiss(); } -void enterPasswordDialog(String id, BuildContext context) { +void showSuccess(String text) { + EasyLoading.showSuccess(text); +} + +AlertDialog enterPasswordDialog(String id, BuildContext context) { var ffi = Provider.of(context); var remember = ffi.getByName("remember", arg: id) == "true"; - AlertDialog( + return AlertDialog( title: Text('Please enter your password'), contentPadding: EdgeInsets.zero, content: Column( @@ -157,3 +161,26 @@ void enterPasswordDialog(String id, BuildContext context) { ], ); } + +AlertDialog wrongPasswordDialog(String id, BuildContext context) { + return AlertDialog( + title: Text('Please enter your password'), + contentPadding: EdgeInsets.zero, + content: Text('Do you want to enter again?'), + actions: [ + FlatButton( + textColor: MyTheme.accent, + onPressed: () => Navigator.pop(context), + child: Text('Cancel'), + ), + FlatButton( + textColor: MyTheme.accent, + onPressed: () { + Navigator.pop(context); + enterPasswordDialog(id, context); + }, + child: Text('Retry'), + ), + ], + ); +}