forked from axiom-team/gecko
Implemente cesium wallet view
This commit is contained in:
parent
4f316c40f5
commit
106fcf2835
|
@ -22,6 +22,7 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/cesium_plus.dart';
|
import 'package:gecko/models/cesium_plus.dart';
|
||||||
import 'package:gecko/models/change_pin.dart';
|
import 'package:gecko/models/change_pin.dart';
|
||||||
import 'package:gecko/models/chest_data.dart';
|
import 'package:gecko/models/chest_data.dart';
|
||||||
|
import 'package:gecko/models/chest_provider.dart';
|
||||||
import 'package:gecko/models/generate_wallets.dart';
|
import 'package:gecko/models/generate_wallets.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
|
@ -136,6 +137,7 @@ class Gecko extends StatelessWidget {
|
||||||
ChangeNotifierProvider(create: (_) => HomeProvider()),
|
ChangeNotifierProvider(create: (_) => HomeProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => HistoryProvider('')),
|
ChangeNotifierProvider(create: (_) => HistoryProvider('')),
|
||||||
ChangeNotifierProvider(create: (_) => MyWalletsProvider()),
|
ChangeNotifierProvider(create: (_) => MyWalletsProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => ChestProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => GenerateWalletsProvider()),
|
ChangeNotifierProvider(create: (_) => GenerateWalletsProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => WalletOptionsProvider()),
|
ChangeNotifierProvider(create: (_) => WalletOptionsProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => ChangePinProvider()),
|
ChangeNotifierProvider(create: (_) => ChangePinProvider()),
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
part 'chest_data.g.dart';
|
part 'chest_data.g.dart';
|
||||||
|
@ -17,6 +19,9 @@ class ChestData extends HiveObject {
|
||||||
String imageName;
|
String imageName;
|
||||||
|
|
||||||
@HiveField(5)
|
@HiveField(5)
|
||||||
|
File imageFile;
|
||||||
|
|
||||||
|
@HiveField(6)
|
||||||
bool isCesium;
|
bool isCesium;
|
||||||
|
|
||||||
ChestData({
|
ChestData({
|
||||||
|
@ -24,6 +29,7 @@ class ChestData extends HiveObject {
|
||||||
this.name,
|
this.name,
|
||||||
this.defaultWallet,
|
this.defaultWallet,
|
||||||
this.imageName,
|
this.imageName,
|
||||||
|
this.imageFile,
|
||||||
this.isCesium,
|
this.isCesium,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,15 @@ 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,
|
imageFile: fields[5] as File,
|
||||||
|
isCesium: fields[6] as bool,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, ChestData obj) {
|
void write(BinaryWriter writer, ChestData obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(5)
|
..writeByte(6)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.dewif)
|
..write(obj.dewif)
|
||||||
..writeByte(2)
|
..writeByte(2)
|
||||||
|
@ -38,6 +39,8 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
|
||||||
..writeByte(4)
|
..writeByte(4)
|
||||||
..write(obj.imageName)
|
..write(obj.imageName)
|
||||||
..writeByte(5)
|
..writeByte(5)
|
||||||
|
..write(obj.imageFile)
|
||||||
|
..writeByte(6)
|
||||||
..write(obj.isCesium);
|
..write(obj.isCesium);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/chest_data.dart';
|
||||||
|
|
||||||
|
class ChestProvider with ChangeNotifier {
|
||||||
|
void rebuildWidget() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future deleteChest(context, ChestData _chest) async {
|
||||||
|
final bool _answer = await _confirmDeletingChest(context, _chest.name);
|
||||||
|
|
||||||
|
if (_answer) {
|
||||||
|
chestBox.delete(_chest.key);
|
||||||
|
int lastChest = chestBox.toMap().keys.first;
|
||||||
|
configBox.put('currentChest', lastChest);
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
Navigator.popUntil(
|
||||||
|
context,
|
||||||
|
ModalRoute.withName('/'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> _confirmDeletingChest(context, String _walletName) 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 coffre "$_walletName" ?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text("Non", key: Key('cancelDeleting')),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: const Text("Oui", key: Key('confirmDeleting')),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,15 +39,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
bool canImport = false;
|
bool canImport = false;
|
||||||
bool isPinChanged = false;
|
bool isPinChanged = false;
|
||||||
|
|
||||||
void storeHDWChest(
|
Future storeHDWChest(
|
||||||
NewWallet _wallet, String _name, BuildContext context) async {
|
NewWallet _wallet, String _name, BuildContext context) async {
|
||||||
int chestNumber = chestBox.length;
|
int chestNumber = 0;
|
||||||
WalletData myWallet = WalletData(
|
chestBox.toMap().forEach((key, value) {
|
||||||
chest: chestNumber,
|
if (!value.isCesium) {
|
||||||
number: 0,
|
chestNumber++;
|
||||||
name: _name,
|
}
|
||||||
derivation: 3,
|
});
|
||||||
imageName: '0.png');
|
|
||||||
|
|
||||||
String chestName;
|
String chestName;
|
||||||
if (chestNumber == 0) {
|
if (chestNumber == 0) {
|
||||||
|
@ -55,7 +54,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
} else {
|
} else {
|
||||||
chestName = 'Coffre à Ğecko ${chestNumber + 1}';
|
chestName = 'Coffre à Ğecko ${chestNumber + 1}';
|
||||||
}
|
}
|
||||||
walletBox.add(myWallet);
|
|
||||||
ChestData thisChest = ChestData(
|
ChestData thisChest = ChestData(
|
||||||
dewif: _wallet.dewif,
|
dewif: _wallet.dewif,
|
||||||
name: chestName,
|
name: chestName,
|
||||||
|
@ -63,8 +61,19 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
imageName: '${chestNumber % 8}.png',
|
imageName: '${chestNumber % 8}.png',
|
||||||
isCesium: false,
|
isCesium: false,
|
||||||
);
|
);
|
||||||
chestBox.add(thisChest);
|
await chestBox.add(thisChest);
|
||||||
configBox.put('currentChest', chestNumber);
|
int chestKey = chestBox.keys.last;
|
||||||
|
|
||||||
|
WalletData myWallet = WalletData(
|
||||||
|
chest: chestKey,
|
||||||
|
number: 0,
|
||||||
|
name: _name,
|
||||||
|
derivation: 3,
|
||||||
|
imageName: '0.png');
|
||||||
|
await walletBox.add(myWallet);
|
||||||
|
|
||||||
|
await configBox.put('currentChest', chestKey);
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAskedWord(String inputWord, String _mnemo) {
|
void checkAskedWord(String inputWord, String _mnemo) {
|
||||||
|
@ -240,16 +249,31 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
isCesiumIDVisible = false;
|
isCesiumIDVisible = false;
|
||||||
isCesiumPWDVisible = false;
|
isCesiumPWDVisible = false;
|
||||||
|
|
||||||
|
int chestNumber = 0;
|
||||||
|
chestBox.toMap().forEach((key, value) {
|
||||||
|
if (value.isCesium) {
|
||||||
|
chestNumber++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
String chestName;
|
||||||
|
if (chestNumber == 0) {
|
||||||
|
chestName = 'Coffre à Césium';
|
||||||
|
} else {
|
||||||
|
chestName = 'Coffre à Césium ${chestNumber + 1}';
|
||||||
|
}
|
||||||
|
|
||||||
ChestData cesiumChest = ChestData(
|
ChestData cesiumChest = ChestData(
|
||||||
dewif: actualWallet.dewif,
|
dewif: actualWallet.dewif,
|
||||||
name: 'Coffre à Cesium',
|
name: chestName,
|
||||||
imageName: 'cesium.png',
|
imageName: 'cesium.png',
|
||||||
defaultWallet: 0,
|
defaultWallet: 0,
|
||||||
isCesium: true);
|
isCesium: true);
|
||||||
|
|
||||||
int chestNumber = chestBox.length;
|
await chestBox.add(cesiumChest).then((value) => null);
|
||||||
chestBox.add(cesiumChest);
|
int chestKey = await chestBox.toMap().keys.last;
|
||||||
configBox.put('currentChest', chestNumber);
|
// chestBox.toMap().
|
||||||
|
await configBox.put('currentChest', chestKey);
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
part 'wallet_data.g.dart';
|
part 'wallet_data.g.dart';
|
||||||
|
@ -19,8 +21,16 @@ class WalletData extends HiveObject {
|
||||||
@HiveField(4)
|
@HiveField(4)
|
||||||
String imageName;
|
String imageName;
|
||||||
|
|
||||||
|
@HiveField(5)
|
||||||
|
File imageFile;
|
||||||
|
|
||||||
WalletData(
|
WalletData(
|
||||||
{this.chest, this.number, this.name, this.derivation, this.imageName});
|
{this.chest,
|
||||||
|
this.number,
|
||||||
|
this.name,
|
||||||
|
this.derivation,
|
||||||
|
this.imageName,
|
||||||
|
this.imageFile});
|
||||||
|
|
||||||
// representation of WalletData when debugging
|
// representation of WalletData when debugging
|
||||||
@override
|
@override
|
||||||
|
@ -34,7 +44,7 @@ class WalletData extends HiveObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns only the id part of the ':'-separated string
|
// returns only the id part of the ':'-separated string
|
||||||
List id() {
|
List<int> id() {
|
||||||
return [chest, number];
|
return [chest, number];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,14 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
|
||||||
name: fields[2] as String,
|
name: fields[2] as String,
|
||||||
derivation: fields[3] as int,
|
derivation: fields[3] as int,
|
||||||
imageName: fields[4] as String,
|
imageName: fields[4] as String,
|
||||||
|
imageFile: fields[5] as File,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, WalletData obj) {
|
void write(BinaryWriter writer, WalletData obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(5)
|
..writeByte(6)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.chest)
|
..write(obj.chest)
|
||||||
..writeByte(1)
|
..writeByte(1)
|
||||||
|
@ -38,7 +39,9 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
|
||||||
..writeByte(3)
|
..writeByte(3)
|
||||||
..write(obj.derivation)
|
..write(obj.derivation)
|
||||||
..writeByte(4)
|
..writeByte(4)
|
||||||
..write(obj.imageName);
|
..write(obj.imageName)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.imageFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/chest_data.dart';
|
||||||
import 'package:gecko/models/my_wallets.dart';
|
import 'package:gecko/models/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
@ -24,7 +25,6 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
bool isBalanceBlur = true;
|
bool isBalanceBlur = true;
|
||||||
FocusNode walletNameFocus = FocusNode();
|
FocusNode walletNameFocus = FocusNode();
|
||||||
TextEditingController nameController = TextEditingController();
|
TextEditingController nameController = TextEditingController();
|
||||||
List<int> walletID;
|
|
||||||
bool isDefaultWallet;
|
bool isDefaultWallet;
|
||||||
|
|
||||||
Future<NewWallet> get badWallet => null;
|
Future<NewWallet> get badWallet => null;
|
||||||
|
@ -125,63 +125,28 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return _pinLenght;
|
return _pinLenght;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _renameWallet(List<int> _walletID, _newName) async {
|
void _renameWallet(List<int> _walletID, _newName, {bool isCesium}) async {
|
||||||
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
if (isCesium) {
|
||||||
|
ChestData _chestTarget = chestBox.get(_walletID[0]);
|
||||||
|
_chestTarget.name = _newName;
|
||||||
|
await chestBox.put(_chestTarget.key, _chestTarget);
|
||||||
|
} else {
|
||||||
|
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
||||||
|
|
||||||
WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
|
WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
|
||||||
_walletTarget.name = _newName;
|
_walletTarget.name = _newName;
|
||||||
await walletBox.put(_walletTarget.key, _walletTarget);
|
await walletBox.put(_walletTarget.key, _walletTarget);
|
||||||
|
}
|
||||||
|
|
||||||
_newWalletName.text = '';
|
_newWalletName.text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> renameWalletAlerte(
|
bool editWalletName(List<int> _wID, {bool isCesium}) {
|
||||||
context, _walletName, _walletNbr, _derivation) async {
|
|
||||||
return showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: true,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('Choisissez un nouveau nom pour ce portefeuille'),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: ListBody(
|
|
||||||
children: <Widget>[
|
|
||||||
TextField(
|
|
||||||
controller: _newWalletName,
|
|
||||||
maxLines: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: const InputDecoration(),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: const Text("Valider"),
|
|
||||||
onPressed: () {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
// await _renameWallet(_walletName, this._newWalletName.text,
|
|
||||||
// _walletNbr, _derivation);
|
|
||||||
});
|
|
||||||
// notifyListeners();
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool editWalletName(List<int> _wID) {
|
|
||||||
bool nameState;
|
bool nameState;
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
if (!nameController.text.contains(':') &&
|
if (!nameController.text.contains(':') &&
|
||||||
nameController.text.length <= 39) {
|
nameController.text.length <= 39) {
|
||||||
_renameWallet(_wID, nameController.text);
|
_renameWallet(_wID, nameController.text, isCesium: isCesium);
|
||||||
nameState = true;
|
nameState = true;
|
||||||
} else {
|
} else {
|
||||||
nameState = false;
|
nameState = false;
|
||||||
|
@ -281,10 +246,11 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
File _image;
|
File _image;
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
|
|
||||||
final pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
XFile pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
||||||
|
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
_image = File(pickedFile.path);
|
_image = File(pickedFile.path);
|
||||||
|
log.i(pickedFile.path);
|
||||||
return _image;
|
return _image;
|
||||||
} else {
|
} else {
|
||||||
log.w('No image selected.');
|
log.w('No image selected.');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/chest_provider.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -23,10 +24,9 @@ class HomeScreen extends StatelessWidget {
|
||||||
HistoryProvider _historyStatic = HistoryProvider('');
|
HistoryProvider _historyStatic = HistoryProvider('');
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
Provider.of<ChestProvider>(context);
|
||||||
|
|
||||||
WalletData defaultWallet =
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
|
||||||
|
|
||||||
// walletBox.toMap().forEach((key, value) {
|
// walletBox.toMap().forEach((key, value) {
|
||||||
// if (value.chest == 0) {
|
// if (value.chest == 0) {
|
||||||
|
@ -281,6 +281,9 @@ class HomeScreen extends StatelessWidget {
|
||||||
image: AssetImage('assets/lock.png'),
|
image: AssetImage('assets/lock.png'),
|
||||||
height: 57)),
|
height: 57)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
WalletData defaultWallet =
|
||||||
|
_myWalletProvider.getDefaultWallet(
|
||||||
|
configBox.get('currentChest'));
|
||||||
isWalletsExists
|
isWalletsExists
|
||||||
? Navigator.push(context,
|
? Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
|
|
@ -1,399 +1,310 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/chest_data.dart';
|
||||||
|
import 'package:gecko/models/chest_provider.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/my_wallets.dart';
|
|
||||||
import 'package:gecko/models/queries.dart';
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
|
||||||
import 'package:gecko/models/wallet_options.dart';
|
import 'package:gecko/models/wallet_options.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
int _nbrLinesName = 1;
|
||||||
class CesiumWalletOptions extends StatelessWidget {
|
bool _isNewNameValid = false;
|
||||||
CesiumWalletOptions({Key keyMyWallets, @required this.cesiumWallet})
|
|
||||||
: super(key: keyMyWallets);
|
|
||||||
WalletData cesiumWallet;
|
|
||||||
int _nbrLinesName = 1;
|
|
||||||
bool _isNewNameValid = false;
|
|
||||||
|
|
||||||
@override
|
Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet) {
|
||||||
Widget build(BuildContext context) {
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
WalletOptionsProvider _walletOptions =
|
||||||
WalletOptionsProvider _walletOptions =
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
ChestProvider _chestProvider = Provider.of<ChestProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
Provider.of<MyWalletsProvider>(context);
|
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
final String shortPubkey =
|
||||||
final String shortPubkey =
|
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
||||||
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
|
||||||
|
|
||||||
if (_walletOptions.nameController.text == null ||
|
if (_walletOptions.nameController.text == null || _isNewNameValid == false) {
|
||||||
_isNewNameValid == false) {
|
_walletOptions.nameController.text = cesiumWallet.name;
|
||||||
_walletOptions.nameController.text = cesiumWallet.name;
|
} else {
|
||||||
} else {
|
cesiumWallet.name = _walletOptions.nameController.text;
|
||||||
cesiumWallet.name = _walletOptions.nameController.text;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_walletOptions.nameController.text.length >= 15
|
_walletOptions.nameController.text.length >= 15
|
||||||
? _nbrLinesName = 2
|
? _nbrLinesName = 2
|
||||||
: _nbrLinesName = 1;
|
: _nbrLinesName = 1;
|
||||||
if (_walletOptions.nameController.text.length >= 26 && isTall) {
|
if (_walletOptions.nameController.text.length >= 26 && isTall) {
|
||||||
_nbrLinesName = 3;
|
_nbrLinesName = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
_walletOptions.walletID = [0, cesiumWallet.number];
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
WalletData defaultWallet =
|
body: Builder(
|
||||||
_myWalletProvider.getDefaultWallet(_currentChest);
|
builder: (ctx) => SafeArea(
|
||||||
|
child: Column(children: <Widget>[
|
||||||
_walletOptions.isDefaultWallet =
|
Container(
|
||||||
(defaultWallet.number == _walletOptions.walletID[1]);
|
height: isTall ? 30 : 15,
|
||||||
|
color: yellowC,
|
||||||
int currentChest = _myWalletProvider.getCurrentChest();
|
),
|
||||||
|
Container(
|
||||||
log.d("Wallet options: $currentChest:${cesiumWallet.number}");
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
return WillPopScope(
|
begin: Alignment.topCenter,
|
||||||
onWillPop: () {
|
end: Alignment.bottomCenter,
|
||||||
_walletOptions.isEditing = false;
|
colors: [
|
||||||
_walletOptions.isBalanceBlur = true;
|
yellowC,
|
||||||
Navigator.popUntil(
|
const Color(0xfffafafa),
|
||||||
context,
|
],
|
||||||
ModalRoute.withName('/mywallets'),
|
|
||||||
);
|
|
||||||
return Future<bool>.value(true);
|
|
||||||
},
|
|
||||||
child: Scaffold(
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
appBar: AppBar(
|
|
||||||
toolbarHeight: 60 * ratio,
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const 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(
|
child: Row(children: <Widget>[
|
||||||
builder: (ctx) => SafeArea(
|
const SizedBox(width: 25),
|
||||||
child: Column(children: <Widget>[
|
InkWell(
|
||||||
Container(
|
onTap: () async {
|
||||||
height: isTall ? 15 : 0,
|
File newAvatar = await _walletOptions.changeAvatar();
|
||||||
color: yellowC,
|
if (newAvatar != null) {
|
||||||
|
cesiumWallet.imageFile = newAvatar;
|
||||||
|
}
|
||||||
|
_walletOptions.reloadBuild();
|
||||||
|
},
|
||||||
|
child: cesiumWallet.imageFile == null
|
||||||
|
? Image.asset(
|
||||||
|
'assets/chests/${cesiumWallet.imageName}',
|
||||||
|
width: 110,
|
||||||
|
)
|
||||||
|
: Image.file(cesiumWallet.imageFile, width: 110),
|
||||||
),
|
),
|
||||||
Container(
|
InkWell(
|
||||||
decoration: BoxDecoration(
|
onTap: () async {
|
||||||
gradient: LinearGradient(
|
File newAvatar = await _walletOptions.changeAvatar();
|
||||||
begin: Alignment.topCenter,
|
if (newAvatar != null) {
|
||||||
end: Alignment.bottomCenter,
|
cesiumWallet.imageFile = newAvatar;
|
||||||
colors: [
|
}
|
||||||
yellowC,
|
_walletOptions.reloadBuild();
|
||||||
const Color(0xfffafafa),
|
},
|
||||||
],
|
child: Column(children: <Widget>[
|
||||||
)),
|
Image.asset(
|
||||||
child: Row(children: <Widget>[
|
'assets/walletOptions/camera.png',
|
||||||
const SizedBox(width: 25),
|
),
|
||||||
|
const SizedBox(height: 100)
|
||||||
|
])),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
Row(children: <Widget>[
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
width: 260,
|
||||||
|
child: TextField(
|
||||||
|
key: const Key('walletName'),
|
||||||
|
autofocus: false,
|
||||||
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
|
enabled: _walletOptions.isEditing,
|
||||||
|
controller: _walletOptions.nameController,
|
||||||
|
maxLines: _nbrLinesName,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: const 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 const 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),
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
key: const Key('displayBalance'),
|
||||||
await _walletOptions.changeAvatar();
|
onTap: () {
|
||||||
|
_walletOptions.bluringBalance();
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/avatars/${cesiumWallet.imageName}',
|
_walletOptions.isBalanceBlur
|
||||||
width: 110,
|
? 'assets/walletOptions/icon_oeuil.png'
|
||||||
|
: 'assets/walletOptions/icon_oeuil_close.png',
|
||||||
)),
|
)),
|
||||||
|
]),
|
||||||
|
const SizedBox(width: 0),
|
||||||
|
Column(children: <Widget>[
|
||||||
InkWell(
|
InkWell(
|
||||||
|
key: const Key('renameWallet'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.changeAvatar();
|
_isNewNameValid = _walletOptions.editWalletName(
|
||||||
|
[cesiumWallet.key, 0],
|
||||||
|
isCesium: cesiumWallet.isCesium);
|
||||||
|
await Future.delayed(
|
||||||
|
const Duration(milliseconds: 30));
|
||||||
|
_walletOptions.walletNameFocus.requestFocus();
|
||||||
},
|
},
|
||||||
child: Column(children: <Widget>[
|
child: ClipRRect(
|
||||||
Image.asset(
|
child: Image.asset(
|
||||||
'assets/walletOptions/camera.png',
|
_walletOptions.isEditing
|
||||||
),
|
? 'assets/walletOptions/android-checkmark.png'
|
||||||
const SizedBox(height: 100)
|
: 'assets/walletOptions/edit.png',
|
||||||
])),
|
width: 20,
|
||||||
Column(children: <Widget>[
|
height: 20),
|
||||||
Row(children: <Widget>[
|
)),
|
||||||
Column(children: <Widget>[
|
const SizedBox(
|
||||||
SizedBox(
|
height: 60,
|
||||||
width: 260,
|
)
|
||||||
child: TextField(
|
])
|
||||||
key: const Key('walletName'),
|
]),
|
||||||
autofocus: false,
|
]),
|
||||||
focusNode: _walletOptions.walletNameFocus,
|
])),
|
||||||
enabled: _walletOptions.isEditing,
|
SizedBox(height: 4 * ratio),
|
||||||
controller: _walletOptions.nameController,
|
FutureBuilder(
|
||||||
maxLines: _nbrLinesName,
|
future: _walletOptions.generateQRcode(_walletOptions.pubkey.text),
|
||||||
textAlign: TextAlign.center,
|
builder: (context, snapshot) {
|
||||||
decoration: const InputDecoration(
|
return snapshot.data != null
|
||||||
border: InputBorder.none,
|
? Image.memory(snapshot.data, height: isTall ? 300 : 270)
|
||||||
focusedBorder: InputBorder.none,
|
: const Text('-', style: TextStyle(fontSize: 20));
|
||||||
enabledBorder: InputBorder.none,
|
}),
|
||||||
disabledBorder: InputBorder.none,
|
SizedBox(height: 15 * ratio),
|
||||||
contentPadding: EdgeInsets.all(15.0),
|
GestureDetector(
|
||||||
),
|
key: const Key('copyPubkey'),
|
||||||
style: TextStyle(
|
onTap: () {
|
||||||
fontSize: isTall ? 27 : 23,
|
Clipboard.setData(
|
||||||
color: Colors.black,
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
fontWeight: FontWeight.w400,
|
_walletOptions.snackCopyKey(ctx);
|
||||||
fontFamily: 'Monospace')),
|
},
|
||||||
),
|
child: SizedBox(
|
||||||
SizedBox(height: isTall ? 5 : 0),
|
height: 50,
|
||||||
Query(
|
child: Row(children: <Widget>[
|
||||||
options: QueryOptions(
|
const SizedBox(width: 30),
|
||||||
document: gql(getBalance),
|
Image.asset(
|
||||||
variables: {
|
'assets/walletOptions/key.png',
|
||||||
'pubkey': _walletOptions.pubkey.text,
|
),
|
||||||
},
|
const SizedBox(width: 10),
|
||||||
// pollInterval: Duration(seconds: 1),
|
Text("${shortPubkey.split(':')[0]}:",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
fontFamily: 'Monospace',
|
||||||
|
color: Colors.black)),
|
||||||
|
Text(shortPubkey.split(':')[1],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
fontFamily: 'Monospace')),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
elevation: 1,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
primary: orangeC, // background
|
||||||
if (result.hasException) {
|
onPrimary: Colors.black, // foreground
|
||||||
return Text(result.exception.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.isLoading) {
|
|
||||||
return const 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),
|
|
||||||
// );
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
onPressed: () {
|
||||||
InkWell(
|
Clipboard.setData(ClipboardData(
|
||||||
key: const Key('displayBalance'),
|
text: _walletOptions.pubkey.text));
|
||||||
onTap: () {
|
_walletOptions.snackCopyKey(ctx);
|
||||||
_walletOptions.bluringBalance();
|
},
|
||||||
},
|
child: Row(children: <Widget>[
|
||||||
child: Image.asset(
|
Image.asset(
|
||||||
_walletOptions.isBalanceBlur
|
'assets/walletOptions/copy-white.png',
|
||||||
? 'assets/walletOptions/icon_oeuil.png'
|
),
|
||||||
: 'assets/walletOptions/icon_oeuil_close.png',
|
const SizedBox(width: 7),
|
||||||
)),
|
Text('Copier',
|
||||||
]),
|
style: TextStyle(
|
||||||
const SizedBox(width: 0),
|
fontSize: 15, color: Colors.grey[50]))
|
||||||
Column(children: <Widget>[
|
]))),
|
||||||
InkWell(
|
]))),
|
||||||
key: const Key('renameWallet'),
|
SizedBox(height: 10 * ratio),
|
||||||
onTap: () async {
|
InkWell(
|
||||||
_isNewNameValid = _walletOptions
|
key: const Key('displayHistory'),
|
||||||
.editWalletName(_walletOptions.walletID);
|
onTap: () {
|
||||||
await Future.delayed(
|
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
||||||
const Duration(milliseconds: 30));
|
goHistory: true);
|
||||||
_walletOptions.walletNameFocus.requestFocus();
|
},
|
||||||
},
|
child: SizedBox(
|
||||||
child: ClipRRect(
|
height: 50,
|
||||||
child: Image.asset(
|
child: Row(children: <Widget>[
|
||||||
_walletOptions.isEditing
|
const SizedBox(width: 30),
|
||||||
? 'assets/walletOptions/android-checkmark.png'
|
Image.asset(
|
||||||
: 'assets/walletOptions/edit.png',
|
'assets/walletOptions/clock.png',
|
||||||
width: 20,
|
),
|
||||||
height: 20),
|
const SizedBox(width: 12),
|
||||||
)),
|
const Text('Historique des transactions',
|
||||||
const SizedBox(
|
style: TextStyle(fontSize: 20, color: Colors.black)),
|
||||||
height: 60,
|
]))),
|
||||||
)
|
SizedBox(height: 12 * ratio),
|
||||||
])
|
InkWell(
|
||||||
]),
|
key: const Key('deleteWallet'),
|
||||||
]),
|
onTap: () async {
|
||||||
])),
|
await _chestProvider.deleteChest(context, cesiumWallet);
|
||||||
SizedBox(height: 4 * ratio),
|
},
|
||||||
FutureBuilder(
|
child: Row(children: <Widget>[
|
||||||
future: _walletOptions
|
const SizedBox(width: 33),
|
||||||
.generateQRcode(_walletOptions.pubkey.text),
|
Image.asset(
|
||||||
builder: (context, snapshot) {
|
'assets/walletOptions/trash.png',
|
||||||
return snapshot.data != null
|
),
|
||||||
? Image.memory(snapshot.data,
|
const SizedBox(width: 14),
|
||||||
height: isTall ? 300 : 270)
|
const Text('Supprimer ce coffre',
|
||||||
: const Text('-', style: TextStyle(fontSize: 20));
|
style: TextStyle(fontSize: 20, color: Color(0xffD80000))),
|
||||||
}),
|
])),
|
||||||
SizedBox(height: 15 * ratio),
|
]),
|
||||||
GestureDetector(
|
),
|
||||||
key: const Key('copyPubkey'),
|
),
|
||||||
onTap: () {
|
);
|
||||||
Clipboard.setData(
|
|
||||||
ClipboardData(text: _walletOptions.pubkey.text));
|
|
||||||
_walletOptions.snackCopyKey(ctx);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
const SizedBox(width: 30),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/key.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text("${shortPubkey.split(':')[0]}:",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontFamily: 'Monospace',
|
|
||||||
color: Colors.black)),
|
|
||||||
Text(shortPubkey.split(':')[1],
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontFamily: 'Monospace')),
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
SizedBox(
|
|
||||||
height: 40,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: 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',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 7),
|
|
||||||
Text('Copier',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
color: Colors.grey[50]))
|
|
||||||
]))),
|
|
||||||
]))),
|
|
||||||
SizedBox(height: 10 * ratio),
|
|
||||||
InkWell(
|
|
||||||
key: const Key('displayHistory'),
|
|
||||||
onTap: () {
|
|
||||||
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
|
||||||
goHistory: true);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
const SizedBox(width: 30),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/clock.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
const Text('Historique des transactions',
|
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 20, color: Colors.black)),
|
|
||||||
]))),
|
|
||||||
SizedBox(height: 12 * ratio),
|
|
||||||
InkWell(
|
|
||||||
key: const 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>[
|
|
||||||
const SizedBox(width: 31),
|
|
||||||
CircleAvatar(
|
|
||||||
backgroundColor: Colors.grey[
|
|
||||||
_walletOptions.isDefaultWallet ? 300 : 500],
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/walletOptions/android-checkmark.png',
|
|
||||||
)),
|
|
||||||
const 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: const 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>[
|
|
||||||
const SizedBox(width: 33),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/trash.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14),
|
|
||||||
const Text('Supprimer ce portefeuille',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20, color: Color(0xffD80000))),
|
|
||||||
])),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
options: CarouselOptions(
|
options: CarouselOptions(
|
||||||
height: 210,
|
height: 210,
|
||||||
onPageChanged: (index, reason) {
|
onPageChanged: (index, reason) {
|
||||||
currentChest = index;
|
currentChest = chestBox.toMap().keys.toList()[index];
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
enableInfiniteScroll: false,
|
enableInfiniteScroll: false,
|
||||||
|
@ -57,10 +57,15 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
return Builder(
|
return Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Image.asset(
|
i.value.imageFile == null
|
||||||
'assets/chests/${i.value.imageName}',
|
? Image.asset(
|
||||||
height: 150,
|
'assets/chests/${i.value.imageName}',
|
||||||
),
|
height: 150,
|
||||||
|
)
|
||||||
|
: Image.file(
|
||||||
|
i.value.imageFile,
|
||||||
|
height: 150,
|
||||||
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Text(
|
Text(
|
||||||
i.value.name,
|
i.value.name,
|
||||||
|
@ -71,28 +76,30 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
Row(
|
if (chestBox.values.toList().length > 1)
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Row(
|
||||||
children: chestBox.toMap().entries.map((entry) {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
return GestureDetector(
|
children: chestBox.toMap().entries.map((entry) {
|
||||||
onTap: () =>
|
return GestureDetector(
|
||||||
buttonCarouselController.animateToPage(entry.key),
|
onTap: () =>
|
||||||
child: Container(
|
buttonCarouselController.animateToPage(entry.key),
|
||||||
width: 12.0,
|
child: Container(
|
||||||
height: 12.0,
|
width: 12.0,
|
||||||
margin: const EdgeInsets.symmetric(
|
height: 12.0,
|
||||||
vertical: 8.0, horizontal: 4.0),
|
margin: const EdgeInsets.symmetric(
|
||||||
decoration: BoxDecoration(
|
vertical: 8.0, horizontal: 4.0),
|
||||||
shape: BoxShape.circle,
|
decoration: BoxDecoration(
|
||||||
color: (Theme.of(context).brightness == Brightness.dark
|
shape: BoxShape.circle,
|
||||||
? Colors.white
|
color:
|
||||||
: Colors.black)
|
(Theme.of(context).brightness == Brightness.dark
|
||||||
.withOpacity(
|
? Colors.white
|
||||||
currentChest == entry.key ? 0.9 : 0.4)),
|
: Colors.black)
|
||||||
),
|
.withOpacity(
|
||||||
);
|
currentChest == entry.key ? 0.9 : 0.4)),
|
||||||
}).toList(),
|
),
|
||||||
),
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
SizedBox(height: 80 * ratio),
|
SizedBox(height: 80 * ratio),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
|
|
|
@ -23,7 +23,6 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType> errorController;
|
StreamController<ErrorAnimationType> errorController;
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
bool hasError = false;
|
|
||||||
var pinColor = const Color(0xffF9F9F1);
|
var pinColor = const Color(0xffF9F9F1);
|
||||||
var walletPin = '';
|
var walletPin = '';
|
||||||
String resultPay;
|
String resultPay;
|
||||||
|
@ -56,10 +55,15 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: isTall ? 80 : 20),
|
SizedBox(height: isTall ? 80 : 20),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
Image.asset(
|
currentChest.imageFile == null
|
||||||
'assets/chests/${currentChest.imageName}',
|
? Image.asset(
|
||||||
height: isTall ? 130 : 100,
|
'assets/chests/${currentChest.imageName}',
|
||||||
),
|
width: isTall ? 130 : 100,
|
||||||
|
)
|
||||||
|
: Image.file(
|
||||||
|
currentChest.imageFile,
|
||||||
|
width: isTall ? 130 : 100,
|
||||||
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 250,
|
width: 250,
|
||||||
|
@ -123,11 +127,14 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
|
||||||
|
FocusNode pinFocus = FocusNode();
|
||||||
|
|
||||||
return Form(
|
return Form(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
|
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
|
||||||
child: PinCodeTextField(
|
child: PinCodeTextField(
|
||||||
|
focusNode: pinFocus,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
appContext: context,
|
appContext: context,
|
||||||
pastedTextStyle: TextStyle(
|
pastedTextStyle: TextStyle(
|
||||||
|
@ -152,7 +159,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
fieldHeight: 50 * ratio,
|
fieldHeight: 50 * ratio,
|
||||||
fieldWidth: 50,
|
fieldWidth: 50,
|
||||||
activeFillColor: hasError ? Colors.blueAccent : Colors.black,
|
activeFillColor: Colors.black,
|
||||||
),
|
),
|
||||||
cursorColor: Colors.black,
|
cursorColor: Colors.black,
|
||||||
animationDuration: const Duration(milliseconds: 300),
|
animationDuration: const Duration(milliseconds: 300),
|
||||||
|
@ -180,9 +187,9 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
if (resultWallet == 'bad') {
|
if (resultWallet == 'bad') {
|
||||||
errorController.add(ErrorAnimationType
|
errorController.add(ErrorAnimationType
|
||||||
.shake); // Triggering error shake animation
|
.shake); // Triggering error shake animation
|
||||||
hasError = true;
|
|
||||||
pinColor = Colors.red[600];
|
pinColor = Colors.red[600];
|
||||||
_walletOptions.reloadBuild();
|
_walletOptions.reloadBuild();
|
||||||
|
pinFocus.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
// await Future.delayed(Duration(milliseconds: 50));
|
// await Future.delayed(Duration(milliseconds: 50));
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -46,13 +47,10 @@ class WalletOptions extends StatelessWidget {
|
||||||
_nbrLinesName = 3;
|
_nbrLinesName = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
_walletOptions.walletID = [0, wallet.number];
|
|
||||||
|
|
||||||
WalletData defaultWallet =
|
WalletData defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(_currentChest);
|
_myWalletProvider.getDefaultWallet(_currentChest);
|
||||||
|
|
||||||
_walletOptions.isDefaultWallet =
|
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
||||||
(defaultWallet.number == _walletOptions.walletID[1]);
|
|
||||||
|
|
||||||
int currentChest = _myWalletProvider.getCurrentChest();
|
int currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
@ -107,15 +105,30 @@ class WalletOptions extends StatelessWidget {
|
||||||
const SizedBox(width: 25),
|
const SizedBox(width: 25),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.changeAvatar();
|
File newAvatar =
|
||||||
|
await _walletOptions.changeAvatar();
|
||||||
|
if (newAvatar != null) {
|
||||||
|
wallet.imageFile = newAvatar;
|
||||||
|
}
|
||||||
|
_walletOptions.reloadBuild();
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: wallet.imageFile == null
|
||||||
'assets/avatars/${wallet.imageName}',
|
? Image.asset(
|
||||||
width: 110,
|
'assets/avatars/${wallet.imageName}',
|
||||||
)),
|
width: 110,
|
||||||
|
)
|
||||||
|
: Image.file(
|
||||||
|
wallet.imageFile,
|
||||||
|
width: 110,
|
||||||
|
)),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.changeAvatar();
|
File newAvatar =
|
||||||
|
await _walletOptions.changeAvatar();
|
||||||
|
if (newAvatar != null) {
|
||||||
|
wallet.imageFile = newAvatar;
|
||||||
|
}
|
||||||
|
_walletOptions.reloadBuild();
|
||||||
},
|
},
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
|
@ -227,8 +240,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
key: const Key('renameWallet'),
|
key: const Key('renameWallet'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
_isNewNameValid = _walletOptions
|
_isNewNameValid =
|
||||||
.editWalletName(_walletOptions.walletID);
|
_walletOptions.editWalletName(wallet.id(),
|
||||||
|
isCesium: false);
|
||||||
await Future.delayed(
|
await Future.delayed(
|
||||||
const Duration(milliseconds: 30));
|
const Duration(milliseconds: 30));
|
||||||
_walletOptions.walletNameFocus.requestFocus();
|
_walletOptions.walletNameFocus.requestFocus();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/models/wallet_options.dart';
|
import 'package:gecko/models/wallet_options.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/cesium_wallet_options.dart';
|
||||||
import 'package:gecko/screens/myWallets/choose_chest.dart';
|
import 'package:gecko/screens/myWallets/choose_chest.dart';
|
||||||
import 'package:gecko/screens/myWallets/wallet_options.dart';
|
import 'package:gecko/screens/myWallets/wallet_options.dart';
|
||||||
import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
|
import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
|
||||||
|
@ -62,18 +63,18 @@ class WalletsHome extends StatelessWidget {
|
||||||
child: !isWalletsExists
|
child: !isWalletsExists
|
||||||
? const NoKeyChainScreen()
|
? const NoKeyChainScreen()
|
||||||
: _currentChest.isCesium
|
: _currentChest.isCesium
|
||||||
? cesiumWalletOptions(context)
|
? cesiumWalletOptions(context, _currentChest)
|
||||||
: myWalletsTiles(context),
|
: myWalletsTiles(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget cesiumWalletOptions(BuildContext context) {
|
// Widget cesiumWalletOptions(BuildContext context) {
|
||||||
return Column(children: const [
|
// return Column(children: const [
|
||||||
Center(child: Text('This is a Cesium wallet')),
|
// Center(child: Text('This is a Cesium wallet')),
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
Widget chestOptions(BuildContext context) {
|
Widget chestOptions(BuildContext context) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
|
@ -214,11 +215,17 @@ class WalletsHome extends StatelessWidget {
|
||||||
child:
|
child:
|
||||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||||
// semanticsLabel: 'Gecko', height: 48),
|
// semanticsLabel: 'Gecko', height: 48),
|
||||||
Image.asset(
|
_repository.imageFile == null
|
||||||
'assets/avatars/${_repository.imageName}',
|
? Image.asset(
|
||||||
alignment: Alignment.bottomCenter,
|
'assets/avatars/${_repository.imageName}',
|
||||||
scale: 0.5,
|
alignment: Alignment.bottomCenter,
|
||||||
),
|
scale: 0.5,
|
||||||
|
)
|
||||||
|
: Image.file(
|
||||||
|
_repository.imageFile,
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
scale: 0.5,
|
||||||
|
),
|
||||||
)),
|
)),
|
||||||
// balanceBuilder(context, _walletOptions.pubkey.text),
|
// balanceBuilder(context, _walletOptions.pubkey.text),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
@ -176,6 +176,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.15.0"
|
||||||
|
confirm_dialog:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: confirm_dialog
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -56,6 +56,7 @@ dependencies:
|
||||||
assorted_layout_widgets: ^5.2.1
|
assorted_layout_widgets: ^5.2.1
|
||||||
carousel_slider: ^4.0.0
|
carousel_slider: ^4.0.0
|
||||||
flutter_lints: ^1.0.4
|
flutter_lints: ^1.0.4
|
||||||
|
confirm_dialog: ^1.0.0
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "ic_launcher"
|
android: "ic_launcher"
|
||||||
|
@ -79,6 +80,7 @@ flutter:
|
||||||
- images/
|
- images/
|
||||||
- config/gva_endpoints.json
|
- config/gva_endpoints.json
|
||||||
- assets/
|
- assets/
|
||||||
|
- assets/customs/
|
||||||
- assets/avatars/
|
- assets/avatars/
|
||||||
- assets/chests/
|
- assets/chests/
|
||||||
- assets/icon/
|
- assets/icon/
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Imports the Flutter Driver API.
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter_driver/flutter_driver.dart';
|
import 'package:flutter_driver/flutter_driver.dart';
|
||||||
import 'package:gecko/globals.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
// import 'package:flutter/services.dart';
|
// import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
@ -71,13 +71,8 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a derivation
|
// Create a derivation
|
||||||
Future createDerivation(String _name) async {
|
Future createDerivation() async {
|
||||||
await tapOn('addDerivation');
|
await tapOn('addDerivation');
|
||||||
await sleep(100);
|
|
||||||
|
|
||||||
await driver.enterText(_name);
|
|
||||||
|
|
||||||
await tapOn('validDerivation');
|
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +104,7 @@ void main() {
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('generateKeychain');
|
await tapOn('generateKeychain');
|
||||||
while (await getText('generatedPin') == '') {
|
while (await getText('generatedPin') == '') {
|
||||||
log.i('Waiting for pin code generation...');
|
print('Waiting for pin code generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
pinCode = await getText('generatedPin');
|
pinCode = await getText('generatedPin');
|
||||||
|
@ -172,7 +167,7 @@ void main() {
|
||||||
await tapOn('goStep7');
|
await tapOn('goStep7');
|
||||||
|
|
||||||
while (await getText('word1') == '...') {
|
while (await getText('word1') == '...') {
|
||||||
log.i('Waiting for Mnemonic generation...');
|
print('Waiting for Mnemonic generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +221,7 @@ void main() {
|
||||||
await tapOn('goStep11');
|
await tapOn('goStep11');
|
||||||
|
|
||||||
while (await getText('generatedPin') == '') {
|
while (await getText('generatedPin') == '') {
|
||||||
log.i('Waiting for pin code generation...');
|
print('Waiting for pin code generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +253,7 @@ void main() {
|
||||||
{timeout = const Duration(seconds: 2)}) async {
|
{timeout = const Duration(seconds: 2)}) async {
|
||||||
await tapOn('goWalletHome');
|
await tapOn('goWalletHome');
|
||||||
|
|
||||||
expect(await getText('myWallets'), "Mes portefeuilles");
|
expect(await getText('myWallets'), "Coffre à Ğecko");
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
|
||||||
// Go to first derivation and rename it
|
// Go to first derivation and rename it
|
||||||
|
@ -281,10 +276,10 @@ void main() {
|
||||||
{timeout = const Duration(seconds: 2)}) async {
|
{timeout = const Duration(seconds: 2)}) async {
|
||||||
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
|
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
|
||||||
// Add a second derivation
|
// Add a second derivation
|
||||||
await createDerivation('Derivation 2');
|
await createDerivation();
|
||||||
|
|
||||||
// Go to second derivation options
|
// Go to second derivation options
|
||||||
await driver.tap(find.text('Derivation 2'));
|
await driver.tap(find.text('Portefeuille 2'));
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
|
|
||||||
// Test options
|
// Test options
|
||||||
|
@ -305,14 +300,14 @@ void main() {
|
||||||
await goBack();
|
await goBack();
|
||||||
|
|
||||||
// Add a third derivation
|
// Add a third derivation
|
||||||
await createDerivation('Derivation 3');
|
await createDerivation();
|
||||||
|
|
||||||
// Add a fourth derivation
|
// Add a fourth derivation
|
||||||
await createDerivation('Derivation 4');
|
await createDerivation();
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
|
|
||||||
// Go to third derivation options
|
// Go to third derivation options
|
||||||
await driver.tap(find.text('Derivation 3'));
|
await driver.tap(find.text('Portefeuille 3'));
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('displayBalance');
|
await tapOn('displayBalance');
|
||||||
|
|
||||||
|
@ -323,10 +318,10 @@ void main() {
|
||||||
test('My wallets - Extra tests', (
|
test('My wallets - Extra tests', (
|
||||||
{timeout = const Duration(seconds: 2)}) async {
|
{timeout = const Duration(seconds: 2)}) async {
|
||||||
// Add derivation 5,6 and 7
|
// Add derivation 5,6 and 7
|
||||||
await driver.waitFor(find.text('Derivation 4'), timeout: timeout);
|
await driver.waitFor(find.text('Portefeuille 4'), timeout: timeout);
|
||||||
await createDerivation('Derivation 5');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 6');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 7');
|
await createDerivation();
|
||||||
|
|
||||||
// Go home and come back to my wallets view
|
// Go home and come back to my wallets view
|
||||||
await goBack();
|
await goBack();
|
||||||
|
@ -338,12 +333,12 @@ void main() {
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
|
|
||||||
// Go to derivation 6 and delete it
|
// Go to derivation 6 and delete it
|
||||||
await driver.tap(find.text('Derivation 6'));
|
await driver.tap(find.text('Portefeuille 6'));
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await deleteWallet(true);
|
await deleteWallet(true);
|
||||||
|
|
||||||
// Go to 2nd derivation and check if it's de default
|
// Go to 2nd derivation and check if it's de default
|
||||||
await driver.tap(find.text('Derivation 2'));
|
await driver.tap(find.text('Portefeuille 2'));
|
||||||
await driver.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
await driver.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
||||||
await tapOn('setDefaultWallet');
|
await tapOn('setDefaultWallet');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
|
@ -369,43 +364,44 @@ void main() {
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await goBack();
|
await goBack();
|
||||||
await driver.waitFor(find.text('Renommage wallet 2'));
|
await driver.waitFor(find.text('Renommage wallet 2'));
|
||||||
await createDerivation('Derivation 8');
|
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 9');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 10');
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 11');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 12');
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 13');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 14');
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 15');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 16');
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 17');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 18');
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver.scrollIntoView(find.text('+'));
|
||||||
await createDerivation('Derivation 19');
|
await createDerivation();
|
||||||
await createDerivation('Derivation 20');
|
await createDerivation();
|
||||||
|
await driver.scrollIntoView(find.text('+'));
|
||||||
|
await createDerivation();
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
|
|
||||||
// Scroll the wallet screen until Derivation 20 and open it
|
// Scroll the wallet screen until Derivation 20 and open it
|
||||||
await driver.scrollUntilVisible(
|
await driver.scrollUntilVisible(
|
||||||
find.byValueKey('listWallets'),
|
find.byValueKey('listWallets'),
|
||||||
find.text('Derivation 20'),
|
find.text('Portefeuille 20'),
|
||||||
dyScroll: -300.0,
|
dyScroll: -300.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
await driver.waitFor(find.text('Derivation 20'));
|
await driver.waitFor(find.text('Portefeuille 20'));
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await driver.tap(find.text('Derivation 20'));
|
await driver.tap(find.text('Portefeuille 20'));
|
||||||
await tapOn('copyPubkey');
|
await tapOn('copyPubkey');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Search - Search Pi profile, navigate in history transactions', (
|
test('Search - Search Pi profile, navigate in history transactions', (
|
||||||
{timeout = const Duration(seconds: 2)}) async {
|
{timeout = const Duration(seconds: 2)}) async {
|
||||||
await driver.waitFor(find.text('Derivation 20'), timeout: timeout);
|
await driver.waitFor(find.text('Portefeuille 20'), timeout: timeout);
|
||||||
await goBack();
|
await goBack();
|
||||||
await goBack();
|
await goBack();
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
|
@ -448,7 +444,7 @@ void main() {
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
await driver.enterText(pincode);
|
await driver.enterText(pincode);
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await createDerivation('Derivation 2');
|
await createDerivation();
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await driver.tap(find.text('Fast wallet'));
|
await driver.tap(find.text('Fast wallet'));
|
||||||
await driver.waitFor(find.text('Fast wallet'));
|
await driver.waitFor(find.text('Fast wallet'));
|
||||||
|
|
Loading…
Reference in New Issue