Add confirmation before deleting wallet; Add titles to AppBars; Allow space in wallets names
This commit is contained in:
parent
cc22dd6a08
commit
9d07d7373c
|
@ -41,7 +41,11 @@ class ConfirmStoreWalletState extends State<ConfirmStoreWallet> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(),
|
appBar: AppBar(
|
||||||
|
title: SizedBox(
|
||||||
|
height: 25,
|
||||||
|
child: Text('Confirmez ce portefeuille'),
|
||||||
|
)),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
|
@ -96,8 +100,8 @@ class ConfirmStoreWalletState extends State<ConfirmStoreWallet> {
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
new FilteringTextInputFormatter.allow(
|
FilteringTextInputFormatter.allow(
|
||||||
RegExp('[a-zA-Z|0-9|\\-|_]')),
|
RegExp('[a-zA-Z|0-9|\\-|_| ]')),
|
||||||
],
|
],
|
||||||
enabled: isAskedWordValid,
|
enabled: isAskedWordValid,
|
||||||
controller: this.walletName,
|
controller: this.walletName,
|
||||||
|
@ -201,7 +205,7 @@ class ConfirmStoreWalletState extends State<ConfirmStoreWallet> {
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Approve'),
|
child: Text("J'ai compris"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,7 +37,11 @@ class GenerateWalletsState extends State<GenerateWalletsScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(
|
||||||
|
title: SizedBox(
|
||||||
|
height: 25,
|
||||||
|
child: Text('Générer un portefeuille'),
|
||||||
|
)),
|
||||||
floatingActionButton: Container(
|
floatingActionButton: Container(
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
width: 80.0,
|
width: 80.0,
|
||||||
|
|
|
@ -36,7 +36,11 @@ class WalletOptionsState extends State<WalletOptions> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(),
|
appBar: AppBar(
|
||||||
|
title: SizedBox(
|
||||||
|
height: 25,
|
||||||
|
child: Text(widget.walletName),
|
||||||
|
)),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
|
@ -212,14 +216,53 @@ class WalletOptionsState extends State<WalletOptions> {
|
||||||
final _walletFile = Directory('$appPath/wallets/$_name');
|
final _walletFile = Directory('$appPath/wallets/$_name');
|
||||||
print('DELETE THAT ?: $_walletFile');
|
print('DELETE THAT ?: $_walletFile');
|
||||||
|
|
||||||
|
final bool _answer = await _confirmDeletingWallet();
|
||||||
|
|
||||||
|
if (_answer) {
|
||||||
_walletFile.deleteSync(recursive: true);
|
_walletFile.deleteSync(recursive: true);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> _confirmDeletingWallet() async {
|
||||||
|
return showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true, // user must tap button!
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Êtes-vous sûr de vouloir supprimer le portefeuille ${widget.walletName} ?'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Vous pourrez restaurer ce portefeuille à tout moment grace à votre phrase de restauration.'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text("Non"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text("Oui"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> get _localPath async {
|
Future<String> get _localPath async {
|
||||||
final directory = await getApplicationDocumentsDirectory();
|
final directory = await getApplicationDocumentsDirectory();
|
||||||
return directory.path;
|
return directory.path;
|
||||||
|
|
Loading…
Reference in New Issue