Migrate to null safety
This commit is contained in:
parent
148302d509
commit
bb090b62ce
|
@ -8,23 +8,23 @@ import 'package:logger/logger.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
// Files paths
|
// Files paths
|
||||||
Directory appPath;
|
Directory? appPath;
|
||||||
|
|
||||||
String appVersion;
|
String? appVersion;
|
||||||
SharedPreferences prefs;
|
SharedPreferences? prefs;
|
||||||
String endPointGVA;
|
String? endPointGVA;
|
||||||
int ramSys;
|
int? ramSys;
|
||||||
Box<WalletData> walletBox;
|
late Box<WalletData> walletBox;
|
||||||
Box<ChestData> chestBox;
|
late Box<ChestData> chestBox;
|
||||||
Box configBox;
|
late Box configBox;
|
||||||
Box<G1WalletsList> g1WalletsBox;
|
late Box<G1WalletsList> g1WalletsBox;
|
||||||
|
|
||||||
String cesiumPod = "https://g1.data.le-sou.org";
|
String cesiumPod = "https://g1.data.le-sou.org";
|
||||||
// String cesiumPod = "https://g1.data.e-is.pro";
|
// String cesiumPod = "https://g1.data.e-is.pro";
|
||||||
|
|
||||||
// Responsive ratios
|
// Responsive ratios
|
||||||
bool isTall;
|
late bool isTall;
|
||||||
double ratio;
|
late double ratio;
|
||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
var log = Logger();
|
var log = Logger();
|
||||||
|
|
|
@ -124,14 +124,14 @@ Future<void> main() async {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Gecko extends StatelessWidget {
|
class Gecko extends StatelessWidget {
|
||||||
const Gecko(this.randomEndpoint, {Key key}) : super(key: key);
|
const Gecko(this.randomEndpoint, {Key? key}) : super(key: key);
|
||||||
final String randomEndpoint;
|
final String? randomEndpoint;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
final _httpLink = HttpLink(
|
final _httpLink = HttpLink(
|
||||||
randomEndpoint,
|
randomEndpoint!,
|
||||||
);
|
);
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
final _client = ValueNotifier(
|
||||||
|
@ -160,7 +160,7 @@ class Gecko extends StatelessWidget {
|
||||||
client: _client,
|
client: _client,
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
builder: (context, widget) => ResponsiveWrapper.builder(
|
builder: (context, widget) => ResponsiveWrapper.builder(
|
||||||
BouncingScrollWrapper.builder(context, widget),
|
BouncingScrollWrapper.builder(context, widget!),
|
||||||
maxWidth: 1200,
|
maxWidth: 1200,
|
||||||
minWidth: 480,
|
minWidth: 480,
|
||||||
defaultScale: true,
|
defaultScale: true,
|
||||||
|
@ -202,7 +202,7 @@ class Gecko extends StatelessWidget {
|
||||||
// This http overriding is needed to fix fail certifcat checking for Duniter node on old Android version
|
// This http overriding is needed to fix fail certifcat checking for Duniter node on old Android version
|
||||||
class MyHttpOverrides extends HttpOverrides {
|
class MyHttpOverrides extends HttpOverrides {
|
||||||
@override
|
@override
|
||||||
HttpClient createHttpClient(SecurityContext context) {
|
HttpClient createHttpClient(SecurityContext? context) {
|
||||||
return super.createHttpClient(context)
|
return super.createHttpClient(context)
|
||||||
..badCertificateCallback =
|
..badCertificateCallback =
|
||||||
(X509Certificate cert, String host, int port) => true;
|
(X509Certificate cert, String host, int port) => true;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
class CesiumPlusProvider with ChangeNotifier {
|
class CesiumPlusProvider with ChangeNotifier {
|
||||||
TextEditingController cesiumName = TextEditingController();
|
TextEditingController cesiumName = TextEditingController();
|
||||||
Image defaultAvatar(double size) =>
|
Image defaultAvatar(double? size) =>
|
||||||
Image.asset(('assets/icon_user.png'), height: size);
|
Image.asset(('assets/icon_user.png'), height: size);
|
||||||
|
|
||||||
CancelToken avatarCancelToken = CancelToken();
|
CancelToken avatarCancelToken = CancelToken();
|
||||||
|
@ -60,17 +60,17 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
return [podRequest, queryGetAvatar, headers];
|
return [podRequest, queryGetAvatar, headers];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getName(String _pubkey) async {
|
Future<String?> getName(String? _pubkey) async {
|
||||||
String _name;
|
String? _name;
|
||||||
|
|
||||||
if (g1WalletsBox.get(_pubkey).csName != null) {
|
if (g1WalletsBox.get(_pubkey)!.csName != null) {
|
||||||
return g1WalletsBox.get(_pubkey).csName;
|
return g1WalletsBox.get(_pubkey)!.csName;
|
||||||
}
|
}
|
||||||
|
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
|
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
Response response;
|
late Response response;
|
||||||
try {
|
try {
|
||||||
response = await dio.post(
|
response = await dio.post(
|
||||||
queryOptions[0],
|
queryOptions[0],
|
||||||
|
@ -97,14 +97,14 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
_name = response.data['hits']['hits'][0]['_source']['title'];
|
_name = response.data['hits']['hits'][0]['_source']['title'];
|
||||||
|
|
||||||
g1WalletsBox.get(_pubkey).csName = _name;
|
g1WalletsBox.get(_pubkey)!.csName = _name;
|
||||||
|
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Image> getAvatar(String _pubkey, double size) async {
|
Future<Image?> getAvatar(String? _pubkey, double size) async {
|
||||||
if (g1WalletsBox.get(_pubkey)?.avatar != null) {
|
if (g1WalletsBox.get(_pubkey)?.avatar != null) {
|
||||||
return g1WalletsBox.get(_pubkey).avatar;
|
return g1WalletsBox.get(_pubkey)!.avatar;
|
||||||
}
|
}
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
|
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
|
|
||||||
Response response;
|
late Response response;
|
||||||
try {
|
try {
|
||||||
response = await dio
|
response = await dio
|
||||||
.post(queryOptions[0],
|
.post(queryOptions[0],
|
||||||
|
@ -150,7 +150,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
fit: BoxFit.fitWidth,
|
fit: BoxFit.fitWidth,
|
||||||
);
|
);
|
||||||
|
|
||||||
g1WalletsBox.get(_pubkey).avatar = finalAvatar;
|
g1WalletsBox.get(_pubkey)!.avatar = finalAvatar;
|
||||||
|
|
||||||
return finalAvatar;
|
return finalAvatar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@ import 'package:gecko/globals.dart';
|
||||||
class ChangePinProvider with ChangeNotifier {
|
class ChangePinProvider with ChangeNotifier {
|
||||||
bool ischangedPin = false;
|
bool ischangedPin = false;
|
||||||
TextEditingController newPin = TextEditingController();
|
TextEditingController newPin = TextEditingController();
|
||||||
String pinToGive;
|
String? pinToGive;
|
||||||
|
|
||||||
NewWallet get badWallet => null;
|
NewWallet? get badWallet => null;
|
||||||
|
|
||||||
NewWallet changePin(String _oldPin, {String newCustomPin}) {
|
NewWallet? changePin(String _oldPin, {String? newCustomPin}) {
|
||||||
try {
|
try {
|
||||||
final _dewif = chestBox.get(configBox.get('currentChest')).dewif;
|
final _dewif = chestBox.get(configBox.get('currentChest'))!.dewif!;
|
||||||
|
|
||||||
// TODO: Durt: Detect if CesiumWallet
|
// TODO: Durt: Detect if CesiumWallet
|
||||||
NewWallet newWalletFile = Dewif().changePassword(
|
NewWallet newWalletFile = Dewif().changePassword(
|
||||||
|
@ -34,7 +34,7 @@ class ChangePinProvider with ChangeNotifier {
|
||||||
// currentChest.dewif = _newWalletFile.dewif;
|
// currentChest.dewif = _newWalletFile.dewif;
|
||||||
// await chestBox.add(currentChest);
|
// await chestBox.add(currentChest);
|
||||||
|
|
||||||
chestBox.get(configBox.get('currentChest')).dewif = _newWalletFile.dewif;
|
chestBox.get(configBox.get('currentChest'))!.dewif = _newWalletFile.dewif;
|
||||||
|
|
||||||
Navigator.pop(context, pinToGive);
|
Navigator.pop(context, pinToGive);
|
||||||
pinToGive = '';
|
pinToGive = '';
|
||||||
|
|
|
@ -7,22 +7,22 @@ part 'chest_data.g.dart';
|
||||||
@HiveType(typeId: 1)
|
@HiveType(typeId: 1)
|
||||||
class ChestData extends HiveObject {
|
class ChestData extends HiveObject {
|
||||||
@HiveField(0)
|
@HiveField(0)
|
||||||
String dewif;
|
String? dewif;
|
||||||
|
|
||||||
@HiveField(2)
|
@HiveField(2)
|
||||||
String name;
|
String? name;
|
||||||
|
|
||||||
@HiveField(3)
|
@HiveField(3)
|
||||||
int defaultWallet;
|
int? defaultWallet;
|
||||||
|
|
||||||
@HiveField(4)
|
@HiveField(4)
|
||||||
String imageName;
|
String? imageName;
|
||||||
|
|
||||||
@HiveField(5)
|
@HiveField(5)
|
||||||
File imageFile;
|
File? imageFile;
|
||||||
|
|
||||||
@HiveField(6)
|
@HiveField(6)
|
||||||
bool isCesium;
|
bool? isCesium;
|
||||||
|
|
||||||
ChestData({
|
ChestData({
|
||||||
this.dewif,
|
this.dewif,
|
||||||
|
@ -35,6 +35,6 @@ class ChestData extends HiveObject {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return name;
|
return name!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
};
|
};
|
||||||
return ChestData(
|
return ChestData(
|
||||||
dewif: fields[0] as String,
|
dewif: fields[0] as String?,
|
||||||
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?,
|
||||||
imageFile: fields[5] as File,
|
imageFile: fields[5] as File?,
|
||||||
isCesium: fields[6] as bool,
|
isCesium: fields[6] as bool?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
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_data.dart';
|
||||||
|
@ -8,14 +9,14 @@ class ChestProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future deleteChest(context, ChestData _chest) async {
|
Future deleteChest(context, ChestData _chest) async {
|
||||||
final bool _answer = await _confirmDeletingChest(context, _chest.name);
|
final bool _answer = await (_confirmDeletingChest(context, _chest.name) as FutureOr<bool>);
|
||||||
|
|
||||||
if (_answer) {
|
if (_answer) {
|
||||||
await chestBox.delete(_chest.key);
|
await chestBox.delete(_chest.key);
|
||||||
if (chestBox.isEmpty) {
|
if (chestBox.isEmpty) {
|
||||||
await configBox.put('currentChest', 0);
|
await configBox.put('currentChest', 0);
|
||||||
} else {
|
} else {
|
||||||
int lastChest = chestBox.toMap().keys.first;
|
int? lastChest = chestBox.toMap().keys.first;
|
||||||
await configBox.put('currentChest', lastChest);
|
await configBox.put('currentChest', lastChest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ class ChestProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _confirmDeletingChest(context, String _walletName) async {
|
Future<bool?> _confirmDeletingChest(context, String? _walletName) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
|
|
|
@ -6,25 +6,25 @@ part 'g1_wallets_list.g.dart';
|
||||||
@HiveType(typeId: 2)
|
@HiveType(typeId: 2)
|
||||||
class G1WalletsList {
|
class G1WalletsList {
|
||||||
@HiveField(0)
|
@HiveField(0)
|
||||||
String pubkey;
|
String? pubkey;
|
||||||
|
|
||||||
@HiveField(1)
|
@HiveField(1)
|
||||||
double balance;
|
double? balance;
|
||||||
|
|
||||||
@HiveField(3)
|
@HiveField(3)
|
||||||
Id id;
|
Id? id;
|
||||||
|
|
||||||
@HiveField(4)
|
@HiveField(4)
|
||||||
Image avatar;
|
Image? avatar;
|
||||||
|
|
||||||
@HiveField(5)
|
@HiveField(5)
|
||||||
String username;
|
String? username;
|
||||||
|
|
||||||
@HiveField(6)
|
@HiveField(6)
|
||||||
String csName;
|
String? csName;
|
||||||
|
|
||||||
@HiveField(7)
|
@HiveField(7)
|
||||||
bool isMembre;
|
bool? isMembre;
|
||||||
|
|
||||||
G1WalletsList({
|
G1WalletsList({
|
||||||
this.pubkey,
|
this.pubkey,
|
||||||
|
@ -47,7 +47,7 @@ class G1WalletsList {
|
||||||
data['pubkey'] = pubkey;
|
data['pubkey'] = pubkey;
|
||||||
data['balance'] = balance;
|
data['balance'] = balance;
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
data['id'] = id.toJson();
|
data['id'] = id!.toJson();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ class G1WalletsList {
|
||||||
|
|
||||||
@HiveType(typeId: 3)
|
@HiveType(typeId: 3)
|
||||||
class Id {
|
class Id {
|
||||||
bool isMember;
|
bool? isMember;
|
||||||
String username;
|
String? username;
|
||||||
|
|
||||||
Id({this.isMember, this.username});
|
Id({this.isMember, this.username});
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ class G1WalletsListAdapter extends TypeAdapter<G1WalletsList> {
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
};
|
};
|
||||||
return G1WalletsList(
|
return G1WalletsList(
|
||||||
pubkey: fields[0] as String,
|
pubkey: fields[0] as String?,
|
||||||
balance: fields[1] as double,
|
balance: fields[1] as double?,
|
||||||
id: fields[3] as Id,
|
id: fields[3] as Id?,
|
||||||
avatar: fields[4] as Image,
|
avatar: fields[4] as Image?,
|
||||||
username: fields[5] as String,
|
username: fields[5] as String?,
|
||||||
csName: fields[6] as String,
|
csName: fields[6] as String?,
|
||||||
isMembre: fields[7] as bool,
|
isMembre: fields[7] as bool?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,16 @@ import "package:unorm_dart/unorm_dart.dart" as unorm;
|
||||||
class GenerateWalletsProvider with ChangeNotifier {
|
class GenerateWalletsProvider with ChangeNotifier {
|
||||||
GenerateWalletsProvider();
|
GenerateWalletsProvider();
|
||||||
// NewWallet generatedWallet;
|
// NewWallet generatedWallet;
|
||||||
NewWallet actualWallet;
|
NewWallet? actualWallet;
|
||||||
|
|
||||||
FocusNode walletNameFocus = FocusNode();
|
FocusNode walletNameFocus = FocusNode();
|
||||||
Color askedWordColor = Colors.black;
|
Color? askedWordColor = Colors.black;
|
||||||
bool isAskedWordValid = false;
|
bool isAskedWordValid = false;
|
||||||
|
|
||||||
int nbrWord;
|
late int nbrWord;
|
||||||
String nbrWordAlpha;
|
String? nbrWordAlpha;
|
||||||
|
|
||||||
String generatedMnemonic;
|
String? generatedMnemonic;
|
||||||
bool walletIsGenerated = true;
|
bool walletIsGenerated = true;
|
||||||
|
|
||||||
TextEditingController mnemonicController = TextEditingController();
|
TextEditingController mnemonicController = TextEditingController();
|
||||||
|
@ -37,7 +37,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
bool isCesiumIDVisible = false;
|
bool isCesiumIDVisible = false;
|
||||||
bool isCesiumPWDVisible = false;
|
bool isCesiumPWDVisible = false;
|
||||||
bool canImport = false;
|
bool canImport = false;
|
||||||
CesiumWallet cesiumWallet;
|
late CesiumWallet cesiumWallet;
|
||||||
|
|
||||||
// Import Chest
|
// Import Chest
|
||||||
TextEditingController cellController0 = TextEditingController();
|
TextEditingController cellController0 = TextEditingController();
|
||||||
|
@ -58,7 +58,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
NewWallet _wallet, String _name, BuildContext context) async {
|
NewWallet _wallet, String _name, BuildContext context) async {
|
||||||
int chestNumber = 0;
|
int chestNumber = 0;
|
||||||
chestBox.toMap().forEach((key, value) {
|
chestBox.toMap().forEach((key, value) {
|
||||||
if (!value.isCesium) {
|
if (!value.isCesium!) {
|
||||||
chestNumber++;
|
chestNumber++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
isCesium: false,
|
isCesium: false,
|
||||||
);
|
);
|
||||||
await chestBox.add(thisChest);
|
await chestBox.add(thisChest);
|
||||||
int chestKey = chestBox.keys.last;
|
int? chestKey = chestBox.keys.last;
|
||||||
|
|
||||||
WalletData myWallet = WalletData(
|
WalletData myWallet = WalletData(
|
||||||
chest: chestKey,
|
chest: chestKey,
|
||||||
|
@ -128,7 +128,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
return rng.nextInt(12);
|
return rng.nextInt(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToString(int _nbr) {
|
String? intToString(int _nbr) {
|
||||||
Map nbrToString = {};
|
Map nbrToString = {};
|
||||||
nbrToString[1] = 'Premier';
|
nbrToString[1] = 'Premier';
|
||||||
nbrToString[2] = 'Deuxième';
|
nbrToString[2] = 'Deuxième';
|
||||||
|
@ -152,8 +152,8 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<NewWallet> generateWallet(String generatedMnemonic,
|
Future<NewWallet?> generateWallet(String generatedMnemonic,
|
||||||
{@required bool isImport}) async {
|
{required bool isImport}) async {
|
||||||
try {
|
try {
|
||||||
actualWallet = Dewif().generateDewif(
|
actualWallet = Dewif().generateDewif(
|
||||||
generatedMnemonic, randomSecretCode(5),
|
generatedMnemonic, randomSecretCode(5),
|
||||||
|
@ -164,14 +164,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
if (!isImport) {
|
if (!isImport) {
|
||||||
mnemonicController.text = generatedMnemonic;
|
mnemonicController.text = generatedMnemonic;
|
||||||
pin.text = actualWallet.password;
|
pin.text = actualWallet!.password;
|
||||||
}
|
}
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
|
|
||||||
return actualWallet;
|
return actualWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
String changePinCode({bool reload}) {
|
String changePinCode({required bool reload}) {
|
||||||
pin.text = randomSecretCode(5);
|
pin.text = randomSecretCode(5);
|
||||||
if (reload) {
|
if (reload) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -179,7 +179,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
return pin.text;
|
return pin.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List> printWallet(String _title) async {
|
Future<Uint8List> printWallet(String? _title) async {
|
||||||
final ByteData fontData =
|
final ByteData fontData =
|
||||||
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
||||||
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
||||||
|
@ -197,7 +197,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
pw.Text("Phrase de restauration:",
|
pw.Text("Phrase de restauration:",
|
||||||
style: pw.TextStyle(fontSize: 20, font: ttf)),
|
style: pw.TextStyle(fontSize: 20, font: ttf)),
|
||||||
pw.SizedBox(height: 10),
|
pw.SizedBox(height: 10),
|
||||||
pw.Text(_title,
|
pw.Text(_title!,
|
||||||
style: pw.TextStyle(fontSize: 15, font: ttf),
|
style: pw.TextStyle(fontSize: 15, font: ttf),
|
||||||
textAlign: pw.TextAlign.center),
|
textAlign: pw.TextAlign.center),
|
||||||
pw.Expanded(
|
pw.Expanded(
|
||||||
|
@ -226,7 +226,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
log.d(_walletPubkey);
|
log.d(_walletPubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> importCesiumWallet() async {
|
Future<int?> 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,
|
||||||
|
@ -244,7 +244,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
int chestNumber = 0;
|
int chestNumber = 0;
|
||||||
chestBox.toMap().forEach((key, value) {
|
chestBox.toMap().forEach((key, value) {
|
||||||
if (value.isCesium) {
|
if (value.isCesium!) {
|
||||||
chestNumber++;
|
chestNumber++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -268,7 +268,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
isCesium: true);
|
isCesium: true);
|
||||||
|
|
||||||
await chestBox.add(cesiumChest).then((value) => null);
|
await chestBox.add(cesiumChest).then((value) => null);
|
||||||
int chestKey = await chestBox.toMap().keys.last;
|
int? chestKey = await chestBox.toMap().keys.last;
|
||||||
// chestBox.toMap().
|
// chestBox.toMap().
|
||||||
await configBox.put('currentChest', chestKey);
|
await configBox.put('currentChest', chestKey);
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
String word;
|
String word;
|
||||||
int _nbr = 1;
|
int _nbr = 1;
|
||||||
|
|
||||||
for (word in generatedMnemonic.split(' ')) {
|
for (word in generatedMnemonic!.split(' ')) {
|
||||||
_wordsList.add("$_nbr:$word");
|
_wordsList.add("$_nbr:$word");
|
||||||
_nbr++;
|
_nbr++;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
bool isBipWordsList(List words) {
|
bool isBipWordsList(List words) {
|
||||||
bool isValid = true;
|
bool isValid = true;
|
||||||
for (String word in words) {
|
for (String word in words as Iterable<String>) {
|
||||||
// Needed for bad encoding of UTF-8
|
// Needed for bad encoding of UTF-8
|
||||||
word = word.replaceAll('é', 'é');
|
word = word.replaceAll('é', 'é');
|
||||||
word = word.replaceAll('è', 'è');
|
word = word.replaceAll('è', 'è');
|
||||||
|
@ -374,7 +374,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
inputMnemonic = inputMnemonic.replaceAll('é', 'é');
|
inputMnemonic = inputMnemonic.replaceAll('é', 'é');
|
||||||
inputMnemonic = inputMnemonic.replaceAll('è', 'è');
|
inputMnemonic = inputMnemonic.replaceAll('è', 'è');
|
||||||
|
|
||||||
NewWallet generatedWallet =
|
NewWallet? generatedWallet =
|
||||||
await generateWallet(inputMnemonic, isImport: true);
|
await generateWallet(inputMnemonic, isImport: true);
|
||||||
|
|
||||||
if (generatedWallet == null) {
|
if (generatedWallet == null) {
|
||||||
|
|
|
@ -13,8 +13,7 @@ import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:path_provider/path_provider.dart' as pp;
|
import 'package:path_provider/path_provider.dart' as pp;
|
||||||
|
|
||||||
class HomeProvider with ChangeNotifier {
|
class HomeProvider with ChangeNotifier {
|
||||||
int _currentIndex = 0;
|
bool? isSearching;
|
||||||
bool isSearching;
|
|
||||||
Icon searchIcon = const Icon(Icons.search);
|
Icon searchIcon = const Icon(Icons.search);
|
||||||
final TextEditingController searchQuery = TextEditingController();
|
final TextEditingController searchQuery = TextEditingController();
|
||||||
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
||||||
|
@ -24,15 +23,8 @@ class HomeProvider with ChangeNotifier {
|
||||||
bool isFirstBuild = true;
|
bool isFirstBuild = true;
|
||||||
// AudioCache player = AudioCache(prefix: 'sounds/');
|
// AudioCache player = AudioCache(prefix: 'sounds/');
|
||||||
|
|
||||||
get currentIndex => _currentIndex;
|
|
||||||
|
|
||||||
set currentIndex(int index) {
|
|
||||||
_currentIndex = index;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initHive() async {
|
Future<void> initHive() async {
|
||||||
Directory hivePath;
|
late Directory hivePath;
|
||||||
|
|
||||||
if (!kIsWeb) {
|
if (!kIsWeb) {
|
||||||
if (Platform.isLinux || Platform.isMacOS) {
|
if (Platform.isLinux || Platform.isMacOS) {
|
||||||
|
@ -70,14 +62,14 @@ class HomeProvider with ChangeNotifier {
|
||||||
return version + '+' + buildNumber;
|
return version + '+' + buildNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getValidEndpoint() async {
|
Future<String?> getValidEndpoint() async {
|
||||||
List _listEndpoints = await rootBundle
|
List _listEndpoints = await rootBundle
|
||||||
.loadString('config/gva_endpoints.json')
|
.loadString('config/gva_endpoints.json')
|
||||||
.then((jsonStr) => jsonDecode(jsonStr));
|
.then((jsonStr) => jsonDecode(jsonStr));
|
||||||
_listEndpoints.shuffle();
|
_listEndpoints.shuffle();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
String _endpoint;
|
String? _endpoint;
|
||||||
int _statusCode = 0;
|
int _statusCode = 0;
|
||||||
|
|
||||||
final _client = HttpClient();
|
final _client = HttpClient();
|
||||||
|
@ -118,7 +110,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
} while (_statusCode != 400);
|
} while (_statusCode != 400);
|
||||||
|
|
||||||
log.i('ENDPOINT: ' + _endpoint);
|
log.i('ENDPOINT: ' + _endpoint!);
|
||||||
return _endpoint;
|
return _endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +151,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
_message =
|
_message =
|
||||||
"Aucun noeud Duniter disponible, veuillez réessayer ultérieurement";
|
"Aucun noeud Duniter disponible, veuillez réessayer ultérieurement";
|
||||||
} else {
|
} else {
|
||||||
_message = "Vous êtes connecté au noeud\n${endPointGVA.split('/')[2]}";
|
_message = "Vous êtes connecté au noeud\n${endPointGVA!.split('/')[2]}";
|
||||||
}
|
}
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: Text(_message), duration: const Duration(seconds: 2));
|
content: Text(_message), duration: const Duration(seconds: 2));
|
||||||
|
|
|
@ -5,10 +5,10 @@ import 'package:gecko/models/wallet_data.dart';
|
||||||
|
|
||||||
class MyWalletsProvider with ChangeNotifier {
|
class MyWalletsProvider with ChangeNotifier {
|
||||||
List<WalletData> listWallets = [];
|
List<WalletData> listWallets = [];
|
||||||
String pinCode;
|
late String pinCode;
|
||||||
int pinLenght;
|
int? pinLenght;
|
||||||
|
|
||||||
int getCurrentChest() {
|
int? getCurrentChest() {
|
||||||
if (configBox.get('currentChest') == null) {
|
if (configBox.get('currentChest') == null) {
|
||||||
configBox.put('currentChest', 0);
|
configBox.put('currentChest', 0);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WalletData> readAllWallets(int _chest) {
|
List<WalletData> readAllWallets(int? _chest) {
|
||||||
listWallets.clear();
|
listWallets.clear();
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == _chest) {
|
if (value.chest == _chest) {
|
||||||
|
@ -36,11 +36,11 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
return listWallets;
|
return listWallets;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData getWalletData(List<int> _id) {
|
WalletData? getWalletData(List<int?> _id) {
|
||||||
if (_id.isEmpty) return WalletData();
|
if (_id.isEmpty) return WalletData();
|
||||||
int _chest = _id[0];
|
int? _chest = _id[0];
|
||||||
int _nbr = _id[1];
|
int? _nbr = _id[1];
|
||||||
WalletData _targetedWallet;
|
WalletData? _targetedWallet;
|
||||||
|
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == _chest && value.number == _nbr) {
|
if (value.chest == _chest && value.number == _nbr) {
|
||||||
|
@ -52,11 +52,11 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
return _targetedWallet;
|
return _targetedWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData getDefaultWallet(int chest) {
|
WalletData? getDefaultWallet(int? chest) {
|
||||||
if (chestBox.isEmpty) {
|
if (chestBox.isEmpty) {
|
||||||
return WalletData(chest: 0, number: 0);
|
return WalletData(chest: 0, number: 0);
|
||||||
} else {
|
} else {
|
||||||
int defaultWalletNumber = chestBox.get(chest).defaultWallet;
|
int? defaultWalletNumber = chestBox.get(chest)!.defaultWallet;
|
||||||
return getWalletData([chest, defaultWalletNumber]);
|
return getWalletData([chest, defaultWalletNumber]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
try {
|
try {
|
||||||
log.w('DELETE ALL WALLETS ?');
|
log.w('DELETE ALL WALLETS ?');
|
||||||
|
|
||||||
final bool _answer = await _confirmDeletingAllWallets(context);
|
final bool _answer = await (_confirmDeletingAllWallets(context) as FutureOr<bool>);
|
||||||
if (_answer) {
|
if (_answer) {
|
||||||
await walletBox.clear();
|
await walletBox.clear();
|
||||||
await chestBox.clear();
|
await chestBox.clear();
|
||||||
|
@ -84,7 +84,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _confirmDeletingAllWallets(context) async {
|
Future<bool?> _confirmDeletingAllWallets(context) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
|
@ -116,15 +116,15 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
Future<void> generateNewDerivation(context, String _name) async {
|
Future<void> generateNewDerivation(context, String _name) async {
|
||||||
int _newDerivationNbr;
|
int _newDerivationNbr;
|
||||||
int _newWalletNbr;
|
int _newWalletNbr;
|
||||||
int _chest = getCurrentChest();
|
int? _chest = getCurrentChest();
|
||||||
List<WalletData> _walletConfig = readAllWallets(_chest);
|
List<WalletData> _walletConfig = readAllWallets(_chest);
|
||||||
|
|
||||||
if (_walletConfig.isEmpty) {
|
if (_walletConfig.isEmpty) {
|
||||||
_newDerivationNbr = 3;
|
_newDerivationNbr = 3;
|
||||||
_newWalletNbr = 0;
|
_newWalletNbr = 0;
|
||||||
} else {
|
} else {
|
||||||
_newDerivationNbr = _walletConfig.last.derivation + 3;
|
_newDerivationNbr = _walletConfig.last.derivation! + 3;
|
||||||
_newWalletNbr = _walletConfig.last.number + 1;
|
_newWalletNbr = _walletConfig.last.number! + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData newWallet = WalletData(
|
WalletData newWallet = WalletData(
|
||||||
|
|
|
@ -25,7 +25,7 @@ class SearchProvider with ChangeNotifier {
|
||||||
// final response = await http.get(url);
|
// final response = await http.get(url);
|
||||||
|
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
Response response;
|
late Response response;
|
||||||
try {
|
try {
|
||||||
response = await dio.get(
|
response = await dio.get(
|
||||||
'https://g1-stats.axiom-team.fr/data/forbes.json',
|
'https://g1-stats.axiom-team.fr/data/forbes.json',
|
||||||
|
@ -40,8 +40,8 @@ class SearchProvider with ChangeNotifier {
|
||||||
log.e(e);
|
log.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<G1WalletsList> _listWallets = _parseG1Wallets(response.data);
|
List<G1WalletsList> _listWallets = _parseG1Wallets(response.data)!;
|
||||||
Map<String, G1WalletsList> _mapWallets = {
|
Map<String?, G1WalletsList> _mapWallets = {
|
||||||
for (var e in _listWallets) e.pubkey: e
|
for (var e in _listWallets) e.pubkey: e
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ class SearchProvider with ChangeNotifier {
|
||||||
|
|
||||||
g1WalletsBox.toMap().forEach((key, value) {
|
g1WalletsBox.toMap().forEach((key, value) {
|
||||||
if ((value.id != null &&
|
if ((value.id != null &&
|
||||||
value.id.username != null &&
|
value.id!.username != null &&
|
||||||
value.id.username
|
value.id!.username!
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(searchController.text)) ||
|
.contains(searchController.text)) ||
|
||||||
value.pubkey.contains(searchController.text)) {
|
value.pubkey!.contains(searchController.text)) {
|
||||||
searchResult.add(value);
|
searchResult.add(value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class SearchProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<G1WalletsList> _parseG1Wallets(var responseBody) {
|
List<G1WalletsList>? _parseG1Wallets(var responseBody) {
|
||||||
final parsed = responseBody.cast<Map<String, dynamic>>();
|
final parsed = responseBody.cast<Map<String, dynamic>>();
|
||||||
|
|
||||||
return parsed
|
return parsed
|
||||||
|
|
|
@ -7,22 +7,22 @@ part 'wallet_data.g.dart';
|
||||||
@HiveType(typeId: 0)
|
@HiveType(typeId: 0)
|
||||||
class WalletData extends HiveObject {
|
class WalletData extends HiveObject {
|
||||||
@HiveField(0)
|
@HiveField(0)
|
||||||
int chest;
|
int? chest;
|
||||||
|
|
||||||
@HiveField(1)
|
@HiveField(1)
|
||||||
int number;
|
int? number;
|
||||||
|
|
||||||
@HiveField(2)
|
@HiveField(2)
|
||||||
String name;
|
String? name;
|
||||||
|
|
||||||
@HiveField(3)
|
@HiveField(3)
|
||||||
int derivation;
|
int? derivation;
|
||||||
|
|
||||||
@HiveField(4)
|
@HiveField(4)
|
||||||
String imageName;
|
String? imageName;
|
||||||
|
|
||||||
@HiveField(5)
|
@HiveField(5)
|
||||||
File imageFile;
|
File? imageFile;
|
||||||
|
|
||||||
WalletData(
|
WalletData(
|
||||||
{this.chest,
|
{this.chest,
|
||||||
|
@ -35,7 +35,7 @@ class WalletData extends HiveObject {
|
||||||
// representation of WalletData when debugging
|
// representation of WalletData when debugging
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return name;
|
return name!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates the ':'-separated string from the WalletData
|
// creates the ':'-separated string from the WalletData
|
||||||
|
@ -44,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<int> id() {
|
List<int?> id() {
|
||||||
return [chest, number];
|
return [chest, number];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
};
|
};
|
||||||
return WalletData(
|
return WalletData(
|
||||||
chest: fields[0] as int,
|
chest: fields[0] as int?,
|
||||||
number: fields[1] as int,
|
number: fields[1] as int?,
|
||||||
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,
|
imageFile: fields[5] as File?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
bool isBalanceBlur = true;
|
bool isBalanceBlur = true;
|
||||||
FocusNode walletNameFocus = FocusNode();
|
FocusNode walletNameFocus = FocusNode();
|
||||||
TextEditingController nameController = TextEditingController();
|
TextEditingController nameController = TextEditingController();
|
||||||
bool isDefaultWallet;
|
late bool isDefaultWallet;
|
||||||
|
|
||||||
Future<NewWallet> get badWallet => null;
|
Future<NewWallet>? get badWallet => null;
|
||||||
|
|
||||||
String _getPubkeyFromDewif(
|
String _getPubkeyFromDewif(
|
||||||
String _dewif, _pin, int _pinLenght, int derivation) {
|
String? _dewif, _pin, int _pinLenght, int? derivation) {
|
||||||
RegExp regExp = RegExp(
|
RegExp regExp = RegExp(
|
||||||
r'^[A-Z0-9]+$',
|
r'^[A-Z0-9]+$',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
|
@ -39,25 +39,25 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
if (derivation != -1) {
|
if (derivation != -1) {
|
||||||
try {
|
try {
|
||||||
final _wallet = HdWallet.fromDewif(_dewif, _pin);
|
final _wallet = HdWallet.fromDewif(_dewif!, _pin);
|
||||||
pubkey.text = _wallet.getPubkey(derivation);
|
pubkey.text = _wallet.getPubkey(derivation!);
|
||||||
log.d(pubkey.text);
|
log.d(pubkey.text);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return pubkey.text;
|
return pubkey.text;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.w('Bad PIN code !\n' + e);
|
log.w('Bad PIN code !\n' + e.toString());
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return 'false';
|
return 'false';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
pubkey.text = CesiumWallet.fromDewif(_dewif, _pin).pubkey;
|
pubkey.text = CesiumWallet.fromDewif(_dewif!, _pin).pubkey;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return pubkey.text;
|
return pubkey.text;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.w('Bad PIN code !\n' + e);
|
log.w('Bad PIN code !\n' + e.toString());
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return 'false';
|
return 'false';
|
||||||
|
@ -65,11 +65,11 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String readLocalWallet(
|
String? readLocalWallet(
|
||||||
context, WalletData _wallet, String _pin, int _pinLenght) {
|
context, WalletData _wallet, String _pin, int _pinLenght) {
|
||||||
isWalletUnlock = false;
|
isWalletUnlock = false;
|
||||||
try {
|
try {
|
||||||
String _localDewif = chestBox.get(_wallet.chest).dewif;
|
String? _localDewif = chestBox.get(_wallet.chest)!.dewif;
|
||||||
String _localPubkey;
|
String _localPubkey;
|
||||||
|
|
||||||
if ((_localPubkey = _getPubkeyFromDewif(
|
if ((_localPubkey = _getPubkeyFromDewif(
|
||||||
|
@ -108,15 +108,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _renameWallet(List<int> _walletID, _newName, {bool isCesium}) async {
|
void _renameWallet(List<int?> _walletID, _newName, {required bool isCesium}) async {
|
||||||
if (isCesium) {
|
if (isCesium) {
|
||||||
ChestData _chestTarget = chestBox.get(_walletID[0]);
|
ChestData _chestTarget = chestBox.get(_walletID[0])!;
|
||||||
_chestTarget.name = _newName;
|
_chestTarget.name = _newName;
|
||||||
await chestBox.put(_chestTarget.key, _chestTarget);
|
await chestBox.put(_chestTarget.key, _chestTarget);
|
||||||
} else {
|
} else {
|
||||||
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
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);
|
||||||
}
|
}
|
||||||
|
@ -124,12 +124,12 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
_newWalletName.text = '';
|
_newWalletName.text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool editWalletName(List<int> _wID, {bool isCesium}) {
|
bool editWalletName(List<int?> _wID, {bool? isCesium}) {
|
||||||
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, isCesium: isCesium);
|
_renameWallet(_wID, nameController.text, isCesium: isCesium!);
|
||||||
nameState = true;
|
nameState = true;
|
||||||
} else {
|
} else {
|
||||||
nameState = false;
|
nameState = false;
|
||||||
|
@ -144,7 +144,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteWallet(context, WalletData wallet) async {
|
Future<int> deleteWallet(context, WalletData wallet) async {
|
||||||
final bool _answer = await _confirmDeletingWallet(context, wallet.name);
|
final bool _answer = await (_confirmDeletingWallet(context, wallet.name) as FutureOr<bool>);
|
||||||
|
|
||||||
if (_answer) {
|
if (_answer) {
|
||||||
walletBox.delete(wallet.key);
|
walletBox.delete(wallet.key);
|
||||||
|
@ -157,7 +157,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _confirmDeletingWallet(context, _walletName) async {
|
Future<bool?> _confirmDeletingWallet(context, _walletName) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
|
@ -224,7 +224,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
File _image;
|
File _image;
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
|
|
||||||
XFile 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);
|
||||||
|
|
|
@ -19,18 +19,18 @@ import 'package:fast_base58/fast_base58.dart';
|
||||||
class WalletsProfilesProvider with ChangeNotifier {
|
class WalletsProfilesProvider with ChangeNotifier {
|
||||||
WalletsProfilesProvider(this.pubkey);
|
WalletsProfilesProvider(this.pubkey);
|
||||||
|
|
||||||
String pubkey = '';
|
String? pubkey = '';
|
||||||
String pubkeyShort = '';
|
String pubkeyShort = '';
|
||||||
final TextEditingController outputPubkey = TextEditingController();
|
final TextEditingController outputPubkey = TextEditingController();
|
||||||
List transBC;
|
List? transBC;
|
||||||
String fetchMoreCursor;
|
String? fetchMoreCursor;
|
||||||
Map pageInfo;
|
Map? pageInfo;
|
||||||
bool isHistoryScreen = false;
|
bool isHistoryScreen = false;
|
||||||
String historySwitchButtun = "Voir l'historique";
|
String historySwitchButtun = "Voir l'historique";
|
||||||
String rawSvg;
|
String? rawSvg;
|
||||||
TextEditingController payAmount = TextEditingController();
|
TextEditingController payAmount = TextEditingController();
|
||||||
TextEditingController payComment = TextEditingController();
|
TextEditingController payComment = TextEditingController();
|
||||||
num balance;
|
num? balance;
|
||||||
int nRepositories = 20;
|
int nRepositories = 20;
|
||||||
int nPage = 1;
|
int nPage = 1;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
await Permission.camera.request();
|
await Permission.camera.request();
|
||||||
}
|
}
|
||||||
String barcode;
|
String? barcode;
|
||||||
try {
|
try {
|
||||||
barcode = await scanner.scan();
|
barcode = await scanner.scan();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -61,20 +61,20 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
|
|
||||||
Future<String> pay(BuildContext context, String pinCode) async {
|
Future<String> pay(BuildContext context, String pinCode) async {
|
||||||
MyWalletsProvider _myWalletModel = MyWalletsProvider();
|
MyWalletsProvider _myWalletModel = MyWalletsProvider();
|
||||||
int currentChest = configBox.get('currentChest');
|
int? currentChest = configBox.get('currentChest');
|
||||||
WalletData defaultWallet = _myWalletModel.getDefaultWallet(currentChest);
|
WalletData? defaultWallet = _myWalletModel.getDefaultWallet(currentChest);
|
||||||
|
|
||||||
String dewif = chestBox.get(currentChest).dewif;
|
String dewif = chestBox.get(currentChest)!.dewif!;
|
||||||
int derivation;
|
int? derivation;
|
||||||
|
|
||||||
if (chestBox.get(currentChest).isCesium) {
|
if (chestBox.get(currentChest)!.isCesium!) {
|
||||||
derivation = -1;
|
derivation = -1;
|
||||||
} else {
|
} else {
|
||||||
derivation = defaultWallet.derivation;
|
derivation = defaultWallet!.derivation;
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = await Gva(node: endPointGVA).pay(
|
String result = await Gva(node: endPointGVA!).pay(
|
||||||
recipient: pubkey,
|
recipient: pubkey!,
|
||||||
amount: double.parse(payAmount.text),
|
amount: double.parse(payAmount.text),
|
||||||
dewif: dewif,
|
dewif: dewif,
|
||||||
password: pinCode,
|
password: pinCode,
|
||||||
|
@ -147,7 +147,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
for (final trans in txs) {
|
for (final trans in txs) {
|
||||||
var direction = trans['direction'];
|
var direction = trans['direction'];
|
||||||
final transaction = trans['node'];
|
final transaction = trans['node'];
|
||||||
String output;
|
String? output;
|
||||||
if (direction == "RECEIVED") {
|
if (direction == "RECEIVED") {
|
||||||
for (String line in transaction['outputs']) {
|
for (String line in transaction['outputs']) {
|
||||||
if (line.contains(_pubkey)) {
|
if (line.contains(_pubkey)) {
|
||||||
|
@ -194,14 +194,14 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
return transBC;
|
return transBC;
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchMoreOptions checkQueryResult(result, opts, _pubkey) {
|
FetchMoreOptions? checkQueryResult(result, opts, _pubkey) {
|
||||||
final List<dynamic> blockchainTX =
|
final List<dynamic>? blockchainTX =
|
||||||
(result.data['txsHistoryBc']['both']['edges'] as List<dynamic>);
|
(result.data['txsHistoryBc']['both']['edges'] as List<dynamic>?);
|
||||||
// final List<dynamic> mempoolTX =
|
// final List<dynamic> mempoolTX =
|
||||||
// (result.data['txsHistoryMp']['receiving'] as List<dynamic>);
|
// (result.data['txsHistoryMp']['receiving'] as List<dynamic>);
|
||||||
|
|
||||||
pageInfo = result.data['txsHistoryBc']['both']['pageInfo'];
|
pageInfo = result.data['txsHistoryBc']['both']['pageInfo'];
|
||||||
fetchMoreCursor = pageInfo['endCursor'];
|
fetchMoreCursor = pageInfo!['endCursor'];
|
||||||
if (fetchMoreCursor == null) nPage = 1;
|
if (fetchMoreCursor == null) nPage = 1;
|
||||||
|
|
||||||
if (nPage == 1) {
|
if (nPage == 1) {
|
||||||
|
@ -216,9 +216,9 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
variables: {'cursor': fetchMoreCursor, 'number': nRepositories},
|
variables: {'cursor': fetchMoreCursor, 'number': nRepositories},
|
||||||
updateQuery: (previousResultData, fetchMoreResultData) {
|
updateQuery: (previousResultData, fetchMoreResultData) {
|
||||||
final List<dynamic> repos = [
|
final List<dynamic> repos = [
|
||||||
...previousResultData['txsHistoryBc']['both']['edges']
|
...previousResultData!['txsHistoryBc']['both']['edges']
|
||||||
as List<dynamic>,
|
as List<dynamic>,
|
||||||
...fetchMoreResultData['txsHistoryBc']['both']['edges']
|
...fetchMoreResultData!['txsHistoryBc']['both']['edges']
|
||||||
as List<dynamic>
|
as List<dynamic>
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
// return balance;
|
// return balance;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Future<num> getBalance(String _pubkey) async {
|
Future<num?> getBalance(String? _pubkey) async {
|
||||||
while (balance == null) {
|
while (balance == null) {
|
||||||
await Future.delayed(const Duration(milliseconds: 50));
|
await Future.delayed(const Duration(milliseconds: 50));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ import 'package:flutter/material.dart';
|
||||||
class AvatarFullscreen extends StatelessWidget {
|
class AvatarFullscreen extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
|
|
||||||
AvatarFullscreen(this.avatar, {this.title, this.color, Key key})
|
AvatarFullscreen(this.avatar, {this.title, this.color, Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final Image avatar;
|
final Image? avatar;
|
||||||
final String title;
|
final String? title;
|
||||||
final Color color;
|
final Color? color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -43,8 +43,8 @@ class AvatarFullscreen extends StatelessWidget {
|
||||||
// height: MediaQuery.of(context).size.height,
|
// height: MediaQuery.of(context).size.height,
|
||||||
// width: MediaQuery.of(context).size.width,
|
// width: MediaQuery.of(context).size.width,
|
||||||
child: Image(
|
child: Image(
|
||||||
image: avatar.image,
|
image: avatar!.image,
|
||||||
height: avatar.height,
|
height: avatar!.height,
|
||||||
fit: BoxFit.fitWidth),
|
fit: BoxFit.fitWidth),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CommonElements {
|
||||||
return const Text('Coucou');
|
return const Text('Coucou');
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bubbleSpeak(String text, {double long, Key textKey}) {
|
Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
|
||||||
return Bubble(
|
return Bubble(
|
||||||
padding: long == null
|
padding: long == null
|
||||||
? const BubbleEdges.all(18)
|
? const BubbleEdges.all(18)
|
||||||
|
@ -26,7 +26,7 @@ class CommonElements {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) {
|
Widget bubbleSpeakRich(List<TextSpan> text, {Key? textKey}) {
|
||||||
return Bubble(
|
return Bubble(
|
||||||
padding: const BubbleEdges.all(18),
|
padding: const BubbleEdges.all(18),
|
||||||
elevation: 5,
|
elevation: 5,
|
||||||
|
@ -130,7 +130,7 @@ class CommonElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SmoothTransition extends PageRouteBuilder {
|
class SmoothTransition extends PageRouteBuilder {
|
||||||
final Widget page;
|
final Widget? page;
|
||||||
SmoothTransition({this.page})
|
SmoothTransition({this.page})
|
||||||
: super(
|
: super(
|
||||||
pageBuilder: (
|
pageBuilder: (
|
||||||
|
@ -141,8 +141,8 @@ class SmoothTransition extends PageRouteBuilder {
|
||||||
TweenAnimationBuilder(
|
TweenAnimationBuilder(
|
||||||
duration: const Duration(seconds: 5),
|
duration: const Duration(seconds: 5),
|
||||||
tween: Tween(begin: 200, end: 200),
|
tween: Tween(begin: 200, end: 200),
|
||||||
builder: (BuildContext context, dynamic value, Widget child) {
|
builder: (BuildContext context, dynamic value, Widget? child) {
|
||||||
return page;
|
return page!;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -152,7 +152,7 @@ class FaderTransition extends PageRouteBuilder {
|
||||||
final Widget page;
|
final Widget page;
|
||||||
final bool isFast;
|
final bool isFast;
|
||||||
|
|
||||||
FaderTransition({@required this.page, @required this.isFast})
|
FaderTransition({required this.page, required this.isFast})
|
||||||
: super(
|
: super(
|
||||||
pageBuilder: (
|
pageBuilder: (
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
|
@ -175,7 +175,7 @@ class FaderTransition extends PageRouteBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SlideLeftRoute extends PageRouteBuilder {
|
class SlideLeftRoute extends PageRouteBuilder {
|
||||||
final Widget page;
|
final Widget? page;
|
||||||
SlideLeftRoute({this.page})
|
SlideLeftRoute({this.page})
|
||||||
: super(
|
: super(
|
||||||
pageBuilder: (
|
pageBuilder: (
|
||||||
|
@ -183,7 +183,7 @@ class SlideLeftRoute extends PageRouteBuilder {
|
||||||
Animation<double> animation,
|
Animation<double> animation,
|
||||||
Animation<double> secondaryAnimation,
|
Animation<double> secondaryAnimation,
|
||||||
) =>
|
) =>
|
||||||
page,
|
page!,
|
||||||
transitionsBuilder: (
|
transitionsBuilder: (
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Animation<double> animation,
|
Animation<double> animation,
|
||||||
|
@ -207,7 +207,7 @@ class GeckoSpeechAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||||
|
|
||||||
GeckoSpeechAppBar(
|
GeckoSpeechAppBar(
|
||||||
this.title, {
|
this.title, {
|
||||||
Key key,
|
Key? key,
|
||||||
}) : preferredSize = const Size.fromHeight(105.4),
|
}) : preferredSize = const Size.fromHeight(105.4),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,16 @@ import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
HistoryScreen({@required this.pubkey, this.avatar, this.username, Key key})
|
HistoryScreen({required this.pubkey, this.avatar, this.username, Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
final double avatarsSize = 80;
|
final double avatarsSize = 80;
|
||||||
final String pubkey;
|
final String? pubkey;
|
||||||
final String username;
|
final String? username;
|
||||||
final Image avatar;
|
final Image? avatar;
|
||||||
|
|
||||||
FetchMore fetchMore;
|
FetchMore? fetchMore;
|
||||||
FetchMoreOptions opts;
|
FetchMoreOptions? opts;
|
||||||
|
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
log.i('Build pubkey : ' + pubkey);
|
log.i('Build pubkey : ' + pubkey!);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
WidgetsBinding.instance!.addPostFrameCallback((_) {});
|
||||||
|
|
||||||
_historyProvider.balance = _historyProvider.transBC = null;
|
_historyProvider.balance = _historyProvider.transBC = null;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||||
if (result.isLoading && result?.data == null) {
|
if (result.isLoading && result.data == null) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
);
|
);
|
||||||
|
@ -87,7 +87,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
style: TextStyle(fontSize: 18),
|
style: TextStyle(fontSize: 18),
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
} else if (result?.data == null) {
|
} else if (result.data == null) {
|
||||||
return Column(children: const <Widget>[
|
return Column(children: const <Widget>[
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
Text(
|
Text(
|
||||||
|
@ -97,11 +97,11 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result?.data['balance'] == null) {
|
if (result.data!['balance'] == null) {
|
||||||
_historyProvider.balance = 0.0;
|
_historyProvider.balance = 0.0;
|
||||||
} else {
|
} else {
|
||||||
_historyProvider.balance = _historyProvider
|
_historyProvider.balance = _historyProvider
|
||||||
.removeDecimalZero(result.data['balance']['amount'] / 100);
|
.removeDecimalZero(result.data!['balance']['amount'] / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.isNotLoading) {
|
if (result.isNotLoading) {
|
||||||
|
@ -120,13 +120,13 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onNotification: (t) {
|
onNotification: (dynamic t) {
|
||||||
if (t is ScrollEndNotification &&
|
if (t is ScrollEndNotification &&
|
||||||
scrollController.position.pixels >=
|
scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent * 0.7 &&
|
scrollController.position.maxScrollExtent * 0.7 &&
|
||||||
_historyProvider.pageInfo['hasPreviousPage'] &&
|
_historyProvider.pageInfo!['hasPreviousPage'] &&
|
||||||
result.isNotLoading) {
|
result.isNotLoading) {
|
||||||
fetchMore(opts);
|
fetchMore!(opts!);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -151,14 +151,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
: Column(children: <Widget>[
|
: Column(children: <Widget>[
|
||||||
getTransactionTile(context, _historyProvider),
|
getTransactionTile(context, _historyProvider),
|
||||||
if (result.isLoading &&
|
if (result.isLoading &&
|
||||||
_historyProvider.pageInfo['hasPreviousPage'])
|
_historyProvider.pageInfo!['hasPreviousPage'])
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
CircularProgressIndicator(),
|
CircularProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!_historyProvider.pageInfo['hasPreviousPage'])
|
if (!_historyProvider.pageInfo!['hasPreviousPage'])
|
||||||
Column(
|
Column(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
|
@ -176,8 +176,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
String dateDelimiter;
|
String? dateDelimiter;
|
||||||
String lastDateDelimiter;
|
String? lastDateDelimiter;
|
||||||
const double _avatarSize = 200;
|
const double _avatarSize = 200;
|
||||||
|
|
||||||
bool isTody = false;
|
bool isTody = false;
|
||||||
|
@ -200,15 +200,15 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
};
|
};
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: _historyProvider.transBC.map((repository) {
|
children: _historyProvider.transBC!.map((repository) {
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
DateTime date = DateTime.fromMillisecondsSinceEpoch(repository[0] * 1000);
|
DateTime date = DateTime.fromMillisecondsSinceEpoch(repository[0] * 1000);
|
||||||
|
|
||||||
String dateForm;
|
String dateForm;
|
||||||
if ({4, 10, 11, 12}.contains(date.month)) {
|
if ({4, 10, 11, 12}.contains(date.month)) {
|
||||||
dateForm = "${date.day} ${monthsInYear[date.month].substring(0, 3)}.";
|
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 3)}.";
|
||||||
} else if ({1, 2, 7, 9}.contains(date.month)) {
|
} else if ({1, 2, 7, 9}.contains(date.month)) {
|
||||||
dateForm = "${date.day} ${monthsInYear[date.month].substring(0, 4)}.";
|
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 4)}.";
|
||||||
} else {
|
} else {
|
||||||
dateForm = "${date.day} ${monthsInYear[date.month]}";
|
dateForm = "${date.day} ${monthsInYear[date.month]}";
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 30),
|
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||||
child: Text(
|
child: Text(
|
||||||
dateDelimiter,
|
dateDelimiter!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 23, color: orangeC, fontWeight: FontWeight.w300),
|
fontSize: 23, color: orangeC, fontWeight: FontWeight.w300),
|
||||||
),
|
),
|
||||||
|
@ -276,7 +276,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
future: _cesiumPlusProvider.getAvatar(
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
repository[2], _avatarSize),
|
repository[2], _avatarSize),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<Image> _avatar) {
|
AsyncSnapshot<Image?> _avatar) {
|
||||||
if (_avatar.connectionState !=
|
if (_avatar.connectionState !=
|
||||||
ConnectionState.done ||
|
ConnectionState.done ||
|
||||||
_avatar.hasError) {
|
_avatar.hasError) {
|
||||||
|
@ -295,11 +295,11 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (_avatar.hasData) {
|
if (_avatar.hasData) {
|
||||||
g1WalletsBox.get(repository[2]).avatar =
|
g1WalletsBox.get(repository[2])!.avatar =
|
||||||
_avatar?.data;
|
_avatar.data;
|
||||||
return ClipOval(child: _avatar?.data);
|
return ClipOval(child: _avatar.data);
|
||||||
} else {
|
} else {
|
||||||
g1WalletsBox.get(repository[2]).avatar =
|
g1WalletsBox.get(repository[2])!.avatar =
|
||||||
_cesiumPlusProvider
|
_cesiumPlusProvider
|
||||||
.defaultAvatar(repository[2]);
|
.defaultAvatar(repository[2]);
|
||||||
return _cesiumPlusProvider
|
return _cesiumPlusProvider
|
||||||
|
@ -308,7 +308,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
})
|
})
|
||||||
: ClipOval(
|
: ClipOval(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: g1WalletsBox.get(repository[2]).avatar.image,
|
image: g1WalletsBox.get(repository[2])!.avatar!.image,
|
||||||
height: _avatarSize,
|
height: _avatarSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -407,7 +407,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
_historyProvider.snackCopyKey(context);
|
_historyProvider.snackCopyKey(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
_historyProvider.getShortPubkey(pubkey),
|
_historyProvider.getShortPubkey(pubkey!),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
|
@ -425,17 +425,17 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
builder: (QueryResult result,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
if (result.isLoading || result.hasException) {
|
if (result.isLoading || result.hasException) {
|
||||||
return const Text('...');
|
return const Text('...');
|
||||||
} else if (result?.data['idty'] == null ||
|
} else if (result.data!['idty'] == null ||
|
||||||
result?.data['idty']['username'] == null) {
|
result.data!['idty']['username'] == null) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
result?.data['idty']['username'] ?? '',
|
result.data!['idty']['username'] ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -449,7 +449,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
username,
|
username!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -461,13 +461,13 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _historyProvider.getBalance(pubkey),
|
future: _historyProvider.getBalance(pubkey),
|
||||||
builder:
|
builder:
|
||||||
(BuildContext context, AsyncSnapshot<num> _balance) {
|
(BuildContext context, AsyncSnapshot<num?> _balance) {
|
||||||
if (_balance.connectionState != ConnectionState.done ||
|
if (_balance.connectionState != ConnectionState.done ||
|
||||||
_balance.hasError) {
|
_balance.hasError) {
|
||||||
return const Text('...');
|
return const Text('...');
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
"${_balance?.data.toString()} Ğ1",
|
"${_balance.data.toString()} Ğ1",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 22, fontWeight: FontWeight.w500),
|
fontSize: 22, fontWeight: FontWeight.w500),
|
||||||
|
@ -481,7 +481,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
||||||
builder:
|
builder:
|
||||||
(BuildContext context, AsyncSnapshot<Image> _avatar) {
|
(BuildContext context, AsyncSnapshot<Image?> _avatar) {
|
||||||
if (_avatar.connectionState != ConnectionState.done) {
|
if (_avatar.connectionState != ConnectionState.done) {
|
||||||
return Stack(children: [
|
return Stack(children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
|
@ -507,13 +507,13 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return AvatarFullscreen(_avatar?.data);
|
return AvatarFullscreen(_avatar.data);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: _avatar?.data?.image,
|
image: _avatar.data!.image,
|
||||||
height: _avatarSize,
|
height: _avatarSize,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
@ -537,7 +537,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: avatar.image,
|
image: avatar!.image,
|
||||||
height: _avatarSize,
|
height: _avatarSize,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
|
|
@ -15,7 +15,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatelessWidget {
|
class HomeScreen extends StatelessWidget {
|
||||||
const HomeScreen({Key key}) : super(key: key);
|
const HomeScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -84,7 +84,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (ctx) => StatefulWrapper(
|
builder: (ctx) => StatefulWrapper(
|
||||||
onInit: () {
|
onInit: () {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||||
if (isWalletsExists) homeClass.snackNode(ctx);
|
if (isWalletsExists) homeClass.snackNode(ctx);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -254,7 +254,7 @@ Widget geckHome(context) {
|
||||||
image: AssetImage('assets/home/wallet.png'),
|
image: AssetImage('assets/home/wallet.png'),
|
||||||
height: 75)),
|
height: 75)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
WalletData defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(
|
_myWalletProvider.getDefaultWallet(
|
||||||
configBox.get('currentChest'));
|
configBox.get('currentChest'));
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -513,7 +513,7 @@ Widget welcomeHome(context) {
|
||||||
class StatefulWrapper extends StatefulWidget {
|
class StatefulWrapper extends StatefulWidget {
|
||||||
final Function onInit;
|
final Function onInit;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
const StatefulWrapper({Key key, @required this.onInit, @required this.child})
|
const StatefulWrapper({Key? key, required this.onInit, required this.child})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
_StatefulWrapperState createState() => _StatefulWrapperState();
|
_StatefulWrapperState createState() => _StatefulWrapperState();
|
||||||
|
@ -522,9 +522,7 @@ class StatefulWrapper extends StatefulWidget {
|
||||||
class _StatefulWrapperState extends State<StatefulWrapper> {
|
class _StatefulWrapperState extends State<StatefulWrapper> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
if (widget.onInit != null) {
|
widget.onInit();
|
||||||
widget.onInit();
|
|
||||||
}
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +532,7 @@ class _StatefulWrapperState extends State<StatefulWrapper> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bubbleSpeak(String text, {double long, Key textKey}) {
|
Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
|
||||||
return Bubble(
|
return Bubble(
|
||||||
padding: long == null
|
padding: long == null
|
||||||
? const BubbleEdges.all(20)
|
? const BubbleEdges.all(20)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -20,7 +21,7 @@ bool _isNewNameValid = false;
|
||||||
|
|
||||||
class CesiumWalletOptions extends StatelessWidget {
|
class CesiumWalletOptions extends StatelessWidget {
|
||||||
const CesiumWalletOptions(
|
const CesiumWalletOptions(
|
||||||
{Key key, Key keyMyWallets, @required this.cesiumWallet})
|
{Key? key, Key? keyMyWallets, required this.cesiumWallet})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final ChestData cesiumWallet;
|
final ChestData cesiumWallet;
|
||||||
|
@ -40,9 +41,8 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
final String shortPubkey =
|
final String shortPubkey =
|
||||||
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
|
||||||
|
|
||||||
if (_walletOptions.nameController.text == null ||
|
if (_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;
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,8 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
const SizedBox(width: 25),
|
const SizedBox(width: 25),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File newAvatar = await _walletOptions.changeAvatar();
|
File newAvatar = await (_walletOptions.changeAvatar() as FutureOr<File>);
|
||||||
if (newAvatar != null) {
|
|
||||||
cesiumWallet.imageFile = newAvatar;
|
cesiumWallet.imageFile = newAvatar;
|
||||||
}
|
|
||||||
_walletOptions.reloadBuild();
|
_walletOptions.reloadBuild();
|
||||||
},
|
},
|
||||||
child: cesiumWallet.imageFile == null
|
child: cesiumWallet.imageFile == null
|
||||||
|
@ -117,14 +115,12 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
'assets/chests/${cesiumWallet.imageName}',
|
'assets/chests/${cesiumWallet.imageName}',
|
||||||
width: 110,
|
width: 110,
|
||||||
)
|
)
|
||||||
: Image.file(cesiumWallet.imageFile, width: 110),
|
: Image.file(cesiumWallet.imageFile!, width: 110),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File newAvatar = await _walletOptions.changeAvatar();
|
File newAvatar = await (_walletOptions.changeAvatar() as FutureOr<File>);
|
||||||
if (newAvatar != null) {
|
|
||||||
cesiumWallet.imageFile = newAvatar;
|
cesiumWallet.imageFile = newAvatar;
|
||||||
}
|
|
||||||
_walletOptions.reloadBuild();
|
_walletOptions.reloadBuild();
|
||||||
},
|
},
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
|
@ -170,7 +166,7 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
// pollInterval: Duration(seconds: 1),
|
// pollInterval: Duration(seconds: 1),
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
builder: (QueryResult result,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
if (result.hasException) {
|
if (result.hasException) {
|
||||||
return Text(result.exception.toString());
|
return Text(result.exception.toString());
|
||||||
}
|
}
|
||||||
|
@ -181,13 +177,13 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
// List repositories = result.data['viewer']['repositories']['nodes'];
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
String wBalanceUD;
|
String wBalanceUD;
|
||||||
if (result.data['balance'] == null) {
|
if (result.data!['balance'] == null) {
|
||||||
wBalanceUD = '0.0';
|
wBalanceUD = '0.0';
|
||||||
} else {
|
} else {
|
||||||
int wBalanceG1 =
|
int wBalanceG1 =
|
||||||
result.data['balance']['amount'];
|
result.data!['balance']['amount'];
|
||||||
int currentUD =
|
int currentUD =
|
||||||
result.data['currentUd']['amount'];
|
result.data!['currentUd']['amount'];
|
||||||
double wBalanceUDBrut =
|
double wBalanceUDBrut =
|
||||||
wBalanceG1 / currentUD; // .toString();
|
wBalanceG1 / currentUD; // .toString();
|
||||||
wBalanceUD = double.parse(
|
wBalanceUD = double.parse(
|
||||||
|
@ -357,7 +353,7 @@ class CesiumWalletOptions extends StatelessWidget {
|
||||||
key: const Key('changePin'),
|
key: const Key('changePin'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// await _chestProvider.changePin(context, cesiumWallet);
|
// await _chestProvider.changePin(context, cesiumWallet);
|
||||||
String newPin = await Navigator.push(
|
String? newPin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
|
@ -10,13 +10,13 @@ import 'package:provider/provider.dart';
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
ChangePinScreen(
|
ChangePinScreen(
|
||||||
{Key keyMyWallets,
|
{Key? keyMyWallets,
|
||||||
@required this.walletName,
|
required this.walletName,
|
||||||
@required this.walletProvider})
|
required this.walletProvider})
|
||||||
: super(key: keyMyWallets);
|
: super(key: keyMyWallets);
|
||||||
final String walletName;
|
final String? walletName;
|
||||||
final MyWalletsProvider walletProvider;
|
final MyWalletsProvider walletProvider;
|
||||||
Directory appPath;
|
Directory? appPath;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -41,7 +41,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(walletName),
|
child: Text(walletName!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
|
@ -98,7 +98,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
NewWallet _newWalletFile = _changePin.changePin(
|
NewWallet _newWalletFile = _changePin.changePin(
|
||||||
walletProvider.pinCode,
|
walletProvider.pinCode,
|
||||||
newCustomPin: _changePin.newPin.text);
|
newCustomPin: _changePin.newPin.text)!;
|
||||||
_changePin.newPin.text = '';
|
_changePin.newPin.text = '';
|
||||||
_changePin.storeNewPinChest(context, _newWalletFile);
|
_changePin.storeNewPinChest(context, _newWalletFile);
|
||||||
walletProvider.pinCode = _changePin.newPin.text;
|
walletProvider.pinCode = _changePin.newPin.text;
|
||||||
|
@ -120,7 +120,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
class StatefulWrapper extends StatefulWidget {
|
class StatefulWrapper extends StatefulWidget {
|
||||||
final Function onInit;
|
final Function onInit;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
const StatefulWrapper({Key key, @required this.onInit, @required this.child})
|
const StatefulWrapper({Key? key, required this.onInit, required this.child})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
_StatefulWrapperState createState() => _StatefulWrapperState();
|
_StatefulWrapperState createState() => _StatefulWrapperState();
|
||||||
|
@ -129,9 +129,7 @@ class StatefulWrapper extends StatefulWidget {
|
||||||
class _StatefulWrapperState extends State<StatefulWrapper> {
|
class _StatefulWrapperState extends State<StatefulWrapper> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
if (widget.onInit != null) {
|
widget.onInit();
|
||||||
widget.onInit();
|
|
||||||
}
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:gecko/screens/myWallets/change_pin.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ChestOptions extends StatelessWidget {
|
class ChestOptions extends StatelessWidget {
|
||||||
const ChestOptions({Key keyMyWallets, @required this.walletProvider})
|
const ChestOptions({Key? keyMyWallets, required this.walletProvider})
|
||||||
: super(key: keyMyWallets);
|
: super(key: keyMyWallets);
|
||||||
final MyWalletsProvider walletProvider;
|
final MyWalletsProvider walletProvider;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
ChestProvider _chestProvider =
|
ChestProvider _chestProvider =
|
||||||
Provider.of<ChestProvider>(context, listen: false);
|
Provider.of<ChestProvider>(context, listen: false);
|
||||||
|
|
||||||
ChestData currentChest = chestBox.get(configBox.get('currentChest'));
|
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
|
@ -34,7 +34,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(currentChest.name),
|
child: Text(currentChest.name!),
|
||||||
)),
|
)),
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
|
@ -44,7 +44,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
key: const Key('changePin'),
|
key: const Key('changePin'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// await _chestProvider.changePin(context, cesiumWallet);
|
// await _chestProvider.changePin(context, cesiumWallet);
|
||||||
String pinResult = await Navigator.push(
|
String? pinResult = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ChooseChest extends StatefulWidget {
|
class ChooseChest extends StatefulWidget {
|
||||||
const ChooseChest({this.action, Key key}) : super(key: key);
|
const ChooseChest({this.action, Key? key}) : super(key: key);
|
||||||
final String action;
|
final String? action;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
|
@ -22,7 +22,7 @@ class ChooseChest extends StatefulWidget {
|
||||||
class _ChooseChestState extends State<ChooseChest> {
|
class _ChooseChestState extends State<ChooseChest> {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
CarouselController buttonCarouselController = CarouselController();
|
CarouselController buttonCarouselController = CarouselController();
|
||||||
int currentChest = configBox.get('currentChest');
|
int? currentChest = configBox.get('currentChest');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -51,7 +51,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
enableInfiniteScroll: false,
|
enableInfiniteScroll: false,
|
||||||
initialPage: currentChest,
|
initialPage: currentChest!,
|
||||||
enlargeCenterPage: true,
|
enlargeCenterPage: true,
|
||||||
viewportFraction: 0.6,
|
viewportFraction: 0.6,
|
||||||
),
|
),
|
||||||
|
@ -65,12 +65,12 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
height: 150,
|
height: 150,
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(
|
||||||
i.value.imageFile,
|
i.value.imageFile!,
|
||||||
height: 150,
|
height: 150,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Text(
|
Text(
|
||||||
i.value.name,
|
i.value.name!,
|
||||||
style: const TextStyle(fontSize: 21),
|
style: const TextStyle(fontSize: 21),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
@ -113,7 +113,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
configBox.put('currentChest', currentChest);
|
configBox.put('currentChest', currentChest);
|
||||||
WalletData defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(currentChest);
|
_myWalletProvider.getDefaultWallet(currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
Navigator.pushAndRemoveUntil(
|
Navigator.pushAndRemoveUntil(
|
||||||
|
|
|
@ -11,13 +11,13 @@ import 'package:provider/provider.dart';
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
ConfirmStoreWallet({
|
ConfirmStoreWallet({
|
||||||
Key validationKey,
|
Key? validationKey,
|
||||||
@required this.generatedMnemonic,
|
required this.generatedMnemonic,
|
||||||
@required this.generatedWallet,
|
required this.generatedWallet,
|
||||||
}) : super(key: validationKey);
|
}) : super(key: validationKey);
|
||||||
|
|
||||||
String generatedMnemonic;
|
String? generatedMnemonic;
|
||||||
NewWallet generatedWallet;
|
NewWallet? generatedWallet;
|
||||||
|
|
||||||
final TextEditingController _mnemonicController = TextEditingController();
|
final TextEditingController _mnemonicController = TextEditingController();
|
||||||
final TextEditingController _inputRestoreWord = TextEditingController();
|
final TextEditingController _inputRestoreWord = TextEditingController();
|
||||||
|
@ -31,9 +31,9 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
_mnemonicController.text = generatedMnemonic;
|
_mnemonicController.text = generatedMnemonic!;
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_generateWalletProvider.isAskedWordValid = false;
|
_generateWalletProvider.isAskedWordValid = false;
|
||||||
|
@ -135,7 +135,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
walletName.text != '')
|
walletName.text != '')
|
||||||
? () async {
|
? () async {
|
||||||
_generateWalletProvider.storeHDWChest(
|
_generateWalletProvider.storeHDWChest(
|
||||||
generatedWallet,
|
generatedWallet!,
|
||||||
walletName.text,
|
walletName.text,
|
||||||
context);
|
context);
|
||||||
_generateWalletProvider.isAskedWordValid =
|
_generateWalletProvider.isAskedWordValid =
|
||||||
|
|
|
@ -10,7 +10,7 @@ import 'package:super_tooltip/super_tooltip.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class GenerateFastChestScreen extends StatelessWidget {
|
class GenerateFastChestScreen extends StatelessWidget {
|
||||||
SuperTooltip tooltip;
|
SuperTooltip? tooltip;
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
String validPin = 'NO PIN';
|
String validPin = 'NO PIN';
|
||||||
String currentText = "";
|
String currentText = "";
|
||||||
|
@ -19,7 +19,7 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
final GlobalKey _toolTipSentence = GlobalKey();
|
final GlobalKey _toolTipSentence = GlobalKey();
|
||||||
final GlobalKey _toolTipSecret = GlobalKey();
|
final GlobalKey _toolTipSecret = GlobalKey();
|
||||||
|
|
||||||
GenerateFastChestScreen({Key key}) : super(key: key);
|
GenerateFastChestScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -30,7 +30,7 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
if (_generateWalletProvider.mnemonicController.text == '') {
|
if (_generateWalletProvider.mnemonicController.text == '') {
|
||||||
_generateWalletProvider.generateWordList();
|
_generateWalletProvider.generateWordList();
|
||||||
_generateWalletProvider.mnemonicController.text =
|
_generateWalletProvider.mnemonicController.text =
|
||||||
_generateWalletProvider.generatedMnemonic;
|
_generateWalletProvider.generatedMnemonic!;
|
||||||
_generateWalletProvider.pin.text = randomSecretCode(5);
|
_generateWalletProvider.pin.text = randomSecretCode(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_generateWalletProvider.generateWordList();
|
_generateWalletProvider.generateWordList();
|
||||||
_generateWalletProvider.mnemonicController.text =
|
_generateWalletProvider.mnemonicController.text =
|
||||||
_generateWalletProvider.generatedMnemonic;
|
_generateWalletProvider.generatedMnemonic!;
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40.0,
|
height: 40.0,
|
||||||
|
@ -118,7 +118,7 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
_generateWalletProvider.actualWallet = Dewif()
|
_generateWalletProvider.actualWallet = Dewif()
|
||||||
.generateDewif(
|
.generateDewif(
|
||||||
_generateWalletProvider
|
_generateWalletProvider
|
||||||
.generatedMnemonic,
|
.generatedMnemonic!,
|
||||||
_generateWalletProvider.pin.text,
|
_generateWalletProvider.pin.text,
|
||||||
lang: 'french');
|
lang: 'french');
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
|
@ -189,9 +189,9 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class PrintWallet extends StatelessWidget {
|
class PrintWallet extends StatelessWidget {
|
||||||
const PrintWallet(this.sentence, {Key key}) : super(key: key);
|
const PrintWallet(this.sentence, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
final String sentence;
|
final String? sentence;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,13 +11,13 @@ import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ImportWalletScreen extends StatelessWidget {
|
class ImportWalletScreen extends StatelessWidget {
|
||||||
const ImportWalletScreen({Key key}) : super(key: key);
|
const ImportWalletScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GlobalKey _toolTipSecret = GlobalKey();
|
GlobalKey _toolTipSecret = GlobalKey();
|
||||||
Timer _debounce;
|
Timer? _debounce;
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
|
@ -54,7 +54,7 @@ class ImportWalletScreen extends StatelessWidget {
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
if (_debounce?.isActive ?? false) {
|
if (_debounce?.isActive ?? false) {
|
||||||
_debounce.cancel();
|
_debounce!.cancel();
|
||||||
}
|
}
|
||||||
_debounce = Timer(const Duration(milliseconds: 600), () {
|
_debounce = Timer(const Duration(milliseconds: 600), () {
|
||||||
walletProvider
|
walletProvider
|
||||||
|
@ -92,7 +92,7 @@ class ImportWalletScreen extends StatelessWidget {
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
if (_debounce?.isActive ?? false) {
|
if (_debounce?.isActive ?? false) {
|
||||||
_debounce.cancel();
|
_debounce!.cancel();
|
||||||
}
|
}
|
||||||
_debounce = Timer(const Duration(milliseconds: 600), () {
|
_debounce = Timer(const Duration(milliseconds: 600), () {
|
||||||
walletProvider
|
walletProvider
|
||||||
|
|
|
@ -10,7 +10,7 @@ import 'package:provider/provider.dart';
|
||||||
// import 'package:provider/provider.dart';
|
// import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class RestoreChest extends StatelessWidget {
|
class RestoreChest extends StatelessWidget {
|
||||||
const RestoreChest({Key key}) : super(key: key);
|
const RestoreChest({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -160,7 +160,7 @@ class RestoreChest extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> badMnemonicPopup(BuildContext context) async {
|
Future<bool?> badMnemonicPopup(BuildContext context) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
|
|
|
@ -15,17 +15,17 @@ import 'package:gecko/globals.dart';
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class UnlockingWallet extends StatelessWidget {
|
class UnlockingWallet extends StatelessWidget {
|
||||||
UnlockingWallet(
|
UnlockingWallet(
|
||||||
{Key keyUnlockWallet, @required this.wallet, @required this.action})
|
{Key? keyUnlockWallet, required this.wallet, required this.action})
|
||||||
: super(key: keyUnlockWallet);
|
: super(key: keyUnlockWallet);
|
||||||
WalletData wallet;
|
WalletData? wallet;
|
||||||
String action;
|
String action;
|
||||||
|
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType> errorController;
|
StreamController<ErrorAnimationType>? errorController;
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
var pinColor = const Color(0xffF9F9F1);
|
Color? pinColor = const Color(0xffF9F9F1);
|
||||||
var walletPin = '';
|
var walletPin = '';
|
||||||
String resultPay;
|
String? resultPay;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -35,13 +35,13 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||||
|
|
||||||
int _pinLenght;
|
int _pinLenght;
|
||||||
ChestData currentChest = chestBox.get(configBox.get('currentChest'));
|
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
||||||
|
|
||||||
if (currentChest.isCesium) {
|
if (currentChest.isCesium!) {
|
||||||
_pinLenght = _walletOptions.getPinLenght(currentChest.dewif);
|
_pinLenght = _walletOptions.getPinLenght(currentChest.dewif);
|
||||||
wallet = WalletData(derivation: -1, chest: currentChest.key);
|
wallet = WalletData(derivation: -1, chest: currentChest.key);
|
||||||
} else {
|
} else {
|
||||||
_pinLenght = _walletOptions.getPinLenght(wallet.number);
|
_pinLenght = _walletOptions.getPinLenght(wallet!.number);
|
||||||
}
|
}
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
width: isTall ? 130 : 100,
|
width: isTall ? 130 : 100,
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(
|
||||||
currentChest.imageFile,
|
currentChest.imageFile!,
|
||||||
width: isTall ? 130 : 100,
|
width: isTall ? 130 : 100,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 250,
|
width: 250,
|
||||||
child: Text(
|
child: Text(
|
||||||
currentChest.name,
|
currentChest.name!,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
|
@ -165,7 +165,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.fade,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v.length < _pinLenght) {
|
if (v!.length < _pinLenght) {
|
||||||
return "Votre code PIN fait $_pinLenght caractères";
|
return "Votre code PIN fait $_pinLenght caractères";
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -198,8 +198,8 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (_pin) async {
|
||||||
log.d("Completed");
|
log.d("Completed");
|
||||||
_myWalletProvider.pinCode = _pin;
|
_myWalletProvider.pinCode = _pin;
|
||||||
final String resultWallet = _walletOptions.readLocalWallet(
|
final String? resultWallet = _walletOptions.readLocalWallet(
|
||||||
context, wallet, _pin.toUpperCase(), _pinLenght);
|
context, wallet!, _pin.toUpperCase(), _pinLenght);
|
||||||
// _myWalletProvider.pinCode = _pin.toUpperCase();
|
// _myWalletProvider.pinCode = _pin.toUpperCase();
|
||||||
_myWalletProvider.pinLenght = _pinLenght;
|
_myWalletProvider.pinLenght = _pinLenght;
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
// await Future.delayed(Duration(milliseconds: 50));
|
// await Future.delayed(Duration(milliseconds: 50));
|
||||||
if (action == "mywallets") {
|
if (action == "mywallets") {
|
||||||
currentChest.isCesium
|
currentChest.isCesium!
|
||||||
? Navigator.push(
|
? Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
@ -222,7 +222,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
: Navigator.pushNamed(
|
: Navigator.pushNamed(
|
||||||
formKey.currentContext, '/mywallets');
|
formKey.currentContext!, '/mywallets');
|
||||||
} else if (action == "pay") {
|
} else if (action == "pay") {
|
||||||
resultPay =
|
resultPay =
|
||||||
await _historyProvider.pay(context, _pin.toUpperCase());
|
await _historyProvider.pay(context, _pin.toUpperCase());
|
||||||
|
@ -239,7 +239,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _paymentsResult(context) {
|
Future<bool?> _paymentsResult(context) {
|
||||||
if (resultPay != "success") log.i(resultPay);
|
if (resultPay != "success") log.i(resultPay);
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -15,7 +16,7 @@ import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class WalletOptions extends StatelessWidget {
|
class WalletOptions extends StatelessWidget {
|
||||||
WalletOptions({Key keyMyWallets, @required this.wallet})
|
WalletOptions({Key? keyMyWallets, required this.wallet})
|
||||||
: super(key: keyMyWallets);
|
: super(key: keyMyWallets);
|
||||||
WalletData wallet;
|
WalletData wallet;
|
||||||
int _nbrLinesName = 1;
|
int _nbrLinesName = 1;
|
||||||
|
@ -33,13 +34,12 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
log.d(_walletOptions.pubkey.text);
|
log.d(_walletOptions.pubkey.text);
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
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 (_isNewNameValid == false) {
|
||||||
_isNewNameValid == false) {
|
_walletOptions.nameController.text = wallet.name!;
|
||||||
_walletOptions.nameController.text = wallet.name;
|
|
||||||
} else {
|
} else {
|
||||||
wallet.name = _walletOptions.nameController.text;
|
wallet.name = _walletOptions.nameController.text;
|
||||||
}
|
}
|
||||||
|
@ -52,11 +52,11 @@ class WalletOptions extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData defaultWallet =
|
WalletData defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(_currentChest);
|
_myWalletProvider.getDefaultWallet(_currentChest)!;
|
||||||
|
|
||||||
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
||||||
|
|
||||||
int currentChest = _myWalletProvider.getCurrentChest();
|
int? currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
log.d("Wallet options: $currentChest:${wallet.number}");
|
log.d("Wallet options: $currentChest:${wallet.number}");
|
||||||
|
|
||||||
|
@ -116,10 +116,8 @@ class WalletOptions extends StatelessWidget {
|
||||||
const SizedBox(width: 25),
|
const SizedBox(width: 25),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File newAvatar = await walletProvider.changeAvatar();
|
File newAvatar = await (walletProvider.changeAvatar() as FutureOr<File>);
|
||||||
if (newAvatar != null) {
|
|
||||||
wallet.imageFile = newAvatar;
|
wallet.imageFile = newAvatar;
|
||||||
}
|
|
||||||
walletProvider.reloadBuild();
|
walletProvider.reloadBuild();
|
||||||
},
|
},
|
||||||
child: wallet.imageFile == null
|
child: wallet.imageFile == null
|
||||||
|
@ -128,16 +126,14 @@ class WalletOptions extends StatelessWidget {
|
||||||
width: 110,
|
width: 110,
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(
|
||||||
wallet.imageFile,
|
wallet.imageFile!,
|
||||||
width: 110,
|
width: 110,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File newAvatar = await walletProvider.changeAvatar();
|
File newAvatar = await (walletProvider.changeAvatar() as FutureOr<File>);
|
||||||
if (newAvatar != null) {
|
|
||||||
wallet.imageFile = newAvatar;
|
wallet.imageFile = newAvatar;
|
||||||
}
|
|
||||||
walletProvider.reloadBuild();
|
walletProvider.reloadBuild();
|
||||||
},
|
},
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
|
@ -183,7 +179,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
// pollInterval: Duration(seconds: 1),
|
// pollInterval: Duration(seconds: 1),
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
builder: (QueryResult result,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
if (result.hasException) {
|
if (result.hasException) {
|
||||||
return Text(result.exception.toString());
|
return Text(result.exception.toString());
|
||||||
}
|
}
|
||||||
|
@ -194,15 +190,15 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
// List repositories = result.data['viewer']['repositories']['nodes'];
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
String wBalanceUD;
|
String wBalanceUD;
|
||||||
if (result.data['balance'] == null) {
|
if (result.data!['balance'] == null) {
|
||||||
wBalanceUD = '0.0';
|
wBalanceUD = '0.0';
|
||||||
} else if (result.hasException) {
|
} else if (result.hasException) {
|
||||||
wBalanceUD = '?';
|
wBalanceUD = '?';
|
||||||
} else {
|
} else {
|
||||||
int wBalanceG1 =
|
int wBalanceG1 =
|
||||||
result.data['balance']['amount'];
|
result.data!['balance']['amount'];
|
||||||
int currentUD =
|
int currentUD =
|
||||||
result.data['currentUd']['amount'];
|
result.data!['currentUd']['amount'];
|
||||||
double wBalanceUDBrut =
|
double wBalanceUDBrut =
|
||||||
wBalanceG1 / currentUD; // .toString();
|
wBalanceG1 / currentUD; // .toString();
|
||||||
wBalanceUD = double.parse(
|
wBalanceUD = double.parse(
|
||||||
|
@ -366,7 +362,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
width: 110,
|
width: 110,
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(
|
||||||
wallet.imageFile,
|
wallet.imageFile!,
|
||||||
width: 110,
|
width: 110,
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
|
@ -393,7 +389,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
onTap: !walletProvider.isDefaultWallet
|
onTap: !walletProvider.isDefaultWallet
|
||||||
? () {
|
? () {
|
||||||
defaultWallet = wallet;
|
defaultWallet = wallet;
|
||||||
chestBox.get(currentChest).defaultWallet =
|
chestBox.get(currentChest)!.defaultWallet =
|
||||||
wallet.number;
|
wallet.number;
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
|
@ -432,7 +428,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
? () async {
|
? () async {
|
||||||
await walletProvider.deleteWallet(
|
await walletProvider.deleteWallet(
|
||||||
context, wallet);
|
context, wallet);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||||
_myWalletProvider.listWallets =
|
_myWalletProvider.listWallets =
|
||||||
_myWalletProvider
|
_myWalletProvider
|
||||||
.readAllWallets(_currentChest);
|
.readAllWallets(_currentChest);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class WalletsHome extends StatelessWidget {
|
class WalletsHome extends StatelessWidget {
|
||||||
const WalletsHome({Key key}) : super(key: key);
|
const WalletsHome({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -21,8 +21,8 @@ class WalletsHome extends StatelessWidget {
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
final int _currentChestNumber = myWalletProvider.getCurrentChest();
|
final int? _currentChestNumber = myWalletProvider.getCurrentChest();
|
||||||
final ChestData _currentChest = chestBox.get(_currentChestNumber);
|
final ChestData _currentChest = chestBox.get(_currentChestNumber)!;
|
||||||
myWalletProvider.listWallets =
|
myWalletProvider.listWallets =
|
||||||
myWalletProvider.readAllWallets(_currentChestNumber);
|
myWalletProvider.readAllWallets(_currentChestNumber);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
title: Text(_currentChest.name,
|
title: Text(_currentChest.name!,
|
||||||
key: const Key('myWallets'),
|
key: const Key('myWallets'),
|
||||||
style: TextStyle(color: Colors.grey[850])),
|
style: TextStyle(color: Colors.grey[850])),
|
||||||
backgroundColor: const Color(0xffFFD58D),
|
backgroundColor: const Color(0xffFFD58D),
|
||||||
|
@ -146,7 +146,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets;
|
List _listWallets = _myWalletProvider.listWallets;
|
||||||
WalletData defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
||||||
|
|
||||||
return CustomScrollView(slivers: <Widget>[
|
return CustomScrollView(slivers: <Widget>[
|
||||||
|
@ -158,7 +158,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
crossAxisSpacing: 0,
|
crossAxisSpacing: 0,
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (WalletData _repository in _listWallets)
|
for (WalletData _repository in _listWallets as Iterable<WalletData>)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
@ -196,7 +196,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
gradient: RadialGradient(
|
gradient: RadialGradient(
|
||||||
radius: 0.6,
|
radius: 0.6,
|
||||||
colors: [
|
colors: [
|
||||||
Colors.green[400],
|
Colors.green[400]!,
|
||||||
const Color(0xFFE7E7A6),
|
const Color(0xFFE7E7A6),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
@ -210,7 +210,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(
|
||||||
_repository.imageFile,
|
_repository.imageFile!,
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
),
|
),
|
||||||
|
@ -222,7 +222,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
bottom: Radius.circular(12))),
|
bottom: Radius.circular(12))),
|
||||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||||
tileColor:
|
tileColor:
|
||||||
_repository.id()[1] == defaultWallet.id()[1]
|
_repository.id()[1] == defaultWallet!.id()[1]
|
||||||
? orangeC
|
? orangeC
|
||||||
: const Color(0xffFFD58D),
|
: const Color(0xffFFD58D),
|
||||||
// leading: Text('IMAGE'),
|
// leading: Text('IMAGE'),
|
||||||
|
@ -234,7 +234,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 5),
|
const EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: Text(
|
child: Text(
|
||||||
_repository.name,
|
_repository.name!,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 17.0,
|
fontSize: 17.0,
|
||||||
|
@ -287,7 +287,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
// pollInterval: Duration(seconds: 1),
|
// pollInterval: Duration(seconds: 1),
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
builder: (QueryResult result,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
if (result.hasException) {
|
if (result.hasException) {
|
||||||
return Text(result.exception.toString());
|
return Text(result.exception.toString());
|
||||||
}
|
}
|
||||||
|
@ -296,11 +296,11 @@ class WalletsHome extends StatelessWidget {
|
||||||
return const Text('Loading');
|
return const Text('Loading');
|
||||||
}
|
}
|
||||||
String wBalanceUD;
|
String wBalanceUD;
|
||||||
if (result.data['balance'] == null) {
|
if (result.data!['balance'] == null) {
|
||||||
wBalanceUD = '0.0';
|
wBalanceUD = '0.0';
|
||||||
} else {
|
} else {
|
||||||
int wBalanceG1 = result.data['balance']['amount'];
|
int wBalanceG1 = result.data!['balance']['amount'];
|
||||||
int currentUD = result.data['currentUd']['amount'];
|
int currentUD = result.data!['currentUd']['amount'];
|
||||||
double wBalanceUDBrut = wBalanceG1 / currentUD; // .toString();
|
double wBalanceUDBrut = wBalanceG1 / currentUD; // .toString();
|
||||||
wBalanceUD =
|
wBalanceUD =
|
||||||
double.parse((wBalanceUDBrut).toStringAsFixed(2)).toString();
|
double.parse((wBalanceUDBrut).toStringAsFixed(2)).toString();
|
||||||
|
@ -314,7 +314,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
String _newDerivationName =
|
String _newDerivationName =
|
||||||
'Portefeuille ${_myWalletProvider.listWallets.last.number + 2}';
|
'Portefeuille ${_myWalletProvider.listWallets.last.number! + 2}';
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
|
@ -371,10 +371,10 @@ class ClipOvalShadow extends StatelessWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
const ClipOvalShadow({
|
const ClipOvalShadow({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.shadow,
|
required this.shadow,
|
||||||
@required this.clipper,
|
required this.clipper,
|
||||||
@required this.child,
|
required this.child,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -393,7 +393,7 @@ class _ClipOvalShadowPainter extends CustomPainter {
|
||||||
final Shadow shadow;
|
final Shadow shadow;
|
||||||
final CustomClipper<Rect> clipper;
|
final CustomClipper<Rect> clipper;
|
||||||
|
|
||||||
_ClipOvalShadowPainter({@required this.shadow, @required this.clipper});
|
_ClipOvalShadowPainter({required this.shadow, required this.clipper});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
|
||||||
import 'package:gecko/screens/onBoarding/1.dart';
|
import 'package:gecko/screens/onBoarding/1.dart';
|
||||||
|
|
||||||
class NoKeyChainScreen extends StatelessWidget {
|
class NoKeyChainScreen extends StatelessWidget {
|
||||||
const NoKeyChainScreen({Key key}) : super(key: key);
|
const NoKeyChainScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ class OnboardingStepOne extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 1;
|
final int progress = 1;
|
||||||
|
|
||||||
OnboardingStepOne({Key key}) : super(key: key);
|
OnboardingStepOne({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OnboardingStepTwelve extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 9;
|
final int progress = 9;
|
||||||
|
|
||||||
OnboardingStepTwelve({Key key}) : super(key: key);
|
OnboardingStepTwelve({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import 'package:provider/provider.dart';
|
||||||
class OnboardingStepThirteen extends StatelessWidget {
|
class OnboardingStepThirteen extends StatelessWidget {
|
||||||
final int progress = 10;
|
final int progress = 10;
|
||||||
|
|
||||||
const OnboardingStepThirteen({Key key}) : super(key: key);
|
const OnboardingStepThirteen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -16,12 +16,12 @@ import 'package:provider/provider.dart';
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepFourteen extends StatelessWidget {
|
class OnboardingStepFourteen extends StatelessWidget {
|
||||||
OnboardingStepFourteen({
|
OnboardingStepFourteen({
|
||||||
Key validationKey,
|
Key? validationKey,
|
||||||
}) : super(key: validationKey);
|
}) : super(key: validationKey);
|
||||||
|
|
||||||
final int progress = 11;
|
final int progress = 11;
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
var pinColor = const Color(0xFFA4B600);
|
Color? pinColor = const Color(0xFFA4B600);
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -62,7 +62,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
return Form(
|
return Form(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
|
@ -81,7 +81,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.fade,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v.length < _pinLenght) {
|
if (v!.length < _pinLenght) {
|
||||||
return "Votre code PIN fait $_pinLenght caractères";
|
return "Votre code PIN fait $_pinLenght caractères";
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -118,7 +118,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
|
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
NewWallet generatedWallet = Dewif().generateDewif(
|
NewWallet generatedWallet = Dewif().generateDewif(
|
||||||
_generateWalletProvider.generatedMnemonic,
|
_generateWalletProvider.generatedMnemonic!,
|
||||||
_generateWalletProvider.pin.text,
|
_generateWalletProvider.pin.text,
|
||||||
lang: 'french');
|
lang: 'french');
|
||||||
_generateWalletProvider.storeHDWChest(
|
_generateWalletProvider.storeHDWChest(
|
||||||
|
|
|
@ -10,7 +10,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 12;
|
final int progress = 12;
|
||||||
|
|
||||||
OnboardingStepFiveteen({Key key}) : super(key: key);
|
OnboardingStepFiveteen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OnboardingStepTwo extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 2;
|
final int progress = 2;
|
||||||
|
|
||||||
OnboardingStepTwo({Key key}) : super(key: key);
|
OnboardingStepTwo({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OnboardingStepFor extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 3;
|
final int progress = 3;
|
||||||
|
|
||||||
OnboardingStepFor({Key key}) : super(key: key);
|
OnboardingStepFor({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 4;
|
final int progress = 4;
|
||||||
|
|
||||||
OnboardingStepFive({Key key}) : super(key: key);
|
OnboardingStepFive({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OnboardingStepSeven extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 5;
|
final int progress = 5;
|
||||||
|
|
||||||
OnboardingStepSeven({Key key}) : super(key: key);
|
OnboardingStepSeven({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class OnboardingStepEight extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 6;
|
final int progress = 6;
|
||||||
|
|
||||||
OnboardingStepEight({Key key}) : super(key: key);
|
OnboardingStepEight({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 6;
|
final int progress = 6;
|
||||||
|
|
||||||
OnboardingStepNine({Key key}) : super(key: key);
|
OnboardingStepNine({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -176,9 +176,9 @@ Widget arrayCell(dataWord) {
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class PrintWallet extends StatelessWidget {
|
class PrintWallet extends StatelessWidget {
|
||||||
const PrintWallet(this.sentence, {Key key}) : super(key: key);
|
const PrintWallet(this.sentence, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
final String sentence;
|
final String? sentence;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -10,11 +10,11 @@ import 'package:provider/provider.dart';
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepTen extends StatelessWidget {
|
class OnboardingStepTen extends StatelessWidget {
|
||||||
OnboardingStepTen({
|
OnboardingStepTen({
|
||||||
Key validationKey,
|
Key? validationKey,
|
||||||
@required this.generatedMnemonic,
|
required this.generatedMnemonic,
|
||||||
}) : super(key: validationKey);
|
}) : super(key: validationKey);
|
||||||
|
|
||||||
String generatedMnemonic;
|
String? generatedMnemonic;
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
TextEditingController wordController = TextEditingController();
|
TextEditingController wordController = TextEditingController();
|
||||||
final TextEditingController _mnemonicController = TextEditingController();
|
final TextEditingController _mnemonicController = TextEditingController();
|
||||||
|
@ -27,7 +27,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
_mnemonicController.text = generatedMnemonic;
|
_mnemonicController.text = generatedMnemonic!;
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -70,7 +70,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(7),
|
borderRadius: BorderRadius.circular(7),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600]!,
|
||||||
width: 3,
|
width: 3,
|
||||||
)),
|
)),
|
||||||
width: 430,
|
width: 430,
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OnboardingStepEleven extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
final int progress = 8;
|
final int progress = 8;
|
||||||
|
|
||||||
OnboardingStepEleven({Key key}) : super(key: key);
|
OnboardingStepEleven({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:provider/provider.dart';
|
||||||
// import 'package:provider/provider.dart';
|
// import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class SearchScreen extends StatelessWidget {
|
class SearchScreen extends StatelessWidget {
|
||||||
const SearchScreen({Key key}) : super(key: key);
|
const SearchScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -59,11 +59,11 @@ class SearchScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(color: Colors.grey[500], width: 2),
|
BorderSide(color: Colors.grey[500]!, width: 2),
|
||||||
borderRadius: BorderRadius.circular(8)),
|
borderRadius: BorderRadius.circular(8)),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(color: Colors.grey[500], width: 2.5),
|
BorderSide(color: Colors.grey[500]!, width: 2.5),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.all(20),
|
contentPadding: const EdgeInsets.all(20),
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'package:gecko/screens/wallet_view.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class SearchResultScreen extends StatelessWidget {
|
class SearchResultScreen extends StatelessWidget {
|
||||||
const SearchResultScreen({Key key}) : super(key: key);
|
const SearchResultScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -64,11 +64,11 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _searchProvider.searchBlockchain(),
|
future: _searchProvider.searchBlockchain(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
for (G1WalletsList g1Wallet in snapshot.data)
|
for (G1WalletsList g1Wallet in snapshot.data ?? [])
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
@ -81,13 +81,13 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
null
|
null
|
||||||
? ClipOval(
|
? ClipOval(
|
||||||
child: g1WalletsBox
|
child: g1WalletsBox
|
||||||
.get(g1Wallet.pubkey)
|
.get(g1Wallet.pubkey)!
|
||||||
.avatar)
|
.avatar)
|
||||||
: FutureBuilder(
|
: FutureBuilder(
|
||||||
future: _cesiumPlusProvider.getAvatar(
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
g1Wallet.pubkey, _avatarSize),
|
g1Wallet.pubkey, _avatarSize),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<Image> _avatar) {
|
AsyncSnapshot<Image?> _avatar) {
|
||||||
if (_avatar.connectionState !=
|
if (_avatar.connectionState !=
|
||||||
ConnectionState.done ||
|
ConnectionState.done ||
|
||||||
_avatar.hasError) {
|
_avatar.hasError) {
|
||||||
|
@ -108,12 +108,12 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (_avatar.hasData) {
|
if (_avatar.hasData) {
|
||||||
g1WalletsBox
|
g1WalletsBox
|
||||||
.get(g1Wallet.pubkey)
|
.get(g1Wallet.pubkey)!
|
||||||
.avatar = _avatar.data;
|
.avatar = _avatar.data;
|
||||||
return ClipOval(child: _avatar.data);
|
return ClipOval(child: _avatar.data);
|
||||||
} else {
|
} else {
|
||||||
g1WalletsBox
|
g1WalletsBox
|
||||||
.get(g1Wallet.pubkey)
|
.get(g1Wallet.pubkey)!
|
||||||
.avatar =
|
.avatar =
|
||||||
_cesiumPlusProvider
|
_cesiumPlusProvider
|
||||||
.defaultAvatar(_avatarSize);
|
.defaultAvatar(_avatarSize);
|
||||||
|
@ -124,7 +124,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
title: Row(children: <Widget>[
|
title: Row(children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
_walletsProfilesClass
|
_walletsProfilesClass
|
||||||
.getShortPubkey(g1Wallet.pubkey),
|
.getShortPubkey(g1Wallet.pubkey!),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontFamily: 'Monospace',
|
fontFamily: 'Monospace',
|
||||||
|
@ -132,7 +132,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
]),
|
]),
|
||||||
subtitle: Row(children: <Widget>[
|
subtitle: Row(children: <Widget>[
|
||||||
Text(g1Wallet?.id?.username ?? '',
|
Text(g1Wallet.id?.username ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
|
|
|
@ -9,20 +9,20 @@ import 'package:gecko/globals.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
String generatedMnemonic;
|
String? generatedMnemonic;
|
||||||
bool walletIsGenerated = false;
|
bool walletIsGenerated = false;
|
||||||
NewWallet actualWallet;
|
NewWallet? actualWallet;
|
||||||
String newWalletName;
|
String? newWalletName;
|
||||||
|
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
String validPin = 'NO PIN';
|
String validPin = 'NO PIN';
|
||||||
String currentText = "";
|
String currentText = "";
|
||||||
var pinColor = Colors.grey[300];
|
var pinColor = Colors.grey[300];
|
||||||
Directory appPath;
|
Directory? appPath;
|
||||||
|
|
||||||
final MyWalletsProvider _myWallets = MyWalletsProvider();
|
final MyWalletsProvider _myWallets = MyWalletsProvider();
|
||||||
|
|
||||||
SettingsScreen({Key key}) : super(key: key);
|
SettingsScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
|
||||||
class TemplateScreen extends StatelessWidget {
|
class TemplateScreen extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
|
|
||||||
TemplateScreen({Key key}) : super(key: key);
|
TemplateScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -15,11 +15,11 @@ import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class WalletViewScreen extends StatelessWidget {
|
class WalletViewScreen extends StatelessWidget {
|
||||||
const WalletViewScreen(
|
const WalletViewScreen(
|
||||||
{@required this.pubkey, this.username, this.avatar, Key key})
|
{required this.pubkey, this.username, this.avatar, Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final String pubkey;
|
final String? pubkey;
|
||||||
final String username;
|
final String? username;
|
||||||
final Image avatar;
|
final Image? avatar;
|
||||||
final double buttonSize = 100;
|
final double buttonSize = 100;
|
||||||
final double buttonFontSize = 18;
|
final double buttonFontSize = 18;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
// Provider.of<WalletsProfilesProvider>(context);
|
// Provider.of<WalletsProfilesProvider>(context);
|
||||||
const double shapeSize = 20;
|
const double shapeSize = 20;
|
||||||
MyWalletsProvider _myWalletProvider = MyWalletsProvider();
|
MyWalletsProvider _myWalletProvider = MyWalletsProvider();
|
||||||
WalletData defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
||||||
|
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
|
@ -257,7 +257,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
// borderRadius: BorderRadius.circular(8)),
|
// borderRadius: BorderRadius.circular(8)),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.grey[500], width: 2),
|
color: Colors.grey[500]!, width: 2),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.all(20),
|
contentPadding: const EdgeInsets.all(20),
|
||||||
|
@ -342,7 +342,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
_historyProvider.snackCopyKey(context);
|
_historyProvider.snackCopyKey(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
_historyProvider.getShortPubkey(pubkey),
|
_historyProvider.getShortPubkey(pubkey!),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
|
@ -361,20 +361,20 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
builder: (QueryResult result,
|
builder: (QueryResult result,
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
if (result.isLoading || result.hasException) {
|
if (result.isLoading || result.hasException) {
|
||||||
return const Text('...');
|
return const Text('...');
|
||||||
} else if (result.data['idty'] == null ||
|
} else if (result.data!['idty'] == null ||
|
||||||
result.data['idty']['username'] == null) {
|
result.data!['idty']['username'] == null) {
|
||||||
g1WalletsBox.get(pubkey)?.username = '';
|
g1WalletsBox.get(pubkey)?.username = '';
|
||||||
return const Text('');
|
return const Text('');
|
||||||
} else {
|
} else {
|
||||||
g1WalletsBox.get(pubkey)?.username =
|
g1WalletsBox.get(pubkey)?.username =
|
||||||
result?.data['idty']['username'] ?? '';
|
result.data!['idty']['username'] ?? '';
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
result?.data['idty']['username'] ?? '',
|
result.data!['idty']['username'] ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -389,7 +389,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
g1WalletsBox.get(pubkey)?.username,
|
g1WalletsBox.get(pubkey)?.username ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -400,7 +400,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
username,
|
username!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -415,7 +415,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
snapshot.data ?? '-',
|
snapshot.data.toString(),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18, color: Colors.black),
|
fontSize: 18, color: Colors.black),
|
||||||
),
|
),
|
||||||
|
@ -429,7 +429,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
||||||
builder:
|
builder:
|
||||||
(BuildContext context, AsyncSnapshot<Image> _avatar) {
|
(BuildContext context, AsyncSnapshot<Image?> _avatar) {
|
||||||
if (_avatar.connectionState != ConnectionState.done) {
|
if (_avatar.connectionState != ConnectionState.done) {
|
||||||
return Stack(children: [
|
return Stack(children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
|
@ -461,7 +461,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: _avatar.data.image,
|
image: _avatar.data!.image,
|
||||||
height: _avatarSize,
|
height: _avatarSize,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
@ -485,7 +485,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: avatar.image,
|
image: avatar!.image,
|
||||||
height: _avatarSize,
|
height: _avatarSize,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 0.0.4+4
|
version: 0.0.4+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
@ -15,19 +15,19 @@ void main() {
|
||||||
final manageWalletsFinder = find.byValueKey('manageWallets');
|
final manageWalletsFinder = find.byValueKey('manageWallets');
|
||||||
// final buttonFinder = find.byValueKey('increment');
|
// final buttonFinder = find.byValueKey('increment');
|
||||||
|
|
||||||
FlutterDriver driver;
|
FlutterDriver? driver;
|
||||||
String pinCode;
|
String? pinCode;
|
||||||
|
|
||||||
// Connect to the Flutter driver before running any tests.
|
// Connect to the Flutter driver before running any tests.
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
driver = await FlutterDriver.connect();
|
driver = await FlutterDriver.connect();
|
||||||
await driver.waitUntilFirstFrameRasterized();
|
await driver!.waitUntilFirstFrameRasterized();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close the connection to the driver after the tests have completed.
|
// Close the connection to the driver after the tests have completed.
|
||||||
tearDownAll(() async {
|
tearDownAll(() async {
|
||||||
if (driver != null) {
|
if (driver != null) {
|
||||||
driver.close();
|
driver!.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ void main() {
|
||||||
|
|
||||||
// Function to tap the widget by key
|
// Function to tap the widget by key
|
||||||
Future tapOn(String key) async {
|
Future tapOn(String key) async {
|
||||||
await driver.tap(find.byValueKey(key));
|
await driver!.tap(find.byValueKey(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Easy get text
|
// Easy get text
|
||||||
Future<String> getText(String text) async {
|
Future<String> getText(String text) async {
|
||||||
return await driver.getText(find.byValueKey(
|
return await driver!.getText(find.byValueKey(
|
||||||
text,
|
text,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ void main() {
|
||||||
Future<bool> isPresent(SerializableFinder byValueKey,
|
Future<bool> isPresent(SerializableFinder byValueKey,
|
||||||
{Duration timeout = const Duration(seconds: 1)}) async {
|
{Duration timeout = const Duration(seconds: 1)}) async {
|
||||||
try {
|
try {
|
||||||
await driver.waitFor(byValueKey, timeout: timeout);
|
await driver!.waitFor(byValueKey, timeout: timeout);
|
||||||
return true;
|
return true;
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,7 +97,7 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fast creation of new Keychain
|
// Fast creation of new Keychain
|
||||||
Future<String> createNewKeychain(String name) async {
|
Future<String?> createNewKeychain(String name) async {
|
||||||
await tapOn('drawerMenu');
|
await tapOn('drawerMenu');
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('parameters');
|
await tapOn('parameters');
|
||||||
|
@ -110,9 +110,9 @@ void main() {
|
||||||
pinCode = await getText('generatedPin');
|
pinCode = await getText('generatedPin');
|
||||||
await tapOn('storeKeychain');
|
await tapOn('storeKeychain');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await driver.enterText('triche');
|
await driver!.enterText('triche');
|
||||||
await tapOn('walletName');
|
await tapOn('walletName');
|
||||||
await driver.enterText(name);
|
await driver!.enterText(name);
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
await tapOn('confirmStorage');
|
await tapOn('confirmStorage');
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
@ -124,7 +124,7 @@ void main() {
|
||||||
test('OnBoarding - Open wallets management', (
|
test('OnBoarding - Open wallets management', (
|
||||||
{timeout = Timeout.none}) async {
|
{timeout = Timeout.none}) async {
|
||||||
// await driver.runUnsynchronized(() async { // Needed if we want to manage async drivers
|
// await driver.runUnsynchronized(() async { // Needed if we want to manage async drivers
|
||||||
await driver.tap(manageWalletsFinder);
|
await driver!.tap(manageWalletsFinder);
|
||||||
|
|
||||||
// If a wallet exist, go to delete theme all
|
// If a wallet exist, go to delete theme all
|
||||||
if (!await isPresent(find.byValueKey('goStep1'))) {
|
if (!await isPresent(find.byValueKey('goStep1'))) {
|
||||||
|
@ -132,7 +132,7 @@ void main() {
|
||||||
|
|
||||||
await deleteAllWallets();
|
await deleteAllWallets();
|
||||||
|
|
||||||
await driver.tap(manageWalletsFinder);
|
await driver!.tap(manageWalletsFinder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the SerializableFinder for text widget with key 'textOnboarding'
|
// Get the SerializableFinder for text widget with key 'textOnboarding'
|
||||||
|
@ -143,7 +143,7 @@ void main() {
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
|
|
||||||
// Verify onboarding is starting, with text
|
// Verify onboarding is starting, with text
|
||||||
expect(await driver.getText(textOnboarding),
|
expect(await driver!.getText(textOnboarding),
|
||||||
"Je ne connais pour l’instant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.");
|
"Je ne connais pour l’instant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void main() {
|
||||||
await tapOn('goStep6');
|
await tapOn('goStep6');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await driver.getText(find.byValueKey(
|
await driver!.getText(find.byValueKey(
|
||||||
'step6',
|
'step6',
|
||||||
)),
|
)),
|
||||||
"J’ai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.");
|
"J’ai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.");
|
||||||
|
@ -189,10 +189,10 @@ void main() {
|
||||||
)];
|
)];
|
||||||
|
|
||||||
// Enter the expected word
|
// Enter the expected word
|
||||||
await driver.enterText(goodWord);
|
await driver!.enterText(goodWord);
|
||||||
|
|
||||||
// Check if word is valid
|
// Check if word is valid
|
||||||
await driver.waitFor(find.text("C'est le bon mot !"));
|
await driver!.waitFor(find.text("C'est le bon mot !"));
|
||||||
|
|
||||||
// Continue onboarding workflow
|
// Continue onboarding workflow
|
||||||
await tapOn('goStep9');
|
await tapOn('goStep9');
|
||||||
|
@ -245,7 +245,7 @@ void main() {
|
||||||
// await tapOn('formKey2');
|
// await tapOn('formKey2');
|
||||||
|
|
||||||
//Enter good secret code
|
//Enter good secret code
|
||||||
await driver.enterText(pinCode);
|
await driver!.enterText(pinCode!);
|
||||||
|
|
||||||
expect(await getText('step13'),
|
expect(await getText('step13'),
|
||||||
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !");
|
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !");
|
||||||
|
@ -259,29 +259,29 @@ void main() {
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
|
||||||
// Go to first derivation and rename it
|
// Go to first derivation and rename it
|
||||||
await driver.tap(find.text('Mon portefeuille courant'));
|
await driver!.tap(find.text('Mon portefeuille courant'));
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('renameWallet');
|
await tapOn('renameWallet');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('walletName');
|
await tapOn('walletName');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await driver.enterText('Renommage wallet 1');
|
await driver!.enterText('Renommage wallet 1');
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('renameWallet');
|
await tapOn('renameWallet');
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
|
await driver!.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
|
||||||
// expect(await getText('walletName'), "Renommage wallet 1");
|
// expect(await getText('walletName'), "Renommage wallet 1");
|
||||||
await goBack();
|
await goBack();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('My wallets - Create a derivations, open thems, tap all buttons', (
|
test('My wallets - Create a derivations, open thems, tap all buttons', (
|
||||||
{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();
|
await createDerivation();
|
||||||
|
|
||||||
// Go to second derivation options
|
// Go to second derivation options
|
||||||
await driver.tap(find.text('Portefeuille 2'));
|
await driver!.tap(find.text('Portefeuille 2'));
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
|
|
||||||
// Test options
|
// Test options
|
||||||
|
@ -297,7 +297,7 @@ void main() {
|
||||||
await tapOn('setDefaultWallet');
|
await tapOn('setDefaultWallet');
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
await tapOn('copyPubkey');
|
await tapOn('copyPubkey');
|
||||||
await driver.waitFor(find
|
await driver!.waitFor(find
|
||||||
.text('Cette clé publique a été copié dans votre presse-papier.'));
|
.text('Cette clé publique a été copié dans votre presse-papier.'));
|
||||||
await goBack();
|
await goBack();
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void main() {
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
|
|
||||||
// Go to third derivation options
|
// Go to third derivation options
|
||||||
await driver.tap(find.text('Portefeuille 3'));
|
await driver!.tap(find.text('Portefeuille 3'));
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('displayBalance');
|
await tapOn('displayBalance');
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ 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('Portefeuille 4'), timeout: timeout);
|
await driver!.waitFor(find.text('Portefeuille 4'), timeout: timeout);
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
|
@ -331,27 +331,27 @@ void main() {
|
||||||
await tapOn('manageWallets');
|
await tapOn('manageWallets');
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
//Enter secret code
|
//Enter secret code
|
||||||
await driver.enterText(pinCode);
|
await driver!.enterText(pinCode!);
|
||||||
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('Portefeuille 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('Portefeuille 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);
|
||||||
await driver.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
await driver!.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
|
||||||
// Display history, copy pubkey, go back and rename wallet name
|
// Display history, copy pubkey, go back and rename wallet name
|
||||||
await tapOn('displayHistory');
|
await tapOn('displayHistory');
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await tapOn('copyPubkey');
|
await tapOn('copyPubkey');
|
||||||
await driver.waitFor(find
|
await driver!.waitFor(find
|
||||||
.text('Cette clé publique a été copié dans votre presse-papier.'));
|
.text('Cette clé publique a été copié dans votre presse-papier.'));
|
||||||
await sleep(800);
|
await sleep(800);
|
||||||
await goBack();
|
await goBack();
|
||||||
|
@ -360,70 +360,70 @@ void main() {
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('walletName');
|
await tapOn('walletName');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await driver.enterText('Renommage wallet 2');
|
await driver!.enterText('Renommage wallet 2');
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('renameWallet');
|
await tapOn('renameWallet');
|
||||||
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 driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await createDerivation();
|
await createDerivation();
|
||||||
await driver.scrollIntoView(find.text('+'));
|
await driver!.scrollIntoView(find.text('+'));
|
||||||
await createDerivation();
|
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('Portefeuille 20'),
|
find.text('Portefeuille 20'),
|
||||||
dyScroll: -300.0,
|
dyScroll: -300.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
await driver.waitFor(find.text('Portefeuille 20'));
|
await driver!.waitFor(find.text('Portefeuille 20'));
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await driver.tap(find.text('Portefeuille 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('Portefeuille 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);
|
||||||
await tapOn('searchIcon');
|
await tapOn('searchIcon');
|
||||||
await sleep(400);
|
await sleep(400);
|
||||||
await driver.enterText('D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU');
|
await driver!.enterText('D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('copyPubkey');
|
await tapOn('copyPubkey');
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
await tapOn('switchPayHistory');
|
await tapOn('switchPayHistory');
|
||||||
await sleep(1200);
|
await sleep(1200);
|
||||||
// await driver.scrollIntoView(find.byValueKey('listTransactions'));
|
// await driver.scrollIntoView(find.byValueKey('listTransactions'));
|
||||||
await driver.scrollUntilVisible(
|
await driver!.scrollUntilVisible(
|
||||||
find.byValueKey('listTransactions'),
|
find.byValueKey('listTransactions'),
|
||||||
find.byValueKey('transaction35'),
|
find.byValueKey('transaction35'),
|
||||||
dyScroll: -600.0,
|
dyScroll: -600.0,
|
||||||
);
|
);
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await tapOn('transaction33');
|
await tapOn('transaction33');
|
||||||
await driver.waitFor(find.text('Commentaire:'));
|
await driver!.waitFor(find.text('Commentaire:'));
|
||||||
|
|
||||||
// Want to paste pubkey copied, but doesn't work actualy with flutter driver: https://github.com/flutter/flutter/issues/47448
|
// Want to paste pubkey copied, but doesn't work actualy with flutter driver: https://github.com/flutter/flutter/issues/47448
|
||||||
// final ClipboardData pubkeyCopied =
|
// final ClipboardData pubkeyCopied =
|
||||||
|
@ -435,19 +435,19 @@ void main() {
|
||||||
|
|
||||||
test('Wallet generation - Fast wallets generations', (
|
test('Wallet generation - Fast wallets generations', (
|
||||||
{timeout = const Duration(seconds: 2)}) async {
|
{timeout = const Duration(seconds: 2)}) async {
|
||||||
await driver.waitFor(find.text('Commentaire:'), timeout: timeout);
|
await driver!.waitFor(find.text('Commentaire:'), timeout: timeout);
|
||||||
await goBack();
|
await goBack();
|
||||||
await goBack();
|
await goBack();
|
||||||
await deleteAllWallets();
|
await deleteAllWallets();
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
final String pincode = await createNewKeychain('Fast wallet');
|
final String pincode = await (createNewKeychain('Fast wallet') as FutureOr<String>);
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
await driver.enterText(pincode);
|
await driver!.enterText(pincode);
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await createDerivation();
|
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'));
|
||||||
// Wait 3 seconds at the end
|
// Wait 3 seconds at the end
|
||||||
await sleep(3000);
|
await sleep(3000);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue