Change wallet list store format; Start to implement figma wallet options screen
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 585 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 284 B |
After Width: | Height: | Size: 719 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 2.2 KiB |
|
@ -1,9 +1,12 @@
|
|||
import 'dart:io';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
// Files paths
|
||||
Directory appPath;
|
||||
Directory walletsDirectory;
|
||||
File defaultWalletFile;
|
||||
File currentChestFile;
|
||||
|
||||
String defaultWallet;
|
||||
String appVersion;
|
||||
SharedPreferences prefs;
|
||||
|
|
|
@ -28,7 +28,7 @@ Future<void> main() async {
|
|||
MyWalletsProvider _walletsProvider = MyWalletsProvider();
|
||||
await _homeProvider.getAppPath();
|
||||
await _homeProvider.createDefaultAvatar();
|
||||
await _walletsProvider.getDefaultWallet();
|
||||
await _walletsProvider.initWalletFolder();
|
||||
appVersion = await _homeProvider.getAppVersion();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
final HiveStore _store =
|
||||
|
|
|
@ -67,7 +67,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
|||
String _name;
|
||||
|
||||
List queryOptions = await _buildQuery(_pubkey);
|
||||
final response = await http.post(queryOptions[0],
|
||||
final response = await http.post((Uri.parse(queryOptions[0])),
|
||||
body: queryOptions[1], headers: queryOptions[2]);
|
||||
// print('RESULT CESIUM QUERY: ${response.body}'); //For debug
|
||||
final responseJson = json.decode(response.body);
|
||||
|
@ -87,7 +87,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
|||
|
||||
Future<List> getAvatar(String _pubkey) async {
|
||||
List queryOptions = await _buildQuery(_pubkey);
|
||||
final response = await http.post(queryOptions[0],
|
||||
final response = await http.post((Uri.parse(queryOptions[0])),
|
||||
body: queryOptions[1], headers: queryOptions[2]);
|
||||
// print('RESULT CESIUM QUERY: ${response.body}'); //For debug
|
||||
final responseJson = json.decode(response.body);
|
||||
|
|
|
@ -39,14 +39,16 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
bool canImport = false;
|
||||
bool isPinChanged = false;
|
||||
|
||||
Future storeHDWallet(
|
||||
Future storeHDWChest(
|
||||
NewWallet _wallet, String _name, BuildContext context) async {
|
||||
// Directory walletDirectory;
|
||||
|
||||
final Directory hdDirectory = Directory('${walletsDirectory.path}/0');
|
||||
await hdDirectory.create();
|
||||
|
||||
final configFile = File('${hdDirectory.path}/config.txt');
|
||||
final configFile = File('${hdDirectory.path}/list.conf');
|
||||
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
|
||||
|
||||
final dewifFile = File('${hdDirectory.path}/wallet.dewif');
|
||||
|
||||
// List<String> _lastConfig = [];
|
||||
|
@ -61,8 +63,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
accountsIndex: [_derivationNbr]);
|
||||
String _pubkey = _pubkeysTmp[0];
|
||||
|
||||
await configFile.writeAsString('0:$_name:$_derivationNbr:$_pubkey');
|
||||
await configFile.writeAsString('0:0:$_name:$_derivationNbr:$_pubkey');
|
||||
await dewifFile.writeAsString(_wallet.dewif);
|
||||
bool isCurrentChestExist = _currentChestFile.existsSync();
|
||||
if (isCurrentChestExist) {
|
||||
await _currentChestFile.delete();
|
||||
}
|
||||
await _currentChestFile.create();
|
||||
await _currentChestFile.writeAsString('0');
|
||||
|
||||
return _name;
|
||||
}
|
||||
|
@ -147,11 +155,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
generatedMnemonic = await DubpRust.genMnemonic(language: Language.french);
|
||||
this.actualWallet = await generateWallet(this.generatedMnemonic);
|
||||
walletIsGenerated = true;
|
||||
// notifyListeners();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
// await checkIfWalletExist();
|
||||
return generatedMnemonic;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ class HistoryProvider with ChangeNotifier {
|
|||
// Lion simone: 78jhpprYkMNF6i5kQPXfkAVBpd2aqcpieNsXTSW4c21f
|
||||
|
||||
List parseHistory(txs, _pubkey) {
|
||||
// print(txs);
|
||||
var transBC = [];
|
||||
int i = 0;
|
||||
|
||||
|
@ -135,7 +134,7 @@ class HistoryProvider with ChangeNotifier {
|
|||
transBC[i].add(date);
|
||||
// print(
|
||||
// "DEBUG date et comment: ${date.toString()} -- ${transaction['comment'].toString()}");
|
||||
int amountBrut = int.parse(output.split(':')[0]);
|
||||
final int amountBrut = int.parse(output.split(':')[0]);
|
||||
final base = int.parse(output.split(':')[1]);
|
||||
final int applyBase = base - currentBase;
|
||||
final num amount =
|
||||
|
|
|
@ -8,15 +8,50 @@ import 'package:provider/provider.dart';
|
|||
class MyWalletsProvider with ChangeNotifier {
|
||||
String listWallets;
|
||||
|
||||
Future initWalletFolder() async {
|
||||
await getDefaultWallet();
|
||||
|
||||
final bool isWalletFolderExist = await walletsDirectory.exists();
|
||||
if (!isWalletFolderExist) {
|
||||
await Directory(walletsDirectory.path).create();
|
||||
}
|
||||
|
||||
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
|
||||
|
||||
await _currentChestFile.create();
|
||||
await _currentChestFile.writeAsString('0');
|
||||
|
||||
final bool isChestsExist =
|
||||
await Directory('${walletsDirectory.path}/0').exists();
|
||||
if (!isChestsExist) {
|
||||
await Directory('${walletsDirectory.path}/0').create();
|
||||
await Directory('${walletsDirectory.path}/1').create();
|
||||
await File('${walletsDirectory.path}/0/list.conf').create();
|
||||
await File('${walletsDirectory.path}/0/order.conf').create();
|
||||
await File('${walletsDirectory.path}/1/list.conf').create();
|
||||
await File('${walletsDirectory.path}/1/order.conf').create();
|
||||
}
|
||||
}
|
||||
|
||||
int getCurrentChest() {
|
||||
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
|
||||
|
||||
bool isCurrentChestExist = _currentChestFile.existsSync();
|
||||
if (!isCurrentChestExist) {
|
||||
_currentChestFile.createSync();
|
||||
_currentChestFile.writeAsString('0');
|
||||
}
|
||||
return int.parse(_currentChestFile.readAsStringSync());
|
||||
}
|
||||
|
||||
bool checkIfWalletExist() {
|
||||
if (appPath == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
print(walletsDirectory.listSync());
|
||||
final String _walletList = getAllWalletsNames(0);
|
||||
|
||||
List contents = walletsDirectory.listSync();
|
||||
if (contents.length == 0) {
|
||||
if (_walletList == '') {
|
||||
print('No wallets detected');
|
||||
return false;
|
||||
} else {
|
||||
|
@ -25,12 +60,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
String getAllWalletsNames() {
|
||||
final bool _isWalletsExists = checkIfWalletExist();
|
||||
if (!_isWalletsExists) {
|
||||
return '';
|
||||
}
|
||||
|
||||
String getAllWalletsNames(int _chest) {
|
||||
if (listWallets != null && listWallets.isNotEmpty) {
|
||||
listWallets = '';
|
||||
}
|
||||
|
@ -39,17 +69,13 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
// int i = 0;
|
||||
walletsDirectory
|
||||
.listSync(recursive: false, followLinks: false)
|
||||
.forEach((_wallet) {
|
||||
File _walletConfig = File('${_wallet.path}/config.txt');
|
||||
_walletConfig.readAsLinesSync().forEach((element) {
|
||||
if (listWallets != '') {
|
||||
listWallets += '\n';
|
||||
}
|
||||
listWallets += element;
|
||||
// listWallets += "${element.split(':')[0]}:${element.split(':')[1]}:${element.split(':')[2]}"
|
||||
});
|
||||
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
|
||||
_walletConfig.readAsLinesSync().forEach((element) {
|
||||
if (listWallets != '') {
|
||||
listWallets += '\n';
|
||||
}
|
||||
listWallets += element;
|
||||
// listWallets += "${element.split(':')[0]}:${element.split(':')[1]}:${element.split(':')[2]}"
|
||||
});
|
||||
print(listWallets);
|
||||
|
||||
|
@ -68,9 +94,9 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
try {
|
||||
defaultWallet = await defaultWalletFile.readAsString();
|
||||
} catch (e) {
|
||||
defaultWallet = '0:3';
|
||||
defaultWallet = '0:0';
|
||||
}
|
||||
if (defaultWallet == '') defaultWallet = '0:3';
|
||||
if (defaultWallet == '') defaultWallet = '0:0';
|
||||
}
|
||||
|
||||
Future<int> deleteAllWallet(context) async {
|
||||
|
@ -82,6 +108,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
if (_answer) {
|
||||
await walletsDirectory.delete(recursive: true);
|
||||
await walletsDirectory.create();
|
||||
await initWalletFolder();
|
||||
notifyListeners();
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
@ -114,7 +141,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
onPressed: () {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider.getAllWalletsNames();
|
||||
_myWalletProvider.getAllWalletsNames(getCurrentChest());
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
Navigator.pop(context, true);
|
||||
|
@ -128,18 +155,24 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
Future<void> generateNewDerivation(context, String _name) async {
|
||||
int _newDerivationNbr;
|
||||
final _walletConfig = File('${walletsDirectory.path}/0/config.txt');
|
||||
int _newWalletNbr;
|
||||
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
||||
|
||||
if (await _walletConfig.readAsString() == '') {
|
||||
_newDerivationNbr = 3;
|
||||
_newWalletNbr = 0;
|
||||
} else {
|
||||
String _lastWallet =
|
||||
await _walletConfig.readAsLines().then((value) => value.last);
|
||||
int _lastDerivation = int.parse(_lastWallet.split(':')[2]);
|
||||
int _lastDerivation = int.parse(_lastWallet.split(':')[3]);
|
||||
_newDerivationNbr = _lastDerivation + 3;
|
||||
|
||||
int _lastWalletNbr = int.parse(_lastWallet.split(':')[1]);
|
||||
_newWalletNbr = _lastWalletNbr + 1;
|
||||
}
|
||||
|
||||
await _walletConfig.writeAsString('\n0:$_name:$_newDerivationNbr',
|
||||
await _walletConfig.writeAsString(
|
||||
'\n0:$_newWalletNbr:$_name:$_newDerivationNbr',
|
||||
mode: FileMode.append);
|
||||
|
||||
print(await _walletConfig.readAsString());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const String getHistory = r'''
|
||||
query ($pubkey: String!, $number: Int!, $cursor: String) {
|
||||
txsHistoryBc(
|
||||
pubkeyOrScript: $pubkey
|
||||
script: $pubkey
|
||||
pagination: { pageSize: $number, ord: DESC, cursor: $cursor }
|
||||
) {
|
||||
both {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import 'dart:io';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:dubp/dubp.dart';
|
||||
import 'package:fast_base58/fast_base58.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:truncate/truncate.dart';
|
||||
|
||||
class WalletOptionsProvider with ChangeNotifier {
|
||||
TextEditingController pubkey = TextEditingController();
|
||||
|
@ -65,8 +68,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
int _walletNbr, String _pin, int _pinLenght, int derivation) async {
|
||||
isWalletUnlock = false;
|
||||
try {
|
||||
File _walletFile =
|
||||
File('${walletsDirectory.path}/$_walletNbr/wallet.dewif');
|
||||
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
|
||||
String _localDewif = await _walletFile.readAsString();
|
||||
String _localPubkey;
|
||||
|
||||
|
@ -107,8 +109,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
int getPinLenght(_walletNbr) {
|
||||
String _localDewif;
|
||||
if (_walletNbr is int) {
|
||||
File _walletFile =
|
||||
File('${walletsDirectory.path}/$_walletNbr/wallet.dewif');
|
||||
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
|
||||
_localDewif = _walletFile.readAsStringSync();
|
||||
} else {
|
||||
_localDewif = _walletNbr;
|
||||
|
@ -121,21 +122,21 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future _renameWallet(_walletName, _newName, _walletNbr, _derivation) async {
|
||||
final _walletConfig =
|
||||
File('${walletsDirectory.path}/$_walletNbr/config.txt');
|
||||
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
||||
|
||||
String newConfig =
|
||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||
int nbrLines = lines.length;
|
||||
int _index = lines.indexOf('$_walletNbr:$_walletName:$_derivation');
|
||||
print(lines);
|
||||
print(nbrLines);
|
||||
int _index = lines.indexOf('0:$_walletNbr:$_walletName:$_derivation');
|
||||
if (nbrLines != 1) {
|
||||
lines.removeWhere((element) =>
|
||||
element.contains('$_walletNbr:$_walletName:$_derivation'));
|
||||
lines.insert(_index, '$_walletNbr:$_newName:$_derivation');
|
||||
element.contains('0:$_walletNbr:$_walletName:$_derivation'));
|
||||
lines.insert(_index, '0:$_walletNbr:$_newName:$_derivation');
|
||||
return lines.join('\n');
|
||||
} else {
|
||||
return '$_walletNbr:$_newName:$_derivation';
|
||||
return '0:$_walletNbr:$_newName:$_derivation';
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -189,14 +190,13 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
final bool _answer = await _confirmDeletingWallet(context, _name);
|
||||
|
||||
if (_answer) {
|
||||
final _walletConfig =
|
||||
File('${walletsDirectory.path}/$_walletNbr/config.txt');
|
||||
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
||||
|
||||
if (_derivation != -1) {
|
||||
String newConfig =
|
||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||
lines.removeWhere(
|
||||
(element) => element.contains('$_walletNbr:$_name:$_derivation'));
|
||||
lines.removeWhere((element) =>
|
||||
element.contains('0:$_walletNbr:$_name:$_derivation'));
|
||||
|
||||
return lines.join('\n');
|
||||
});
|
||||
|
@ -289,6 +289,22 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
String getShortPubkey(String pubkey) {
|
||||
List<int> pubkeyByte = Base58Decode(pubkey);
|
||||
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
||||
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);
|
||||
String pubkeyChecksumShort = truncate(pubkeyCheksum, 3,
|
||||
omission: "", position: TruncatePosition.end);
|
||||
|
||||
String pubkeyShort = truncate(pubkey, 5,
|
||||
omission: String.fromCharCode(0x2026),
|
||||
position: TruncatePosition.end) +
|
||||
truncate(pubkey, 4, omission: "", position: TruncatePosition.start) +
|
||||
':$pubkeyChecksumShort';
|
||||
|
||||
return pubkeyShort;
|
||||
}
|
||||
|
||||
void reloadBuild() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
initialData: '...',
|
||||
builder: (context, snapshot) {
|
||||
return Text(
|
||||
snapshot.data != ''
|
||||
snapshot.data != null
|
||||
? snapshot.data
|
||||
: '-',
|
||||
style:
|
||||
|
|
|
@ -28,6 +28,8 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
|||
Provider.of<GenerateWalletsProvider>(context);
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
||||
|
||||
|
||||
this._mnemonicController.text = generatedMnemonic;
|
||||
return WillPopScope(
|
||||
|
@ -126,7 +128,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
|||
.isAskedWordValid &&
|
||||
this.walletName.text != '')
|
||||
? () async {
|
||||
await _generateWalletProvider.storeHDWallet(
|
||||
await _generateWalletProvider.storeHDWChest(
|
||||
generatedWallet,
|
||||
walletName.text,
|
||||
context);
|
||||
|
@ -138,7 +140,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
|||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames();
|
||||
.getAllWalletsNames(_currentChest);
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/myWallets.dart';
|
||||
import 'package:gecko/models/walletOptions.dart';
|
||||
import 'dart:async';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class WalletOptionsOld extends StatelessWidget with ChangeNotifier {
|
||||
WalletOptionsOld(
|
||||
{Key keyMyWallets,
|
||||
@required this.walletNbr,
|
||||
@required this.walletName,
|
||||
@required this.derivation})
|
||||
: super(key: keyMyWallets);
|
||||
int walletNbr;
|
||||
String walletName;
|
||||
int derivation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
print("Build walletOptions");
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
// _walletOptions.isWalletUnlock = false;
|
||||
print("Is unlock ? ${_walletOptions.isWalletUnlock}");
|
||||
|
||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/mywallets'),
|
||||
);
|
||||
return Future<bool>.value(true);
|
||||
},
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () {
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/mywallets'),
|
||||
);
|
||||
}),
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text(walletName),
|
||||
)),
|
||||
body: Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
'Clé publique:',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: _walletOptions.pubkey.text));
|
||||
_walletOptions.snackCopyKey(ctx);
|
||||
},
|
||||
child: Text(
|
||||
_walletOptions.pubkey.text,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace'),
|
||||
)),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
width: 300,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 5,
|
||||
primary: Color(
|
||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () => _walletOptions
|
||||
.renameWalletAlerte(
|
||||
context,
|
||||
walletName,
|
||||
walletNbr,
|
||||
derivation)
|
||||
.then((_result) {
|
||||
if (_result == true) {
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider
|
||||
.listWallets =
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames(_currentChest);
|
||||
_myWalletProvider
|
||||
.rebuildWidget();
|
||||
});
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName(
|
||||
'/mywallets'),
|
||||
);
|
||||
}
|
||||
}),
|
||||
child: Text('Renommer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))))),
|
||||
SizedBox(height: 30),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
width: 300,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 6,
|
||||
primary: Colors
|
||||
.redAccent, //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
await _walletOptions.deleteWallet(context,
|
||||
walletNbr, walletName, derivation);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider.getAllWalletsNames(_currentChest);
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
},
|
||||
child: Text('Supprimer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))),
|
||||
SizedBox(height: 50),
|
||||
Text(
|
||||
'Portefeuille déverrouillé',
|
||||
style: TextStyle(
|
||||
color: Colors.green,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 15),
|
||||
),
|
||||
SizedBox(height: 10)
|
||||
])),
|
||||
]),
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -27,12 +27,12 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
// _walletOptions.isWalletUnlock = false;
|
||||
print("Is unlock ? ${_walletOptions.isWalletUnlock}");
|
||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
||||
final String shortPubkey =
|
||||
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/mywallets'),
|
||||
|
@ -45,7 +45,6 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () {
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/mywallets'),
|
||||
|
@ -57,105 +56,124 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
)),
|
||||
body: Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
'Clé publique:',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: _walletOptions.pubkey.text));
|
||||
_walletOptions.snackCopyKey(ctx);
|
||||
},
|
||||
child: Text(
|
||||
_walletOptions.pubkey.text,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace'),
|
||||
)),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
width: 300,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 5,
|
||||
primary: Color(
|
||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () => _walletOptions
|
||||
.renameWalletAlerte(
|
||||
context,
|
||||
walletName,
|
||||
walletNbr,
|
||||
derivation)
|
||||
.then((_result) {
|
||||
if (_result == true) {
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider
|
||||
.listWallets =
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames();
|
||||
_myWalletProvider
|
||||
.rebuildWidget();
|
||||
});
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName(
|
||||
'/mywallets'),
|
||||
);
|
||||
}
|
||||
}),
|
||||
child: Text('Renommer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))))),
|
||||
SizedBox(height: 30),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
width: 300,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 6,
|
||||
primary: Colors
|
||||
.redAccent, //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
child: Expanded(
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 25),
|
||||
Row(children: <Widget>[
|
||||
SizedBox(width: 25),
|
||||
Image.asset(
|
||||
'assets/chopp-gecko2.png',
|
||||
),
|
||||
Image.asset(
|
||||
'assets/walletOptions/camera.png',
|
||||
),
|
||||
// SizedBox(width: 20),
|
||||
Column(children: <Widget>[
|
||||
Row(children: <Widget>[
|
||||
Column(children: <Widget>[
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: Text(
|
||||
walletName,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 27),
|
||||
)),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'500 DU',
|
||||
style: TextStyle(
|
||||
fontSize: 20, color: Colors.black),
|
||||
),
|
||||
onPressed: () async {
|
||||
await _walletOptions.deleteWallet(context,
|
||||
walletNbr, walletName, derivation);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider.getAllWalletsNames();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
},
|
||||
child: Text('Supprimer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))),
|
||||
SizedBox(height: 50),
|
||||
Text(
|
||||
'Portefeuille déverrouillé',
|
||||
style: TextStyle(
|
||||
color: Colors.green,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 15),
|
||||
SizedBox(height: 5),
|
||||
Image.asset(
|
||||
'assets/walletOptions/icon_oeuil.png',
|
||||
),
|
||||
]),
|
||||
SizedBox(width: 0),
|
||||
Column(children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/walletOptions/edit.png',
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
)
|
||||
])
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
Image.asset(
|
||||
'assets/walletOptions/QR_icon.png',
|
||||
),
|
||||
SizedBox(height: 10)
|
||||
])),
|
||||
]),
|
||||
SizedBox(height: 15),
|
||||
Row(children: <Widget>[
|
||||
SizedBox(width: 30),
|
||||
Image.asset(
|
||||
'assets/walletOptions/key.png',
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text("${shortPubkey.split(':')[0]}:",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: 'Monospace',
|
||||
color: Colors.black)),
|
||||
Text(shortPubkey.split(':')[1],
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: 'Monospace')),
|
||||
SizedBox(width: 15),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(8),
|
||||
),
|
||||
elevation: 1,
|
||||
primary: Color(0xffD28928), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
print('COPY PUBKEY');
|
||||
},
|
||||
child: Text('Copier',
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: Colors.grey[50]))),
|
||||
]),
|
||||
SizedBox(height: 10),
|
||||
Row(children: <Widget>[
|
||||
SizedBox(width: 30),
|
||||
Image.asset(
|
||||
'assets/walletOptions/clock.png',
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text('Historique des transactions',
|
||||
style:
|
||||
TextStyle(fontSize: 20, color: Colors.black)),
|
||||
]),
|
||||
SizedBox(height: 15),
|
||||
Row(children: <Widget>[
|
||||
SizedBox(width: 35),
|
||||
Image.asset(
|
||||
'assets/walletOptions/android-checkmark.png',
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text('Portefeuille par defaut',
|
||||
style:
|
||||
TextStyle(fontSize: 20, color: Colors.black)),
|
||||
]),
|
||||
SizedBox(height: 15),
|
||||
Row(children: <Widget>[
|
||||
SizedBox(width: 30),
|
||||
Image.asset(
|
||||
'assets/walletOptions/trash.png',
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text('Supprimer ce portefeuille',
|
||||
style: TextStyle(
|
||||
fontSize: 20, color: Color(0xffD80000))),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -20,12 +20,16 @@ class WalletsHome extends StatelessWidget {
|
|||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
||||
|
||||
final int _currentChest = myWalletProvider.getCurrentChest();
|
||||
|
||||
myWalletProvider.listWallets =
|
||||
myWalletProvider.getAllWalletsNames(_currentChest);
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
||||
if (myWalletProvider.listWallets != '') {
|
||||
firstWalletDerivation =
|
||||
int.parse(myWalletProvider.listWallets.split('\n')[0].split(':')[2]);
|
||||
int.parse(myWalletProvider.listWallets.split('\n')[0].split(':')[3]);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
|
@ -95,114 +99,79 @@ class WalletsHome extends StatelessWidget {
|
|||
for (String _repository in _listWallets)
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 1,
|
||||
colors: [
|
||||
Colors.green[100],
|
||||
Colors.green[500],
|
||||
],
|
||||
)),
|
||||
child:
|
||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||
// semanticsLabel: 'Gecko', height: 48),
|
||||
Image.asset(
|
||||
'assets/chopp-gecko2.png',
|
||||
),
|
||||
)),
|
||||
ListTile(
|
||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||
tileColor:
|
||||
"${_repository.split(':')[0]}:${_repository.split(':')[2]}" ==
|
||||
defaultWallet
|
||||
? Color(0xffD28928)
|
||||
: Color(0xffFFD58D),
|
||||
// leading: Text('IMAGE'),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return UnlockingWallet(
|
||||
walletNbr: int.parse(_repository.split(':')[1]),
|
||||
walletName: _repository.split(':')[2],
|
||||
derivation: int.parse(_repository.split(':')[3]));
|
||||
}));
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 1,
|
||||
colors: [
|
||||
Colors.green[100],
|
||||
Colors.green[500],
|
||||
],
|
||||
)),
|
||||
child:
|
||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||
// semanticsLabel: 'Gecko', height: 48),
|
||||
Image.asset(
|
||||
'assets/chopp-gecko2.png',
|
||||
),
|
||||
)),
|
||||
ListTile(
|
||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||
tileColor:
|
||||
"${_repository.split(':')[0]}:${_repository.split(':')[1]}" ==
|
||||
defaultWallet
|
||||
? Color(0xffD28928)
|
||||
: Color(0xffFFD58D),
|
||||
// leading: Text('IMAGE'),
|
||||
|
||||
// subtitle: Text(_repository.split(':')[3],
|
||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||
title: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Text(_repository.split(':')[1],
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color:
|
||||
"${_repository.split(':')[0]}:${_repository.split(':')[2]}" ==
|
||||
defaultWallet
|
||||
? Color(0xffF9F9F1)
|
||||
: Colors.black)))),
|
||||
// dense: true,
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return UnlockingWallet(
|
||||
walletNbr: int.parse(_repository.split(':')[0]),
|
||||
walletName: _repository.split(':')[1],
|
||||
derivation:
|
||||
int.parse(_repository.split(':')[2]));
|
||||
}));
|
||||
},
|
||||
)
|
||||
])))
|
||||
// subtitle: Text(_repository.split(':')[3],
|
||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||
title: Center(
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Text(_repository.split(':')[2],
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color:
|
||||
"${_repository.split(':')[0]}:${_repository.split(':')[1]}" ==
|
||||
defaultWallet
|
||||
? Color(0xffF9F9F1)
|
||||
: Colors.black)))),
|
||||
// dense: true,
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return UnlockingWallet(
|
||||
walletNbr:
|
||||
int.parse(_repository.split(':')[1]),
|
||||
walletName: _repository.split(':')[2],
|
||||
derivation:
|
||||
int.parse(_repository.split(':')[3]));
|
||||
}));
|
||||
},
|
||||
)
|
||||
]))))
|
||||
]);
|
||||
}
|
||||
|
||||
Widget myWalletsList(BuildContext context) {
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||
|
||||
if (!isWalletsExists) {
|
||||
return Text('');
|
||||
}
|
||||
|
||||
if (_myWalletProvider.listWallets == '') {
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Veuillez générer votre premier portefeuille',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
|
||||
)));
|
||||
}
|
||||
|
||||
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
||||
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
SizedBox(height: 8),
|
||||
for (String _repository in _listWallets)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.only(left: 7.0),
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text("0 Ğ1", style: TextStyle(fontSize: 14.0))),
|
||||
// subtitle: Text(_repository.split(':')[3],
|
||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||
title:
|
||||
Text(_repository.split(':')[1], style: TextStyle(fontSize: 16.0)),
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return UnlockingWallet(
|
||||
walletNbr: int.parse(_repository.split(':')[0]),
|
||||
walletName: _repository.split(':')[1],
|
||||
derivation: int.parse(_repository.split(':')[2]));
|
||||
}));
|
||||
},
|
||||
)
|
||||
]));
|
||||
}
|
||||
|
||||
Widget addNewDerivation(context, int _walletNbr) {
|
||||
final TextEditingController _newDerivationName = TextEditingController();
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/models/myWallets.dart';
|
||||
import 'package:gecko/models/walletOptions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/screens/myWallets/unlockingWallet.dart';
|
||||
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class WalletsHome extends StatelessWidget {
|
||||
final _derivationKey = GlobalKey<FormState>();
|
||||
int firstWalletDerivation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
||||
if (myWalletProvider.listWallets != '') {
|
||||
firstWalletDerivation =
|
||||
int.parse(myWalletProvider.listWallets.split('\n')[0].split(':')[2]);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Mes portefeuilles',
|
||||
style: TextStyle(color: Colors.grey[850])),
|
||||
backgroundColor: Color(0xffFFD58D),
|
||||
),
|
||||
floatingActionButton: Visibility(
|
||||
visible: (isWalletsExists && firstWalletDerivation != -1),
|
||||
child: Container(
|
||||
height: 80.0,
|
||||
width: 80.0,
|
||||
child: FittedBox(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "buttonGenerateWallet",
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return addNewDerivation(context, 1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: Icon(Icons.person_add_alt_1_rounded,
|
||||
color: Colors.grey[850])),
|
||||
backgroundColor: Color(0xffEFEFBF))))),
|
||||
body: SafeArea(
|
||||
child: !isWalletsExists
|
||||
? NoKeyChainScreen()
|
||||
: myWalletsList(context)));
|
||||
}
|
||||
|
||||
Widget myWalletsList(BuildContext context) {
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||
|
||||
if (!isWalletsExists) {
|
||||
return Text('');
|
||||
}
|
||||
|
||||
if (_myWalletProvider.listWallets == '') {
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Veuillez générer votre premier portefeuille',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
|
||||
)));
|
||||
}
|
||||
|
||||
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
||||
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
SizedBox(height: 8),
|
||||
for (String _repository in _listWallets)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.only(left: 7.0),
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text("0 Ğ1", style: TextStyle(fontSize: 14.0))),
|
||||
// subtitle: Text(_repository.split(':')[3],
|
||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||
title:
|
||||
Text(_repository.split(':')[1], style: TextStyle(fontSize: 16.0)),
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return UnlockingWallet(
|
||||
walletNbr: int.parse(_repository.split(':')[0]),
|
||||
walletName: _repository.split(':')[1],
|
||||
derivation: int.parse(_repository.split(':')[2]));
|
||||
}));
|
||||
},
|
||||
)
|
||||
]));
|
||||
}
|
||||
|
||||
Widget addNewDerivation(context, int _walletNbr) {
|
||||
final TextEditingController _newDerivationName = TextEditingController();
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
return AlertDialog(
|
||||
content: Stack(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
children: <Widget>[
|
||||
Form(
|
||||
key: _derivationKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text('Nom du portefeuille:'),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
controller: _newDerivationName,
|
||||
textAlign: TextAlign.center,
|
||||
autofocus: true,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 1,
|
||||
primary: Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
await _myWalletProvider
|
||||
.generateNewDerivation(
|
||||
context, _newDerivationName.text)
|
||||
.then((_) => _newDerivationName.text == '');
|
||||
},
|
||||
child: Text("Créer")),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -61,6 +61,8 @@ class OnboardingStepFourteen extends StatelessWidget {
|
|||
GenerateWalletsProvider _generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
|
||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
||||
|
||||
return Form(
|
||||
key: formKey,
|
||||
child: Padding(
|
||||
|
@ -116,9 +118,9 @@ class OnboardingStepFourteen extends StatelessWidget {
|
|||
if (resultWallet) {
|
||||
pinColor = Colors.green[500];
|
||||
print(generatedWallet.pin);
|
||||
await _generateWalletProvider.storeHDWallet(
|
||||
await _generateWalletProvider.storeHDWChest(
|
||||
generatedWallet, 'Mon portefeuille courant', context);
|
||||
_myWalletProvider.getAllWalletsNames();
|
||||
_myWalletProvider.getAllWalletsNames(_currentChest);
|
||||
_walletOptions.reloadBuild();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
Navigator.push(
|
||||
|
|
|
@ -67,3 +67,4 @@ flutter:
|
|||
- assets/icon/
|
||||
- assets/onBoarding/
|
||||
- assets/onBoarding/progress_bar/
|
||||
- assets/walletOptions/
|
||||
|
|