WIP: Make Cesium great again
This commit is contained in:
parent
f2055d1737
commit
44eaee89a7
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
|
@ -16,7 +16,16 @@ class ChestData extends HiveObject {
|
||||||
@HiveField(4)
|
@HiveField(4)
|
||||||
String imageName;
|
String imageName;
|
||||||
|
|
||||||
ChestData({this.dewif, this.name, this.defaultWallet, this.imageName});
|
@HiveField(5)
|
||||||
|
bool isCesium;
|
||||||
|
|
||||||
|
ChestData({
|
||||||
|
this.dewif,
|
||||||
|
this.name,
|
||||||
|
this.defaultWallet,
|
||||||
|
this.imageName,
|
||||||
|
this.isCesium,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
|
@ -21,13 +21,14 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
|
||||||
name: fields[2] as String,
|
name: fields[2] as String,
|
||||||
defaultWallet: fields[3] as int,
|
defaultWallet: fields[3] as int,
|
||||||
imageName: fields[4] as String,
|
imageName: fields[4] as String,
|
||||||
|
isCesium: fields[5] as bool,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, ChestData obj) {
|
void write(BinaryWriter writer, ChestData obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(4)
|
..writeByte(5)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.dewif)
|
..write(obj.dewif)
|
||||||
..writeByte(2)
|
..writeByte(2)
|
||||||
|
@ -35,7 +36,9 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
|
||||||
..writeByte(3)
|
..writeByte(3)
|
||||||
..write(obj.defaultWallet)
|
..write(obj.defaultWallet)
|
||||||
..writeByte(4)
|
..writeByte(4)
|
||||||
..write(obj.imageName);
|
..write(obj.imageName)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.isCesium);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -57,13 +57,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
walletBox.add(myWallet);
|
walletBox.add(myWallet);
|
||||||
ChestData thisChest = ChestData(
|
ChestData thisChest = ChestData(
|
||||||
dewif: _wallet.dewif,
|
dewif: _wallet.dewif,
|
||||||
name: chestName,
|
name: chestName,
|
||||||
defaultWallet: 0,
|
defaultWallet: 0,
|
||||||
imageName: '${chestNumber % 8}.png');
|
imageName: '${chestNumber % 8}.png',
|
||||||
|
isCesium: false,
|
||||||
|
);
|
||||||
chestBox.add(thisChest);
|
chestBox.add(thisChest);
|
||||||
configBox.put('currentChest', chestNumber);
|
configBox.put('currentChest', chestNumber);
|
||||||
// walletBox.get(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAskedWord(String inputWord, String _mnemo) {
|
void checkAskedWord(String inputWord, String _mnemo) {
|
||||||
|
@ -221,13 +222,15 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
log.d(_walletPubkey);
|
log.d(_walletPubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future importCesiumWallet(context, _cesiumID, _cesiumPWD) async {
|
Future importCesiumWallet() async {
|
||||||
// String _walletPubkey = await DubpRust.getLegacyPublicKey(
|
// String _walletPubkey = await DubpRust.getLegacyPublicKey(
|
||||||
// salt: _cesiumID, password: _cesiumPWD);
|
// salt: _cesiumID, password: _cesiumPWD);
|
||||||
// String shortPubkey = truncate(_walletPubkey, 9,
|
// String shortPubkey = truncate(_walletPubkey, 9,
|
||||||
// omission: "...", position: TruncatePosition.end);
|
// omission: "...", position: TruncatePosition.end);
|
||||||
// await storeWallet(
|
// await storeWallet(
|
||||||
// actualWallet, 'Portefeuille Cesium - $shortPubkey', context);
|
// actualWallet, 'Portefeuille Cesium - $shortPubkey', context);
|
||||||
|
// NewWallet myCesiumWallet = await DubpRust.genWalletFromDeprecatedSaltPassword(salt: _cesiumID, password: _cesiumPWD);
|
||||||
|
|
||||||
cesiumID.text = '';
|
cesiumID.text = '';
|
||||||
cesiumPWD.text = '';
|
cesiumPWD.text = '';
|
||||||
cesiumPubkey.text = '';
|
cesiumPubkey.text = '';
|
||||||
|
@ -236,6 +239,18 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
pin.text = '';
|
pin.text = '';
|
||||||
isCesiumIDVisible = false;
|
isCesiumIDVisible = false;
|
||||||
isCesiumPWDVisible = false;
|
isCesiumPWDVisible = false;
|
||||||
|
|
||||||
|
ChestData cesiumChest = ChestData(
|
||||||
|
dewif: actualWallet.dewif,
|
||||||
|
name: 'Coffre à Cesium',
|
||||||
|
imageName: 'cesium.png',
|
||||||
|
defaultWallet: 0,
|
||||||
|
isCesium: true);
|
||||||
|
|
||||||
|
int chestNumber = chestBox.length;
|
||||||
|
chestBox.add(cesiumChest);
|
||||||
|
configBox.put('currentChest', chestNumber);
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkIfWalletExist() {
|
bool checkIfWalletExist() {
|
||||||
if (appPath == null) {
|
if (chestBox.isEmpty) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final List _walletList = readAllWallets(getCurrentChest());
|
|
||||||
|
|
||||||
if (_walletList.isEmpty) {
|
|
||||||
log.i('No wallets detected');
|
log.i('No wallets detected');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,398 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/history.dart';
|
||||||
|
import 'package:gecko/models/myWallets.dart';
|
||||||
|
import 'package:gecko/models/queries.dart';
|
||||||
|
import 'package:gecko/models/walletData.dart';
|
||||||
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class CesiumWalletOptions extends StatelessWidget {
|
||||||
|
CesiumWalletOptions({Key keyMyWallets, @required this.cesiumWallet})
|
||||||
|
: super(key: keyMyWallets);
|
||||||
|
WalletData cesiumWallet;
|
||||||
|
int _nbrLinesName = 1;
|
||||||
|
bool _isNewNameValid = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
WalletOptionsProvider _walletOptions =
|
||||||
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
|
MyWalletsProvider _myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
|
||||||
|
final int _currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
final String shortPubkey =
|
||||||
|
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
||||||
|
|
||||||
|
if (_walletOptions.nameController.text == null ||
|
||||||
|
_isNewNameValid == false) {
|
||||||
|
_walletOptions.nameController.text = cesiumWallet.name;
|
||||||
|
} else {
|
||||||
|
cesiumWallet.name = _walletOptions.nameController.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
_walletOptions.nameController.text.length >= 15
|
||||||
|
? _nbrLinesName = 2
|
||||||
|
: _nbrLinesName = 1;
|
||||||
|
if (_walletOptions.nameController.text.length >= 26 && isTall)
|
||||||
|
_nbrLinesName = 3;
|
||||||
|
|
||||||
|
_walletOptions.walletID = [0, cesiumWallet.number];
|
||||||
|
|
||||||
|
WalletData defaultWallet =
|
||||||
|
_myWalletProvider.getDefaultWallet(_currentChest);
|
||||||
|
|
||||||
|
_walletOptions.isDefaultWallet =
|
||||||
|
(defaultWallet.number == _walletOptions.walletID[1]);
|
||||||
|
|
||||||
|
int currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
log.d("Wallet options: $currentChest:${cesiumWallet.number}");
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () {
|
||||||
|
_walletOptions.isEditing = false;
|
||||||
|
_walletOptions.isBalanceBlur = true;
|
||||||
|
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.isEditing = false;
|
||||||
|
_walletOptions.isBalanceBlur = true;
|
||||||
|
Navigator.popUntil(
|
||||||
|
context,
|
||||||
|
ModalRoute.withName('/mywallets'),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
title: SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text(_walletOptions.nameController.text),
|
||||||
|
)),
|
||||||
|
body: Builder(
|
||||||
|
builder: (ctx) => SafeArea(
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
height: isTall ? 15 : 0,
|
||||||
|
color: yellowC,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
yellowC,
|
||||||
|
Color(0xfffafafa),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
SizedBox(width: 25),
|
||||||
|
InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await _walletOptions.changeAvatar();
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/avatars/${cesiumWallet.imageName}',
|
||||||
|
width: 110,
|
||||||
|
)),
|
||||||
|
InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await _walletOptions.changeAvatar();
|
||||||
|
},
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/camera.png',
|
||||||
|
),
|
||||||
|
SizedBox(height: 100)
|
||||||
|
])),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
Row(children: <Widget>[
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
width: 260,
|
||||||
|
child: TextField(
|
||||||
|
key: Key('walletName'),
|
||||||
|
autofocus: false,
|
||||||
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
|
enabled: _walletOptions.isEditing,
|
||||||
|
controller: _walletOptions.nameController,
|
||||||
|
maxLines: _nbrLinesName,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
disabledBorder: InputBorder.none,
|
||||||
|
contentPadding: EdgeInsets.all(15.0),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 27 : 23,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Monospace')),
|
||||||
|
),
|
||||||
|
SizedBox(height: isTall ? 5 : 0),
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getBalance),
|
||||||
|
variables: {
|
||||||
|
'pubkey': _walletOptions.pubkey.text,
|
||||||
|
},
|
||||||
|
// pollInterval: Duration(seconds: 1),
|
||||||
|
),
|
||||||
|
builder: (QueryResult result,
|
||||||
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
|
if (result.hasException) {
|
||||||
|
return Text(result.exception.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.isLoading) {
|
||||||
|
return Text('Loading');
|
||||||
|
}
|
||||||
|
|
||||||
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
|
String wBalanceUD;
|
||||||
|
if (result.data['balance'] == null) {
|
||||||
|
wBalanceUD = '0.0';
|
||||||
|
} else {
|
||||||
|
int wBalanceG1 =
|
||||||
|
result.data['balance']['amount'];
|
||||||
|
int currentUD =
|
||||||
|
result.data['currentUd']['amount'];
|
||||||
|
double wBalanceUDBrut =
|
||||||
|
wBalanceG1 / currentUD; // .toString();
|
||||||
|
wBalanceUD = double.parse(
|
||||||
|
(wBalanceUDBrut).toStringAsFixed(2))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
return Row(children: <Widget>[
|
||||||
|
ImageFiltered(
|
||||||
|
imageFilter: ImageFilter.blur(
|
||||||
|
sigmaX: _walletOptions.isBalanceBlur
|
||||||
|
? 6
|
||||||
|
: 0,
|
||||||
|
sigmaY: _walletOptions.isBalanceBlur
|
||||||
|
? 5
|
||||||
|
: 0),
|
||||||
|
child: Text('$wBalanceUD',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 20 : 18,
|
||||||
|
color: Colors.black)),
|
||||||
|
),
|
||||||
|
Text(' DU',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 20 : 18,
|
||||||
|
color: Colors.black))
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Text(
|
||||||
|
// '$wBalanceUD DU',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 20, color: Colors.black),
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 5),
|
||||||
|
InkWell(
|
||||||
|
key: Key('displayBalance'),
|
||||||
|
onTap: () {
|
||||||
|
_walletOptions.bluringBalance();
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
_walletOptions.isBalanceBlur
|
||||||
|
? 'assets/walletOptions/icon_oeuil.png'
|
||||||
|
: 'assets/walletOptions/icon_oeuil_close.png',
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
SizedBox(width: 0),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
key: Key('renameWallet'),
|
||||||
|
onTap: () async {
|
||||||
|
_isNewNameValid = _walletOptions
|
||||||
|
.editWalletName(_walletOptions.walletID);
|
||||||
|
await Future.delayed(
|
||||||
|
Duration(milliseconds: 30));
|
||||||
|
_walletOptions.walletNameFocus.requestFocus();
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
child: Image.asset(
|
||||||
|
_walletOptions.isEditing
|
||||||
|
? 'assets/walletOptions/android-checkmark.png'
|
||||||
|
: 'assets/walletOptions/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 20),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
])),
|
||||||
|
SizedBox(height: 4 * ratio),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _walletOptions
|
||||||
|
.generateQRcode(_walletOptions.pubkey.text),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return snapshot.data != null
|
||||||
|
? Image.memory(snapshot.data,
|
||||||
|
height: isTall ? 300 : 270)
|
||||||
|
: Text('-', style: TextStyle(fontSize: 20));
|
||||||
|
}),
|
||||||
|
SizedBox(height: 15 * ratio),
|
||||||
|
GestureDetector(
|
||||||
|
key: Key('copyPubkey'),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
|
_walletOptions.snackCopyKey(ctx);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: 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),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
new BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
elevation: 1,
|
||||||
|
primary: orangeC, // background
|
||||||
|
onPrimary: Colors.black, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(
|
||||||
|
text: _walletOptions.pubkey.text));
|
||||||
|
_walletOptions.snackCopyKey(ctx);
|
||||||
|
},
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/copy-white.png',
|
||||||
|
),
|
||||||
|
SizedBox(width: 7),
|
||||||
|
Text('Copier',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: Colors.grey[50]))
|
||||||
|
]))),
|
||||||
|
]))),
|
||||||
|
SizedBox(height: 10 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: Key('displayHistory'),
|
||||||
|
onTap: () {
|
||||||
|
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
||||||
|
goHistory: true);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
SizedBox(width: 30),
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/clock.png',
|
||||||
|
),
|
||||||
|
SizedBox(width: 12),
|
||||||
|
Text('Historique des transactions',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 20, color: Colors.black)),
|
||||||
|
]))),
|
||||||
|
SizedBox(height: 12 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: Key('setDefaultWallet'),
|
||||||
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
|
? () {
|
||||||
|
defaultWallet = cesiumWallet;
|
||||||
|
chestBox.get(currentChest).defaultWallet =
|
||||||
|
cesiumWallet.number;
|
||||||
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
SizedBox(width: 31),
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor: Colors.grey[
|
||||||
|
_walletOptions.isDefaultWallet ? 300 : 500],
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/walletOptions/android-checkmark.png',
|
||||||
|
)),
|
||||||
|
SizedBox(width: 12),
|
||||||
|
Text(
|
||||||
|
_walletOptions.isDefaultWallet
|
||||||
|
? 'Ce portefeuille est celui par defaut'
|
||||||
|
: 'Définir comme portefeuille par défaut',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: _walletOptions.isDefaultWallet
|
||||||
|
? Colors.grey[500]
|
||||||
|
: Colors.black)),
|
||||||
|
]))),
|
||||||
|
SizedBox(height: 17 * ratio),
|
||||||
|
if (!_walletOptions.isDefaultWallet)
|
||||||
|
InkWell(
|
||||||
|
key: Key('deleteWallet'),
|
||||||
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
|
? () async {
|
||||||
|
await _walletOptions.deleteWallet(
|
||||||
|
context, cesiumWallet);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_myWalletProvider.listWallets =
|
||||||
|
_myWalletProvider
|
||||||
|
.readAllWallets(_currentChest);
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
SizedBox(width: 33),
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/trash.png',
|
||||||
|
),
|
||||||
|
SizedBox(width: 14),
|
||||||
|
Text('Supprimer ce portefeuille',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, color: Color(0xffD80000))),
|
||||||
|
])),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -169,15 +169,14 @@ class ImportWalletScreen extends StatelessWidget {
|
||||||
_generateWalletProvider.isPinChanged
|
_generateWalletProvider.isPinChanged
|
||||||
? () {
|
? () {
|
||||||
_generateWalletProvider
|
_generateWalletProvider
|
||||||
.importCesiumWallet(
|
.importCesiumWallet()
|
||||||
context,
|
|
||||||
_generateWalletProvider
|
|
||||||
.cesiumID.text,
|
|
||||||
_generateWalletProvider
|
|
||||||
.cesiumPWD.text)
|
|
||||||
.then((value) {
|
.then((value) {
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
_generateWalletProvider.resetImportView();
|
_generateWalletProvider.resetImportView();
|
||||||
|
Navigator.popUntil(
|
||||||
|
context,
|
||||||
|
ModalRoute.withName('/'),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/chestData.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:gecko/models/queries.dart';
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/walletData.dart';
|
import 'package:gecko/models/walletData.dart';
|
||||||
|
@ -21,11 +22,15 @@ class WalletsHome extends StatelessWidget {
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
final int _currentChest = myWalletProvider.getCurrentChest();
|
final int _currentChestNumber = myWalletProvider.getCurrentChest();
|
||||||
|
final ChestData _currentChest = chestBox.get(_currentChestNumber);
|
||||||
|
bool isWalletsExists;
|
||||||
|
|
||||||
myWalletProvider.listWallets =
|
if (!_currentChest.isCesium) {
|
||||||
myWalletProvider.readAllWallets(_currentChest);
|
myWalletProvider.listWallets =
|
||||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
myWalletProvider.readAllWallets(_currentChestNumber);
|
||||||
|
isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
|
}
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -45,18 +50,27 @@ class WalletsHome extends StatelessWidget {
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
title: Text(chestBox.get(_currentChest).name,
|
title: Text(_currentChest.name,
|
||||||
key: Key('myWallets'), style: TextStyle(color: Colors.grey[850])),
|
key: Key('myWallets'), style: TextStyle(color: Colors.grey[850])),
|
||||||
backgroundColor: Color(0xffFFD58D),
|
backgroundColor: Color(0xffFFD58D),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child:
|
child: !isWalletsExists
|
||||||
!isWalletsExists ? NoKeyChainScreen() : myWalletsTiles(context),
|
? NoKeyChainScreen()
|
||||||
|
: _currentChest.isCesium
|
||||||
|
? cesiumWalletOptions(context)
|
||||||
|
: myWalletsTiles(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget cesiumWalletOptions(BuildContext context) {
|
||||||
|
return Column(children: [
|
||||||
|
Center(child: Text('This is a Cesium wallet')),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
Widget chestOptions(BuildContext context) {
|
Widget chestOptions(BuildContext context) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
|
|
Loading…
Reference in New Issue