WIP: Simple wallet Unlocking
This commit is contained in:
parent
8f7397626c
commit
d96b184e0a
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
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:gecko/screens/myWallets/unlockingWallet.dart';
|
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
@ -49,9 +48,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return barcode;
|
return barcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pay(amount, comment) {
|
void pay(context, amount, comment) {
|
||||||
UnlockingWallet();
|
|
||||||
|
|
||||||
String dewif = File(walletsDirectory.path +
|
String dewif = File(walletsDirectory.path +
|
||||||
'${defaultWallet.split(':')[0]}/wallet.dewif')
|
'${defaultWallet.split(':')[0]}/wallet.dewif')
|
||||||
.readAsLinesSync()[0];
|
.readAsLinesSync()[0];
|
||||||
|
|
|
@ -84,6 +84,22 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
return listWallets;
|
return listWallets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDerivationNbr(String _id) {
|
||||||
|
int chest = int.parse(_id.split(':')[0]);
|
||||||
|
// int nbr = int.parse(_id.split(':')[1]);
|
||||||
|
final _walletConfig = File('${walletsDirectory.path}/$chest/list.conf');
|
||||||
|
|
||||||
|
int derivation;
|
||||||
|
|
||||||
|
_walletConfig.readAsLinesSync().forEach((element) {
|
||||||
|
if ("${element.split(':')[0]}:${element.split(':')[1]}" == _id) {
|
||||||
|
derivation = int.parse(element.split(':')[3]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return derivation;
|
||||||
|
}
|
||||||
|
|
||||||
void getDefaultWallet() {
|
void getDefaultWallet() {
|
||||||
defaultWalletFile = File('${appPath.path}/defaultWallet');
|
defaultWalletFile = File('${appPath.path}/defaultWallet');
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,12 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
// if (_formKey.currentState.validate()) {
|
// if (_formKey.currentState.validate()) {
|
||||||
// _formKey.currentState.save();
|
// _formKey.currentState.save();
|
||||||
// }
|
// }
|
||||||
_historyProvider.pay(payAmount.text, payComment.text);
|
// _historyProvider.pay(payAmount.text, payComment.text);
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return UnlockingWallet(
|
||||||
|
walletNbr: int.parse(defaultWallet));
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
|
|
|
@ -13,12 +13,10 @@ import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class UnlockingWallet extends StatelessWidget {
|
class UnlockingWallet extends StatelessWidget {
|
||||||
UnlockingWallet(
|
UnlockingWallet({
|
||||||
{Key keyUnlockWallet,
|
Key keyUnlockWallet,
|
||||||
@required this.walletNbr,
|
@required this.walletNbr,
|
||||||
@required this.walletName,
|
}) : super(key: keyUnlockWallet);
|
||||||
@required this.derivation})
|
|
||||||
: super(key: keyUnlockWallet);
|
|
||||||
int walletNbr;
|
int walletNbr;
|
||||||
String walletName;
|
String walletName;
|
||||||
int derivation;
|
int derivation;
|
||||||
|
@ -146,10 +144,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
formKey.currentContext,
|
formKey.currentContext,
|
||||||
SmoothTransition(
|
SmoothTransition(
|
||||||
page: WalletOptions(
|
page: WalletOptions(walletNbr: walletNbr)));
|
||||||
walletNbr: walletNbr,
|
|
||||||
walletName: walletName,
|
|
||||||
derivation: derivation)));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|
|
@ -13,11 +13,7 @@ import 'package:flutter/services.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class WalletOptions extends StatelessWidget {
|
class WalletOptions extends StatelessWidget {
|
||||||
WalletOptions(
|
WalletOptions({Key keyMyWallets, @required this.walletNbr})
|
||||||
{Key keyMyWallets,
|
|
||||||
@required this.walletNbr,
|
|
||||||
@required this.walletName,
|
|
||||||
@required this.derivation})
|
|
||||||
: super(key: keyMyWallets);
|
: super(key: keyMyWallets);
|
||||||
int walletNbr;
|
int walletNbr;
|
||||||
String walletName;
|
String walletName;
|
||||||
|
|
|
@ -108,9 +108,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return UnlockingWallet(
|
return UnlockingWallet(
|
||||||
walletNbr: int.parse(_repository.split(':')[1]),
|
walletNbr: int.parse(_repository.split(':')[1]));
|
||||||
walletName: _repository.split(':')[2],
|
|
||||||
derivation: int.parse(_repository.split(':')[3]));
|
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
|
@ -165,10 +163,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return UnlockingWallet(
|
return UnlockingWallet(
|
||||||
walletNbr:
|
walletNbr:
|
||||||
int.parse(_repository.split(':')[1]),
|
int.parse(_repository.split(':')[1]));
|
||||||
walletName: _repository.split(':')[2],
|
|
||||||
derivation:
|
|
||||||
int.parse(_repository.split(':')[3]));
|
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue