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'), + ), + ], + ); +}