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