Almost all elements on Wallet options screen works
This commit is contained in:
parent
ed8b343af4
commit
00a27768e6
|
@ -4,6 +4,7 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
import 'package:gecko/screens/history.dart';
|
import 'package:gecko/screens/history.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
|
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:qrscan/qrscan.dart' as scanner;
|
import 'package:qrscan/qrscan.dart' as scanner;
|
||||||
|
@ -24,6 +25,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
Map pageInfo;
|
Map pageInfo;
|
||||||
bool isHistoryScreen = false;
|
bool isHistoryScreen = false;
|
||||||
String historySwitchButtun = "Voir l'historique";
|
String historySwitchButtun = "Voir l'historique";
|
||||||
|
String rawSvg;
|
||||||
|
|
||||||
Future scan(context) async {
|
Future scan(context) async {
|
||||||
await Permission.camera.request();
|
await Permission.camera.request();
|
||||||
|
@ -43,7 +45,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return barcode;
|
return barcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
String isPubkey(context, pubkey) {
|
String isPubkey(context, pubkey, {bool goHistory}) {
|
||||||
HomeProvider _homeProvider =
|
HomeProvider _homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
final RegExp regExp = new RegExp(
|
final RegExp regExp = new RegExp(
|
||||||
|
@ -62,8 +64,16 @@ class HistoryProvider with ChangeNotifier {
|
||||||
|
|
||||||
this.outputPubkey.text = pubkey;
|
this.outputPubkey.text = pubkey;
|
||||||
|
|
||||||
isHistoryScreen = false;
|
if (goHistory == null) goHistory = false;
|
||||||
historySwitchButtun = "Voir l'historique";
|
|
||||||
|
if (goHistory) {
|
||||||
|
isHistoryScreen = true;
|
||||||
|
historySwitchButtun = "Payer";
|
||||||
|
} else {
|
||||||
|
isHistoryScreen = false;
|
||||||
|
historySwitchButtun = "Voir l'historique";
|
||||||
|
}
|
||||||
|
|
||||||
_homeProvider.handleSearchEnd();
|
_homeProvider.handleSearchEnd();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -241,6 +251,10 @@ class HistoryProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String generateIdenticon(String _pubkey) {
|
||||||
|
return Jdenticon.toSvg(_pubkey);
|
||||||
|
}
|
||||||
|
|
||||||
// num getBalance(_pubkey) {
|
// num getBalance(_pubkey) {
|
||||||
// getBalance(_pubkey);
|
// getBalance(_pubkey);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -68,6 +68,8 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
listWallets = '';
|
listWallets = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(walletsDirectory.path);
|
||||||
|
|
||||||
// int i = 0;
|
// int i = 0;
|
||||||
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
|
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
|
||||||
_walletConfig.readAsLinesSync().forEach((element) {
|
_walletConfig.readAsLinesSync().forEach((element) {
|
||||||
|
|
|
@ -52,8 +52,13 @@ const String getHistory = r'''
|
||||||
|
|
||||||
const String getBalance = r'''
|
const String getBalance = r'''
|
||||||
query ($pubkey: String!) {
|
query ($pubkey: String!) {
|
||||||
balance(script: $pubkey) {
|
balance(script: $pubkey) {
|
||||||
amount
|
amount
|
||||||
base
|
base
|
||||||
|
}
|
||||||
|
currentUd {
|
||||||
|
amount
|
||||||
|
base
|
||||||
|
}
|
||||||
}
|
}
|
||||||
''';
|
''';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:typed_data';
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:fast_base58/fast_base58.dart';
|
import 'package:fast_base58/fast_base58.dart';
|
||||||
|
@ -7,6 +8,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:truncate/truncate.dart';
|
import 'package:truncate/truncate.dart';
|
||||||
|
import 'package:qrscan/qrscan.dart' as scanner;
|
||||||
|
|
||||||
class WalletOptionsProvider with ChangeNotifier {
|
class WalletOptionsProvider with ChangeNotifier {
|
||||||
TextEditingController pubkey = TextEditingController();
|
TextEditingController pubkey = TextEditingController();
|
||||||
|
@ -14,6 +16,11 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
bool isWalletUnlock = false;
|
bool isWalletUnlock = false;
|
||||||
bool ischangedPin = false;
|
bool ischangedPin = false;
|
||||||
TextEditingController newPin = new TextEditingController();
|
TextEditingController newPin = new TextEditingController();
|
||||||
|
bool isEditing = false;
|
||||||
|
bool isBalanceBlur = true;
|
||||||
|
FocusNode walletNameFocus = FocusNode();
|
||||||
|
TextEditingController nameController = TextEditingController();
|
||||||
|
String walletID;
|
||||||
|
|
||||||
Future<NewWallet> get badWallet => null;
|
Future<NewWallet> get badWallet => null;
|
||||||
|
|
||||||
|
@ -121,22 +128,36 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return _pinLenght;
|
return _pinLenght;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _renameWallet(_walletName, _newName, _walletNbr, _derivation) async {
|
Future _renameWallet(_walletID, _newName) async {
|
||||||
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
||||||
|
|
||||||
String newConfig =
|
String newConfig =
|
||||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||||
int nbrLines = lines.length;
|
int nbrLines = lines.length;
|
||||||
print(lines);
|
// print(lines);
|
||||||
print(nbrLines);
|
// print(nbrLines);
|
||||||
int _index = lines.indexOf('0:$_walletNbr:$_walletName:$_derivation');
|
// int _index = lines.indexOf('0:$_walletNbr:$_walletName:$_derivation');
|
||||||
if (nbrLines != 1) {
|
if (nbrLines != 1) {
|
||||||
lines.removeWhere((element) =>
|
for (String wLine in lines) {
|
||||||
element.contains('0:$_walletNbr:$_walletName:$_derivation'));
|
String wID = "${wLine.split(':')[0]}:${wLine.split(':')[1]}";
|
||||||
lines.insert(_index, '0:$_walletNbr:$_newName:$_derivation');
|
print(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||||
|
print(wLine);
|
||||||
|
String deri = wLine.split(':')[3];
|
||||||
|
print("($wID == $_walletID ???");
|
||||||
|
if (wID == _walletID) {
|
||||||
|
lines.remove(wLine);
|
||||||
|
lines.add('$_walletID:$_newName:$deri');
|
||||||
|
// return '$_walletID:$_newName:$deri';
|
||||||
|
print('OOUUUUUUUIIIIIIIIIIIIIIIIIII');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// lines.removeWhere((element) =>
|
||||||
|
// '${element.split(':')[0]}:${element.split(':')[1]}' == _walletID);
|
||||||
|
// lines.add('$_walletID:$_newName:$deri');
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
} else {
|
} else {
|
||||||
return '0:$_walletNbr:$_newName:$_derivation';
|
return 'true';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -173,8 +194,8 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
child: Text("Valider"),
|
child: Text("Valider"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
await _renameWallet(_walletName, this._newWalletName.text,
|
// await _renameWallet(_walletName, this._newWalletName.text,
|
||||||
_walletNbr, _derivation);
|
// _walletNbr, _derivation);
|
||||||
});
|
});
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
|
@ -186,6 +207,26 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> editWalletName(_wID) async {
|
||||||
|
bool nameState;
|
||||||
|
if (isEditing) {
|
||||||
|
if (!nameController.text.contains(':') &&
|
||||||
|
nameController.text.length <= 45) {
|
||||||
|
await _renameWallet(_wID, nameController.text);
|
||||||
|
nameState = true;
|
||||||
|
} else {
|
||||||
|
nameState = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
walletNameFocus.requestFocus();
|
||||||
|
nameState = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
isEditing ? isEditing = false : isEditing = true;
|
||||||
|
notifyListeners();
|
||||||
|
return nameState;
|
||||||
|
}
|
||||||
|
|
||||||
Future<int> deleteWallet(context, _walletNbr, _name, _derivation) async {
|
Future<int> deleteWallet(context, _walletNbr, _name, _derivation) async {
|
||||||
final bool _answer = await _confirmDeletingWallet(context, _name);
|
final bool _answer = await _confirmDeletingWallet(context, _name);
|
||||||
|
|
||||||
|
@ -305,6 +346,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return pubkeyShort;
|
return pubkeyShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bluringBalance() {
|
||||||
|
isBalanceBlur = !isBalanceBlur;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Uint8List> generateQRcode(String _pubkey) async {
|
||||||
|
return await scanner.generateBarCode(_pubkey);
|
||||||
|
}
|
||||||
|
|
||||||
void reloadBuild() {
|
void reloadBuild() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/cesiumPlus.dart';
|
import 'package:gecko/models/cesiumPlus.dart';
|
||||||
|
@ -11,6 +10,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
@ -25,6 +25,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
|
||||||
FetchMore fetchMore;
|
FetchMore fetchMore;
|
||||||
FetchMoreOptions opts;
|
FetchMoreOptions opts;
|
||||||
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -37,6 +38,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
key: _scaffoldKey,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: _homeProvider.appBarExplorer,
|
title: _homeProvider.appBarExplorer,
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -153,8 +155,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
return const Text('Aucune donnée à afficher.');
|
return const Text('Aucune donnée à afficher.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final num balance = _historyProvider
|
num balance;
|
||||||
.removeDecimalZero(result.data['balance']['amount'] / 100);
|
|
||||||
|
if (result.data['balance'] == null) {
|
||||||
|
balance = 0.0;
|
||||||
|
} else {
|
||||||
|
balance = _historyProvider
|
||||||
|
.removeDecimalZero(result.data['balance']['amount'] / 100);
|
||||||
|
}
|
||||||
|
|
||||||
opts = _historyProvider.checkQueryResult(
|
opts = _historyProvider.checkQueryResult(
|
||||||
result, opts, _outputPubkey.text);
|
result, opts, _outputPubkey.text);
|
||||||
|
@ -179,7 +187,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
if (_isFirstExec)
|
if (_isFirstExec)
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
12, 0, 5, 0),
|
20, 0, 30, 0),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future:
|
future:
|
||||||
_cesiumPlusProvider.getAvatar(
|
_cesiumPlusProvider.getAvatar(
|
||||||
|
@ -235,7 +243,21 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
30, 0, 5, 0), // .only(right: 15),
|
30, 0, 5, 0), // .only(right: 15),
|
||||||
child: Text('TODO')),
|
child: Card(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
SvgPicture.string(
|
||||||
|
_historyProvider
|
||||||
|
.generateIdenticon(
|
||||||
|
_historyProvider
|
||||||
|
.pubkey),
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
height: 64,
|
||||||
|
width: 64,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
SizedBox(width: 0)
|
SizedBox(width: 0)
|
||||||
]),
|
]),
|
||||||
if (_isFirstExec)
|
if (_isFirstExec)
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
import 'dart:ui';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -17,6 +21,8 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
int walletNbr;
|
int walletNbr;
|
||||||
String walletName;
|
String walletName;
|
||||||
int derivation;
|
int derivation;
|
||||||
|
int _nbrLinesName = 1;
|
||||||
|
bool _isNewNameValid = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -26,25 +32,45 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
|
||||||
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 ||
|
||||||
|
_isNewNameValid == false) {
|
||||||
|
_walletOptions.nameController.text = walletName;
|
||||||
|
} else {
|
||||||
|
walletName = _walletOptions.nameController.text;
|
||||||
|
}
|
||||||
|
_walletOptions.walletID = '0:$walletNbr';
|
||||||
|
|
||||||
|
_walletOptions.nameController.text.length >= 15
|
||||||
|
? _nbrLinesName = 2
|
||||||
|
: _nbrLinesName = 1;
|
||||||
|
if (_walletOptions.nameController.text.length >= 30) _nbrLinesName = 3;
|
||||||
|
|
||||||
|
// print(_walletOptions.generateQRcode(_walletOptions.pubkey.text));
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
Navigator.popUntil(
|
_walletOptions.isEditing = false;
|
||||||
context,
|
_walletOptions.isBalanceBlur = true;
|
||||||
ModalRoute.withName('/mywallets'),
|
Navigator.popUntil(
|
||||||
);
|
context,
|
||||||
return Future<bool>.value(true);
|
ModalRoute.withName('/mywallets'),
|
||||||
},
|
);
|
||||||
child: Scaffold(
|
return Future<bool>.value(true);
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.arrow_back, color: Colors.black),
|
icon: Icon(Icons.arrow_back, color: Colors.black),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
_walletOptions.isEditing = false;
|
||||||
|
_walletOptions.isBalanceBlur = true;
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/mywallets'),
|
ModalRoute.withName('/mywallets'),
|
||||||
|
@ -52,60 +78,196 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(walletName),
|
child: Text(_walletOptions.nameController.text),
|
||||||
)),
|
)),
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
child: Expanded(
|
child: Column(children: <Widget>[
|
||||||
child: Column(children: <Widget>[
|
SizedBox(height: 25),
|
||||||
SizedBox(height: 25),
|
Row(children: <Widget>[
|
||||||
Row(children: <Widget>[
|
SizedBox(width: 25),
|
||||||
SizedBox(width: 25),
|
Image.asset(
|
||||||
Image.asset(
|
'assets/chopp-gecko2.png',
|
||||||
'assets/chopp-gecko2.png',
|
),
|
||||||
),
|
Image.asset(
|
||||||
Image.asset(
|
'assets/walletOptions/camera.png',
|
||||||
'assets/walletOptions/camera.png',
|
),
|
||||||
),
|
// SizedBox(width: 20),
|
||||||
// SizedBox(width: 20),
|
Column(children: <Widget>[
|
||||||
Column(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
Column(children: <Widget>[
|
SizedBox(
|
||||||
SizedBox(
|
width: 250,
|
||||||
width: 250,
|
child: TextField(
|
||||||
child: Text(
|
// autofocus: true,
|
||||||
walletName,
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
textAlign: TextAlign.center,
|
enabled: _walletOptions.isEditing,
|
||||||
style: TextStyle(fontSize: 27),
|
controller: _walletOptions.nameController,
|
||||||
)),
|
maxLines: _nbrLinesName,
|
||||||
SizedBox(height: 5),
|
textAlign: TextAlign.center,
|
||||||
Text(
|
decoration: InputDecoration(
|
||||||
'500 DU',
|
border: InputBorder.none,
|
||||||
style: TextStyle(
|
focusedBorder: InputBorder.none,
|
||||||
fontSize: 20, color: Colors.black),
|
enabledBorder: InputBorder.none,
|
||||||
),
|
disabledBorder: InputBorder.none,
|
||||||
SizedBox(height: 5),
|
contentPadding: EdgeInsets.all(15.0),
|
||||||
Image.asset(
|
),
|
||||||
'assets/walletOptions/icon_oeuil.png',
|
style: TextStyle(
|
||||||
),
|
fontSize: 27,
|
||||||
]),
|
color: Colors.black,
|
||||||
SizedBox(width: 0),
|
fontWeight: FontWeight.w400)),
|
||||||
Column(children: <Widget>[
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/edit.png',
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/QR_icon.png',
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 5),
|
||||||
Row(children: <Widget>[
|
// Query(
|
||||||
|
// options: QueryOptions(
|
||||||
|
// document: gql(getBalance),
|
||||||
|
// variables: <String, dynamic>{
|
||||||
|
// 'pubkey': _walletOptions.pubkey.text,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// builder: (QueryResult result,
|
||||||
|
// {fetchMore, refetch}) {
|
||||||
|
// return Text(
|
||||||
|
// '$result DU',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 20, color: Colors.black),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(
|
||||||
|
getBalance), // this is the query string you just created
|
||||||
|
variables: {
|
||||||
|
'pubkey': _walletOptions.pubkey.text,
|
||||||
|
},
|
||||||
|
pollInterval: Duration(seconds: 1),
|
||||||
|
),
|
||||||
|
builder: (QueryResult result,
|
||||||
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
|
if (result.hasException) {
|
||||||
|
return Text(result.exception.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.isLoading) {
|
||||||
|
return Text('Loading');
|
||||||
|
}
|
||||||
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
|
String wBalanceUD;
|
||||||
|
if (result.data['balance'] == null) {
|
||||||
|
wBalanceUD = '0.0';
|
||||||
|
} else {
|
||||||
|
int wBalanceG1 = result.data['balance']['amount'];
|
||||||
|
int currentUD =
|
||||||
|
result.data['currentUd']['amount'];
|
||||||
|
double wBalanceUDBrut =
|
||||||
|
wBalanceG1 / currentUD; // .toString();
|
||||||
|
wBalanceUD = double.parse(
|
||||||
|
(wBalanceUDBrut).toStringAsFixed(2))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
return Row(children: <Widget>[
|
||||||
|
ImageFiltered(
|
||||||
|
imageFilter: ImageFilter.blur(
|
||||||
|
sigmaX:
|
||||||
|
_walletOptions.isBalanceBlur ? 6 : 0,
|
||||||
|
sigmaY:
|
||||||
|
_walletOptions.isBalanceBlur ? 5 : 0),
|
||||||
|
child: Text('$wBalanceUD',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, color: Colors.black)),
|
||||||
|
),
|
||||||
|
Text(' DU',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, color: Colors.black))
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Text(
|
||||||
|
// '$wBalanceUD DU',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 20, color: Colors.black),
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 5),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_walletOptions.bluringBalance();
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/walletOptions/icon_oeuil.png',
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
SizedBox(width: 0),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
// _walletOptions.isEditing = true;
|
||||||
|
// _walletOptions.reloadBuild();
|
||||||
|
// _walletOptions.walletNameFocus
|
||||||
|
// .requestFocus();
|
||||||
|
_isNewNameValid = await _walletOptions
|
||||||
|
.editWalletName(_walletOptions.walletID);
|
||||||
|
// .then((_) {
|
||||||
|
// _walletOptions.walletNameFocus
|
||||||
|
// .requestFocus();
|
||||||
|
// _walletOptions.reloadBuild();
|
||||||
|
// });
|
||||||
|
|
||||||
|
// .then(
|
||||||
|
// (_result) {
|
||||||
|
// if (_result == true) {
|
||||||
|
// WidgetsBinding.instance
|
||||||
|
// .addPostFrameCallback((_) {
|
||||||
|
// _myWalletProvider.listWallets =
|
||||||
|
// _myWalletProvider
|
||||||
|
// .getAllWalletsNames(
|
||||||
|
// _currentChest);
|
||||||
|
// _myWalletProvider.rebuildWidget();
|
||||||
|
// });
|
||||||
|
// Navigator.popUntil(
|
||||||
|
// context,
|
||||||
|
// ModalRoute.withName('/mywallets'),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
child: Image.asset(
|
||||||
|
_walletOptions.isEditing
|
||||||
|
? 'assets/walletOptions/android-checkmark.png'
|
||||||
|
: 'assets/walletOptions/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 20),
|
||||||
|
)),
|
||||||
|
// Image.asset(
|
||||||
|
// 'assets/walletOptions/edit.png',
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _walletOptions
|
||||||
|
.generateQRcode(_walletOptions.pubkey.text),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return snapshot.data != null
|
||||||
|
? Image.memory(snapshot.data, height: 300)
|
||||||
|
: Text('-', style: TextStyle(fontSize: 20));
|
||||||
|
}),
|
||||||
|
SizedBox(height: 15),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
|
_walletOptions.snackCopyKey(ctx);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
SizedBox(width: 30),
|
SizedBox(width: 30),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/walletOptions/key.png',
|
'assets/walletOptions/key.png',
|
||||||
|
@ -133,14 +295,22 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('COPY PUBKEY');
|
ClipboardData(text: _walletOptions.pubkey.text);
|
||||||
|
_walletOptions.snackCopyKey(ctx);
|
||||||
},
|
},
|
||||||
child: Text('Copier',
|
child: Text('Copier',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15, color: Colors.grey[50]))),
|
fontSize: 15, color: Colors.grey[50]))),
|
||||||
]),
|
]))),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
Row(children: <Widget>[
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
||||||
|
goHistory: true);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
SizedBox(width: 30),
|
SizedBox(width: 30),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/walletOptions/clock.png',
|
'assets/walletOptions/clock.png',
|
||||||
|
@ -149,9 +319,13 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
Text('Historique des transactions',
|
Text('Historique des transactions',
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 20, color: Colors.black)),
|
TextStyle(fontSize: 20, color: Colors.black)),
|
||||||
]),
|
]))),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
SizedBox(width: 35),
|
SizedBox(width: 35),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/walletOptions/android-checkmark.png',
|
'assets/walletOptions/android-checkmark.png',
|
||||||
|
@ -160,21 +334,31 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
Text('Portefeuille par defaut',
|
Text('Portefeuille par defaut',
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 20, color: Colors.black)),
|
TextStyle(fontSize: 20, color: Colors.black)),
|
||||||
]),
|
]))),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
InkWell(
|
||||||
SizedBox(width: 30),
|
onTap: () async {
|
||||||
Image.asset(
|
await _walletOptions.deleteWallet(
|
||||||
'assets/walletOptions/trash.png',
|
context, walletNbr, walletName, derivation);
|
||||||
),
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
SizedBox(width: 10),
|
_myWalletProvider.listWallets =
|
||||||
Text('Supprimer ce portefeuille',
|
_myWalletProvider.getAllWalletsNames(_currentChest);
|
||||||
style: TextStyle(
|
_myWalletProvider.rebuildWidget();
|
||||||
fontSize: 20, color: Color(0xffD80000))),
|
});
|
||||||
]),
|
},
|
||||||
]),
|
child: Row(children: <Widget>[
|
||||||
),
|
SizedBox(width: 30),
|
||||||
)),
|
Image.asset(
|
||||||
));
|
'assets/walletOptions/trash.png',
|
||||||
|
),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Text('Supprimer ce portefeuille',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, color: Color(0xffD80000))),
|
||||||
|
])),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,13 @@ class WalletsHome extends StatelessWidget {
|
||||||
|
|
||||||
if (_myWalletProvider.listWallets == '') {
|
if (_myWalletProvider.listWallets == '') {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Center(
|
child: Column(children: <Widget>[
|
||||||
child: Text(
|
Center(
|
||||||
'Veuillez générer votre premier portefeuille',
|
child: Text(
|
||||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
|
'Veuillez générer votre premier portefeuille',
|
||||||
)));
|
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
|
||||||
|
)),
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
||||||
|
|
|
@ -317,6 +317,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.3"
|
||||||
|
jdenticon_dart:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: jdenticon_dart
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.1+21
|
version: 0.0.1+22
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -45,6 +45,7 @@ dependencies:
|
||||||
flutter_svg: ^0.20.0-nullsafety
|
flutter_svg: ^0.20.0-nullsafety
|
||||||
responsive_framework: ^0.0.14
|
responsive_framework: ^0.0.14
|
||||||
responsive_builder: ^0.3.0
|
responsive_builder: ^0.3.0
|
||||||
|
jdenticon_dart: ^2.0.0
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "ic_launcher"
|
android: "ic_launcher"
|
||||||
|
|
Loading…
Reference in New Issue