Newer
Older
import 'package:gecko/ui/myWallets/generateWalletsScreen.dart';
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class WalletsHome extends StatelessWidget {
MyWalletsProvider myWalletProvider = MyWalletsProvider();
@override
Widget build(BuildContext context) {
myWalletProvider.checkIfWalletExist();
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
return Scaffold(
floatingActionButton: Visibility(
.checkIfWalletExist()), //!checkIfWalletExist('MonWallet') &&
child: Container(
height: 80.0,
width: 80.0,
child: FittedBox(
child: FloatingActionButton(
heroTag: "buttonGenerateWallet",
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return GenerateWalletsScreen();
}),
},
child: Container(
height: 40.0,
width: 40.0,

poka
committed
child: Icon(Icons.person_add_alt_1_rounded,
color: Colors.grey[850])),
backgroundColor: Color(0xffEFEFBF))))),
body: SafeArea(
child: Column(children: <Widget>[
Visibility(
child: Column(children: <Widget>[
SizedBox(height: 120),
Center(
child: Text("Vous n'avez encore généré aucun portefeuille.",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500),
textAlign: TextAlign.center)),
SizedBox(height: 80),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Color(0xffFFD68E), // background
onPrimary: Colors.black, // foreground
),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return GenerateWalletsScreen();
}),
child: Text('Générer un portefeuille',
style: TextStyle(fontSize: 20))),
SizedBox(height: 15),
Center(
child: Text("ou",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500),
textAlign: TextAlign.center)),
SizedBox(height: 15),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Color(0xffFFD68E), // background
onPrimary: Colors.black, // foreground
),
child: Text('Importer un portefeuille existant',
style: TextStyle(fontSize: 20))),
])),
Visibility(
visible: myWalletProvider.checkIfWalletExist(),
child: myWalletsList(context))
])));
}
// Future resetWalletState() async {
// final bool _isExist = await checkIfWalletExist('MonWallet');
// print('The wallet exist in resetWalletState(): ' + _isExist.toString());
// // initState();
// // _keyMyWallets.currentState.setState(() {});
// // _keyMyWallets.currentState.initAppDirectory();
// setState(() {
// // getAllWalletsNames();
// // this.walletIsGenerated = true;
// });
// }
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
myWalletsList(BuildContext context) {
return Column(children: <Widget>[
SizedBox(height: 8),
for (var repository in myWalletProvider.listWallets)
ListTile(
contentPadding: const EdgeInsets.all(5.0),
leading: Text(repository, style: TextStyle(fontSize: 14.0)),
title: Text(repository, style: TextStyle(fontSize: 14.0)),
subtitle: Text(repository, style: TextStyle(fontSize: 14.0)),
dense: true,
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return WalletOptions(walletName: repository);
}));
},
),
SizedBox(height: 20),
SizedBox(
width: 75.0,
height: 25.0,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 2,
primary: Color(0xffFFD68E), //Color(0xffFFD68E), // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
myWalletProvider.listWallets =
myWalletProvider.getAllWalletsNames();
},
child: Text('(Refresh)', style: TextStyle(fontSize: 10))))
]);
}