Merge branch 'improvePaymentUX'
This commit is contained in:
commit
a6c9947b32
|
@ -24,6 +24,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
// configBox.delete('endpoint');
|
// configBox.delete('endpoint');
|
||||||
if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == '') {
|
if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == '') {
|
||||||
log.d('No endpoint, configure...');
|
log.d('No endpoint, configure...');
|
||||||
|
// configBox.put('endpoint', 'wss://gdev.librelois.fr/ws');
|
||||||
configBox.put('endpoint', 'ws://127.0.0.1:9944');
|
configBox.put('endpoint', 'ws://127.0.0.1:9944');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +63,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 {
|
||||||
|
chest ??= getCurrentChest();
|
||||||
int? defaultWalletNumber = chestBox.get(chest)!.defaultWallet;
|
int? defaultWalletNumber = chestBox.get(chest)!.defaultWallet;
|
||||||
return getWalletData([chest, defaultWalletNumber]);
|
return getWalletData([chest, defaultWalletNumber]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
bool importIsLoading = false;
|
bool importIsLoading = false;
|
||||||
int blocNumber = 0;
|
int blocNumber = 0;
|
||||||
bool isLoadingEndpoint = false;
|
bool isLoadingEndpoint = false;
|
||||||
|
String debugConnection = '';
|
||||||
|
String transactionStatus = '';
|
||||||
|
|
||||||
TextEditingController jsonKeystore = TextEditingController();
|
TextEditingController jsonKeystore = TextEditingController();
|
||||||
TextEditingController keystorePassword = TextEditingController();
|
TextEditingController keystorePassword = TextEditingController();
|
||||||
|
@ -48,7 +50,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
n.endpoint = configBox.get('endpoint');
|
n.endpoint = configBox.get('endpoint');
|
||||||
n.ss58 = ss58;
|
n.ss58 = ss58;
|
||||||
node.add(n);
|
node.add(n);
|
||||||
int timeout = 7000;
|
int timeout = 10000;
|
||||||
|
|
||||||
// if (n.endpoint!.startsWith('ws://')) {
|
// if (n.endpoint!.startsWith('ws://')) {
|
||||||
// timeout = 5000;
|
// timeout = 5000;
|
||||||
|
@ -85,20 +87,19 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
nodeConnected = true;
|
nodeConnected = true;
|
||||||
notifyListeners();
|
|
||||||
snackNode(ctx, true);
|
|
||||||
} else {
|
|
||||||
nodeConnected = false;
|
|
||||||
notifyListeners();
|
|
||||||
snackNode(ctx, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subscribe bloc number
|
// Subscribe bloc number
|
||||||
if (nodeConnected) {
|
|
||||||
sdk.api.setting.subscribeBestNumber((res) {
|
sdk.api.setting.subscribeBestNumber((res) {
|
||||||
blocNumber = int.parse(res.toString());
|
blocNumber = int.parse(res.toString());
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
|
notifyListeners();
|
||||||
|
snackNode(ctx, true);
|
||||||
|
} else {
|
||||||
|
nodeConnected = false;
|
||||||
|
debugConnection = res.toString();
|
||||||
|
notifyListeners();
|
||||||
|
snackNode(ctx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.d(sdk.api.connectedNode?.endpoint);
|
log.d(sdk.api.connectedNode?.endpoint);
|
||||||
|
@ -299,6 +300,8 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
required String destAddress,
|
required String destAddress,
|
||||||
required double amount,
|
required double amount,
|
||||||
required String password}) async {
|
required String password}) async {
|
||||||
|
transactionStatus = '';
|
||||||
|
|
||||||
setCurrentWallet(fromAddress);
|
setCurrentWallet(fromAddress);
|
||||||
|
|
||||||
log.d(keyring.current.address);
|
log.d(keyring.current.address);
|
||||||
|
@ -317,15 +320,31 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
[destAddress, amount * 100],
|
[destAddress, amount * 100],
|
||||||
password,
|
password,
|
||||||
onStatusChange: (status) {
|
onStatusChange: (status) {
|
||||||
print('status: ' + status);
|
log.d('Transaction status: ' + status);
|
||||||
if (status == 'Ready') {
|
if (status == 'Ready') {
|
||||||
snack(context, 'Transaction terminé');
|
transactionStatus = 'sent';
|
||||||
|
notifyListeners();
|
||||||
|
// snack(context, 'Transaction terminé');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
).timeout(
|
||||||
|
const Duration(seconds: 12),
|
||||||
|
onTimeout: () => {},
|
||||||
);
|
);
|
||||||
print(hash.toString());
|
print(hash.toString());
|
||||||
return 'confirmed';
|
if (hash.isEmpty) {
|
||||||
|
transactionStatus = 'timeout';
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
return 'timeout';
|
||||||
|
} else {
|
||||||
|
transactionStatus = hash.toString();
|
||||||
|
notifyListeners();
|
||||||
|
return hash.toString();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
transactionStatus = e.toString();
|
||||||
|
notifyListeners();
|
||||||
return e.toString();
|
return e.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,12 +390,12 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final tata = await sdk.api.tx.signAndSend(
|
final result = await sdk.api.tx.signAndSend(
|
||||||
txInfo,
|
txInfo,
|
||||||
[name],
|
[name],
|
||||||
password,
|
password,
|
||||||
);
|
);
|
||||||
log.d(tata);
|
log.d(result);
|
||||||
return 'confirmed';
|
return 'confirmed';
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
log.e(e);
|
log.e(e);
|
||||||
|
|
|
@ -265,6 +265,10 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
|
|
||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reload() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snackCopyKey(context) {
|
snackCopyKey(context) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CommonElements {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
width: 440,
|
width: 440,
|
||||||
height: boxHeight,
|
height: isTall ? boxHeight : boxHeight * 0.9,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
|
@ -37,7 +37,9 @@ class CommonElements {
|
||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size, color: Colors.black, letterSpacing: 0.3),
|
fontSize: isTall ? size : size * 0.9,
|
||||||
|
color: Colors.black,
|
||||||
|
letterSpacing: 0.3),
|
||||||
children: text,
|
children: text,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -47,8 +49,8 @@ class CommonElements {
|
||||||
Widget nextButton(
|
Widget nextButton(
|
||||||
BuildContext context, String text, nextScreen, bool isFast) {
|
BuildContext context, String text, nextScreen, bool isFast) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
|
@ -61,7 +63,7 @@ class CommonElements {
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 23 * ratio, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -105,7 +107,7 @@ class CommonElements {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// const SizedBox(height: 40),
|
// const SizedBox(height: 40),
|
||||||
SizedBox(height: isTall ? 40 : 10),
|
SizedBox(height: isTall ? 40 : 20),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,11 +221,12 @@ Widget geckHome(context) {
|
||||||
child: Material(
|
child: Material(
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(18),
|
padding: const EdgeInsets.all(18),
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage('assets/home/loupe.png'),
|
image:
|
||||||
height: 70),
|
const AssetImage('assets/home/loupe.png'),
|
||||||
|
height: 62 * ratio),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -249,12 +250,12 @@ Widget geckHome(context) {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
const Text(
|
Text(
|
||||||
"Rechercher un\nportefeuille",
|
"Rechercher un\nportefeuille",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 17,
|
fontSize: 15 * ratio,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
|
@ -266,15 +267,15 @@ Widget geckHome(context) {
|
||||||
child: Material(
|
child: Material(
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(18),
|
padding: const EdgeInsets.all(18),
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage('assets/home/wallet.png'),
|
image: const AssetImage(
|
||||||
height: 75)),
|
'assets/home/wallet.png'),
|
||||||
|
height: 68 * ratio)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(
|
_myWalletProvider.getDefaultWallet();
|
||||||
configBox.get('currentChest'));
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
@ -304,18 +305,18 @@ Widget geckHome(context) {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
const Text(
|
Text(
|
||||||
"Gérer mes\nportefeuilles",
|
"Gérer mes\nportefeuilles",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 17,
|
fontSize: 15 * ratio,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 40),
|
padding: EdgeInsets.only(top: 35 * ratio),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -325,12 +326,12 @@ Widget geckHome(context) {
|
||||||
child: Material(
|
child: Material(
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(18),
|
padding: const EdgeInsets.all(18),
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage(
|
image: const AssetImage(
|
||||||
'assets/home/qrcode.png'),
|
'assets/home/qrcode.png'),
|
||||||
height: 75)),
|
height: 68 * ratio)),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _historyProvider.scan(context);
|
await _historyProvider.scan(context);
|
||||||
}),
|
}),
|
||||||
|
@ -348,12 +349,12 @@ Widget geckHome(context) {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
const Text(
|
Text(
|
||||||
"Scanner un\nQR code",
|
"Scanner un\nQR code",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 17,
|
fontSize: 15 * ratio,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|
|
@ -3,9 +3,10 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/myWallets/generate_wallets.dart';
|
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
|
import 'package:gecko/screens/onBoarding/5.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ChooseChest extends StatefulWidget {
|
class ChooseChest extends StatefulWidget {
|
||||||
|
@ -114,7 +115,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();
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
Navigator.pushAndRemoveUntil(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
|
@ -136,28 +137,54 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
// const SizedBox(height: 20),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: InkWell(
|
||||||
|
key: const Key('createNewChest'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return const OnboardingStepFive(skipIntro: true);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: 400,
|
||||||
|
height: 50,
|
||||||
|
child: Center(
|
||||||
|
child: Text('Créer un nouveau coffre',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: orangeC,
|
||||||
|
fontWeight: FontWeight.w600))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
key: const Key('createNewChest'),
|
key: const Key('importChest'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return GenerateFastChestScreen();
|
return const RestoreChest(skipIntro: true);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 70,
|
height: 50,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text('Créer un nouveau coffre',
|
child: Text('Importer un coffre',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
color: orangeC,
|
color: orangeC,
|
||||||
fontWeight: FontWeight.w600))),
|
fontWeight: FontWeight.w600))),
|
||||||
)),
|
)),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 20),
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
|
||||||
WalletsProfilesProvider _walletViewProvider =
|
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
|
||||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
@ -50,19 +48,12 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final acc = _sub.getCurrentWallet();
|
Navigator.pop(context);
|
||||||
log.d(
|
Navigator.pop(context);
|
||||||
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.outputPubkey.text}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $pin");
|
Navigator.pop(context);
|
||||||
final resultPay = await _sub.pay(context,
|
|
||||||
fromAddress: acc.address!,
|
|
||||||
destAddress: _walletViewProvider.outputPubkey.text,
|
|
||||||
amount:
|
|
||||||
double.parse(_walletViewProvider.payAmount.text),
|
|
||||||
password: pin.toUpperCase());
|
|
||||||
await paymentsResult(context, resultPay);
|
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'Valider le paiement',
|
'Choisir ce portefeuille',
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
|
TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
|
@ -80,9 +71,11 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
WalletsProfilesProvider _walletViewProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(currentChest);
|
_myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
_selectedId ??= defaultWallet!.id();
|
_selectedId ??= defaultWallet!.id();
|
||||||
_derivation ??= defaultWallet!.derivation!;
|
_derivation ??= defaultWallet!.derivation!;
|
||||||
|
@ -129,8 +122,12 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_derivation = _repository.derivation!;
|
_derivation = _repository.derivation!;
|
||||||
_selectedId = _repository.id();
|
_selectedId = _repository.id();
|
||||||
|
chestBox.get(currentChest)!.defaultWallet =
|
||||||
|
_repository.number;
|
||||||
|
|
||||||
_sub.setCurrentWallet(_repository.address!);
|
_sub.setCurrentWallet(_repository.address!);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
|
_walletViewProvider.reload();
|
||||||
},
|
},
|
||||||
child: ClipOvalShadow(
|
child: ClipOvalShadow(
|
||||||
shadow: const Shadow(
|
shadow: const Shadow(
|
||||||
|
@ -196,8 +193,13 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_derivation = _repository.derivation!;
|
_derivation = _repository.derivation!;
|
||||||
_selectedId = _repository.id();
|
_selectedId = _repository.id();
|
||||||
|
chestBox.get(currentChest)!.defaultWallet =
|
||||||
|
_repository.number;
|
||||||
|
|
||||||
_sub.setCurrentWallet(_repository.address!);
|
_sub.setCurrentWallet(_repository.address!);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
|
_walletViewProvider.reload();
|
||||||
|
_sub.reload();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
|
@ -208,34 +210,3 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> paymentsResult(context, String resultPay) {
|
|
||||||
final bool isValid = resultPay == "confirmed";
|
|
||||||
if (!isValid) log.e(resultPay);
|
|
||||||
|
|
||||||
return showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: true, // user must tap button!
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(isValid
|
|
||||||
? 'Paiement effecuté avec succès !'
|
|
||||||
: "Une erreur s'est produite lors du paiement:\n$resultPay"),
|
|
||||||
content: const SingleChildScrollView(child: Text('')),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: const Text("OK"),
|
|
||||||
onPressed: () async {
|
|
||||||
isValid
|
|
||||||
? await Navigator.of(context).pushNamedAndRemoveUntil(
|
|
||||||
'/',
|
|
||||||
ModalRoute.withName('/'),
|
|
||||||
)
|
|
||||||
: Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -164,10 +164,8 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
Navigator.pushAndRemoveUntil(context,
|
Navigator.pushAndRemoveUntil(context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return UnlockingWallet(
|
return UnlockingWallet(
|
||||||
wallet:
|
wallet: _myWalletProvider
|
||||||
_myWalletProvider.getDefaultWallet(
|
.getDefaultWallet(),
|
||||||
configBox.get('currentChest'),
|
|
||||||
),
|
|
||||||
action: "mywallets",
|
action: "mywallets",
|
||||||
);
|
);
|
||||||
}), ModalRoute.withName('/'));
|
}), ModalRoute.withName('/'));
|
||||||
|
|
|
@ -1,222 +0,0 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:gecko/globals.dart';
|
|
||||||
import 'package:gecko/providers/generate_wallets.dart';
|
|
||||||
import 'package:gecko/screens/myWallets/confirm_wallet_storage.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
|
||||||
class GenerateFastChestScreen extends StatelessWidget {
|
|
||||||
bool hasError = false;
|
|
||||||
String validPin = 'NO PIN';
|
|
||||||
String currentText = "";
|
|
||||||
var pinColor = Colors.grey[300];
|
|
||||||
|
|
||||||
final GlobalKey _toolTipSentence = GlobalKey();
|
|
||||||
final GlobalKey _toolTipSecret = GlobalKey();
|
|
||||||
|
|
||||||
GenerateFastChestScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
|
||||||
|
|
||||||
_generateWalletProvider.pin.text = kDebugMode && debugPin
|
|
||||||
? 'AAAAA'
|
|
||||||
: _generateWalletProvider.changePinCode(reload: false).toUpperCase();
|
|
||||||
|
|
||||||
return WillPopScope(
|
|
||||||
onWillPop: () {
|
|
||||||
_generateWalletProvider.pin.text = '';
|
|
||||||
_generateWalletProvider.mnemonicController.text = '';
|
|
||||||
return Future<bool>.value(true);
|
|
||||||
},
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
toolbarHeight: 60 * ratio,
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
|
||||||
onPressed: () {
|
|
||||||
_generateWalletProvider.pin.text = '';
|
|
||||||
_generateWalletProvider.mnemonicController.text = '';
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
title: const SizedBox(
|
|
||||||
height: 22,
|
|
||||||
child: Text('Générer un coffre'),
|
|
||||||
)),
|
|
||||||
floatingActionButton: SizedBox(
|
|
||||||
height: 80.0,
|
|
||||||
width: 80.0,
|
|
||||||
child: FittedBox(
|
|
||||||
child: FloatingActionButton(
|
|
||||||
heroTag: "buttonGenerateWallet",
|
|
||||||
onPressed: () {
|
|
||||||
_generateWalletProvider.reloadBuild();
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 40.0,
|
|
||||||
width: 40.0,
|
|
||||||
child: Icon(Icons.replay, color: Colors.grey[850]),
|
|
||||||
),
|
|
||||||
backgroundColor:
|
|
||||||
floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255),
|
|
||||||
))),
|
|
||||||
body: Builder(
|
|
||||||
builder: (ctx) => SafeArea(
|
|
||||||
child: Column(children: <Widget>[
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
|
||||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
|
||||||
Consumer<GenerateWalletsProvider>(builder: (context, _gWP, _) {
|
|
||||||
return FutureBuilder(
|
|
||||||
future: _gWP.generateWordList(context),
|
|
||||||
builder: (BuildContext context, AsyncSnapshot<List> _data) {
|
|
||||||
if (!_data.hasData) {
|
|
||||||
return const Text('');
|
|
||||||
} else {
|
|
||||||
return Text(_gWP.generatedMnemonic!,
|
|
||||||
maxLines: 3,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
toolTips(_toolTipSecret, 'Code secret:',
|
|
||||||
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
|
|
||||||
Stack(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
children: <Widget>[
|
|
||||||
TextField(
|
|
||||||
key: const Key('generatedPin'),
|
|
||||||
enabled: false,
|
|
||||||
controller: _generateWalletProvider.pin,
|
|
||||||
maxLines: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: const InputDecoration(),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 30.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.replay),
|
|
||||||
color: orangeC,
|
|
||||||
onPressed: () {
|
|
||||||
_generateWalletProvider.changePinCode(reload: false);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
ElevatedButton(
|
|
||||||
key: const Key('storeKeychain'),
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
primary: yellowC, // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
|
||||||
onPressed: _generateWalletProvider.walletIsGenerated
|
|
||||||
? () async {
|
|
||||||
_generateWalletProvider.nbrWord =
|
|
||||||
_generateWalletProvider.getRandomInt();
|
|
||||||
await Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return ConfirmStoreWallet(
|
|
||||||
generatedMnemonic:
|
|
||||||
_generateWalletProvider.generatedMnemonic,
|
|
||||||
generatedWallet:
|
|
||||||
_generateWalletProvider.actualWallet);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
child: const Text('Enregistrer ce coffre',
|
|
||||||
style: TextStyle(fontSize: 20))),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
// GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(builder: (context) {
|
|
||||||
// return PrintWallet(
|
|
||||||
// _generateWalletProvider.generatedMnemonic);
|
|
||||||
// }),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// child: const Icon(Icons.print))
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget toolTips(_key, _text, _message) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
final dynamic _toolTip = _key.currentState;
|
|
||||||
_toolTip.ensureTooltipVisible();
|
|
||||||
},
|
|
||||||
child: Tooltip(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
key: _key,
|
|
||||||
showDuration: const Duration(seconds: 5),
|
|
||||||
message: _message,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
SizedBox(
|
|
||||||
width: 30,
|
|
||||||
height: 25,
|
|
||||||
child:
|
|
||||||
Icon(Icons.info_outline, size: 22, color: orangeC)),
|
|
||||||
const SizedBox(height: 1)
|
|
||||||
]),
|
|
||||||
Text(
|
|
||||||
_text,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15.0,
|
|
||||||
color: Colors.grey[600],
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 45)
|
|
||||||
])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// // ignore: must_be_immutable
|
|
||||||
// class PrintWallet extends StatelessWidget {
|
|
||||||
// const PrintWallet(this.sentence, {Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// final String? sentence;
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// GenerateWalletsProvider _generateWalletProvider =
|
|
||||||
// Provider.of<GenerateWalletsProvider>(context);
|
|
||||||
// return MaterialApp(
|
|
||||||
// home: Scaffold(
|
|
||||||
// appBar: AppBar(
|
|
||||||
// leading: IconButton(
|
|
||||||
// icon: const Icon(Icons.arrow_back, color: Colors.white),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// }),
|
|
||||||
// toolbarHeight: 60 * ratio,
|
|
||||||
// title: const Text('Imprimer ce coffre')),
|
|
||||||
// body: PdfPreview(
|
|
||||||
// build: (format) => _generateWalletProvider.printWallet(sentence),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -5,13 +5,15 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/providers/generate_wallets.dart';
|
import 'package:gecko/providers/generate_wallets.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
|
import 'package:gecko/screens/onBoarding/7.dart';
|
||||||
import 'package:gecko/screens/onBoarding/9.dart';
|
import 'package:gecko/screens/onBoarding/9.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
// import 'package:gecko/models/home.dart';
|
// import 'package:gecko/models/home.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, this.skipIntro = false}) : super(key: key);
|
||||||
|
final bool skipIntro;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -98,7 +100,9 @@ class RestoreChest extends StatelessWidget {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
page: const OnboardingStepThirteen(),
|
page: skipIntro
|
||||||
|
? const OnboardingStepNine()
|
||||||
|
: const OnboardingStepSeven(),
|
||||||
isFast: true),
|
isFast: true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,9 +8,11 @@ import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/providers/wallet_options.dart';
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:gecko/screens/myWallets/choose_chest.dart';
|
import 'package:gecko/screens/myWallets/choose_chest.dart';
|
||||||
import 'package:gecko/screens/myWallets/choose_wallet.dart';
|
import 'package:gecko/screens/myWallets/choose_wallet.dart';
|
||||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||||
|
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -212,21 +214,49 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
pinFocus.requestFocus();
|
pinFocus.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
if (action == "mywallets") {
|
switch (action) {
|
||||||
Navigator.push(
|
case "mywallets":
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) {
|
context,
|
||||||
return const WalletsHome();
|
MaterialPageRoute(builder: (context) {
|
||||||
}),
|
return const WalletsHome();
|
||||||
);
|
}),
|
||||||
} else if (action == "pay") {
|
);
|
||||||
Navigator.push(
|
break;
|
||||||
context,
|
case "changeWallet":
|
||||||
MaterialPageRoute(builder: (context) {
|
Navigator.push(
|
||||||
return ChooseWalletScreen(
|
context,
|
||||||
chest: currentChestNumber, pin: _pin.toUpperCase());
|
MaterialPageRoute(builder: (context) {
|
||||||
}),
|
return ChooseWalletScreen(
|
||||||
);
|
chest: currentChestNumber, pin: _pin.toUpperCase());
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "pay":
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// Payment workflow !
|
||||||
|
WalletsProfilesProvider _walletViewProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context,
|
||||||
|
listen: false);
|
||||||
|
final acc = _sub.getCurrentWallet();
|
||||||
|
log.d(
|
||||||
|
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.outputPubkey.text}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $_pin");
|
||||||
|
_sub.pay(context,
|
||||||
|
fromAddress: acc.address!,
|
||||||
|
destAddress: _walletViewProvider.outputPubkey.text,
|
||||||
|
amount:
|
||||||
|
double.parse(_walletViewProvider.payAmount.text),
|
||||||
|
password: _pin.toUpperCase());
|
||||||
|
// await paymentsResult(context, resultPay);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return TransactionInProgress(
|
||||||
|
chest: currentChestNumber, pin: _pin.toUpperCase());
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,7 +29,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest()!;
|
final int _currentChest = _myWalletProvider.getCurrentChest()!;
|
||||||
|
|
||||||
// final currentWallet = _myWalletProvider.getDefaultWallet(_currentChest);
|
// final currentWallet = _myWalletProvider.getDefaultWallet();
|
||||||
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
||||||
log.d("Wallet options: $_currentChest:${wallet.derivation}");
|
log.d("Wallet options: $_currentChest:${wallet.derivation}");
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
WalletOptionsProvider _walletOptions,
|
WalletOptionsProvider _walletOptions,
|
||||||
int _currentChest) {
|
int _currentChest) {
|
||||||
WalletData defaultWallet =
|
WalletData defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(_currentChest)!;
|
_myWalletProvider.getDefaultWallet()!;
|
||||||
|
|
||||||
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets;
|
List _listWallets = _myWalletProvider.listWallets;
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
_myWalletProvider.getDefaultWallet();
|
||||||
final double screenWidth = MediaQuery.of(context).size.width;
|
final double screenWidth = MediaQuery.of(context).size.width;
|
||||||
int nTule = 2;
|
int nTule = 2;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import 'package:pin_code_fields/pin_code_fields.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepFourteen extends StatelessWidget {
|
class OnboardingStepTen extends StatelessWidget {
|
||||||
OnboardingStepFourteen({
|
OnboardingStepTen({
|
||||||
Key? validationKey,
|
Key? validationKey,
|
||||||
}) : super(key: validationKey);
|
}) : super(key: validationKey);
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
page: const OnboardingStepFiveteen(), isFast: false),
|
page: const OnboardingStepEleven(), isFast: false),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
errorController.add(ErrorAnimationType
|
errorController.add(ErrorAnimationType
|
||||||
|
|
|
@ -7,8 +7,8 @@ import 'package:gecko/screens/common_elements.dart';
|
||||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepFiveteen extends StatelessWidget {
|
class OnboardingStepEleven extends StatelessWidget {
|
||||||
const OnboardingStepFiveteen({Key? key}) : super(key: key);
|
const OnboardingStepEleven({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -54,8 +54,8 @@ class OnboardingStepFiveteen extends StatelessWidget {
|
||||||
|
|
||||||
Widget finishButton(BuildContext context) {
|
Widget finishButton(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
key: const Key('goWalletHome'),
|
key: const Key('goWalletHome'),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
@ -72,7 +72,8 @@ Widget finishButton(BuildContext context) {
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text("Accéder à mon coffre",
|
child: Text("Accéder à mon coffre",
|
||||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600))),
|
style:
|
||||||
|
TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@ import 'package:provider/provider.dart';
|
||||||
AsyncSnapshot<List>? mnemoList;
|
AsyncSnapshot<List>? mnemoList;
|
||||||
|
|
||||||
class OnboardingStepFive extends StatelessWidget {
|
class OnboardingStepFive extends StatelessWidget {
|
||||||
const OnboardingStepFive({Key? key}) : super(key: key);
|
const OnboardingStepFive({Key? key, this.skipIntro = false})
|
||||||
|
: super(key: key);
|
||||||
|
final bool skipIntro;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -47,9 +49,9 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
'Gecko a généré votre phrase de restauration ! Tâchez de la garder bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.'),
|
'Gecko a généré votre phrase de restauration ! Tâchez de la garder bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40),
|
SizedBox(height: 35 * ratio),
|
||||||
sentanceArray(context),
|
sentanceArray(context),
|
||||||
const SizedBox(height: 20),
|
SizedBox(height: 17 * ratio),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -61,7 +63,7 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/printer.png',
|
'assets/printer.png',
|
||||||
height: 45,
|
height: 42 * ratio,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
|
@ -69,8 +71,8 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
key: const Key('generateMnemonic'),
|
key: const Key('generateMnemonic'),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
@ -82,15 +84,16 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
_generateWalletProvider.reloadBuild();
|
_generateWalletProvider.reloadBuild();
|
||||||
// setState(() {});
|
// setState(() {});
|
||||||
},
|
},
|
||||||
child: const Text("Choisir une autre phrase",
|
child: Text("Choisir une autre phrase",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24, fontWeight: FontWeight.w600))),
|
fontSize: 22 * ratio,
|
||||||
|
fontWeight: FontWeight.w600))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
SizedBox(height: 22 * ratio),
|
||||||
nextButton(context, "J'ai noté ma phrase", false),
|
nextButton(context, "J'ai noté ma phrase", false, skipIntro),
|
||||||
const SizedBox(height: 40),
|
SizedBox(height: 35 * ratio),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -157,12 +160,12 @@ Widget arrayCell(dataWord) {
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
dataWord.split(':')[0],
|
dataWord.split(':')[0],
|
||||||
style: const TextStyle(fontSize: 15, color: Color(0xff6b6b52)),
|
style: TextStyle(fontSize: 13 * ratio, color: const Color(0xff6b6b52)),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
dataWord.split(':')[1],
|
dataWord.split(':')[1],
|
||||||
key: Key('word${dataWord.split(':')[0]}'),
|
key: Key('word${dataWord.split(':')[0]}'),
|
||||||
style: const TextStyle(fontSize: 20, color: Colors.black),
|
style: TextStyle(fontSize: 17 * ratio, color: Colors.black),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
@ -207,14 +210,15 @@ class PrintWallet extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget nextButton(BuildContext context, String text, bool isFast) {
|
Widget nextButton(
|
||||||
|
BuildContext context, String text, bool isFast, bool skipIntro) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
|
@ -232,13 +236,14 @@ Widget nextButton(BuildContext context, String text, bool isFast) {
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
page: OnboardingStepSix(
|
page: OnboardingStepSix(
|
||||||
generatedMnemonic: _generateWalletProvider.generatedMnemonic),
|
generatedMnemonic: _generateWalletProvider.generatedMnemonic,
|
||||||
|
skipIntro: skipIntro),
|
||||||
isFast: true),
|
isFast: true),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,13 +6,16 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/providers/generate_wallets.dart';
|
import 'package:gecko/providers/generate_wallets.dart';
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
import 'package:gecko/screens/onBoarding/7.dart';
|
import 'package:gecko/screens/onBoarding/7.dart';
|
||||||
|
import 'package:gecko/screens/onBoarding/9.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepSix extends StatelessWidget {
|
class OnboardingStepSix extends StatelessWidget {
|
||||||
OnboardingStepSix({Key? key, required this.generatedMnemonic})
|
OnboardingStepSix(
|
||||||
|
{Key? key, required this.skipIntro, required this.generatedMnemonic})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
|
final bool skipIntro;
|
||||||
String? generatedMnemonic;
|
String? generatedMnemonic;
|
||||||
TextEditingController wordController = TextEditingController();
|
TextEditingController wordController = TextEditingController();
|
||||||
final TextEditingController _mnemonicController = TextEditingController();
|
final TextEditingController _mnemonicController = TextEditingController();
|
||||||
|
@ -116,8 +119,13 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
child: Expanded(
|
child: Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: nextButton(context, 'Continuer',
|
child: nextButton(
|
||||||
const OnboardingStepSeven(), false),
|
context,
|
||||||
|
'Continuer',
|
||||||
|
skipIntro
|
||||||
|
? const OnboardingStepNine()
|
||||||
|
: const OnboardingStepSeven(),
|
||||||
|
false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -130,7 +138,7 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
const SizedBox(height: 40),
|
SizedBox(height: 35 * ratio),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -217,8 +225,8 @@ Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
||||||
_generateWalletProvider.askedWordColor = Colors.black;
|
_generateWalletProvider.askedWordColor = Colors.black;
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
|
|
|
@ -40,7 +40,7 @@ class OnboardingStepEight extends StatelessWidget {
|
||||||
],
|
],
|
||||||
'coffre-fort-protege-les-portefeuilles.png',
|
'coffre-fort-protege-les-portefeuilles.png',
|
||||||
'>',
|
'>',
|
||||||
const OnboardingStepThirteen(),
|
const OnboardingStepNine(),
|
||||||
7),
|
7),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,8 +9,8 @@ import 'package:gecko/screens/onBoarding/10.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class OnboardingStepThirteen extends StatelessWidget {
|
class OnboardingStepNine extends StatelessWidget {
|
||||||
const OnboardingStepThirteen({Key? key}) : super(key: key);
|
const OnboardingStepNine({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -84,8 +84,8 @@ class OnboardingStepThirteen extends StatelessWidget {
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 410,
|
width: 380 * ratio,
|
||||||
height: 70,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
key: const Key('changeSecretCode'),
|
key: const Key('changeSecretCode'),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
@ -96,14 +96,15 @@ class OnboardingStepThirteen extends StatelessWidget {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_generateWalletProvider.changePinCode(reload: true);
|
_generateWalletProvider.changePinCode(reload: true);
|
||||||
},
|
},
|
||||||
child: const Text("Choisir un autre code secret",
|
child: Text("Choisir un autre code secret",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24, fontWeight: FontWeight.w600))),
|
fontSize: 22 * ratio,
|
||||||
|
fontWeight: FontWeight.w600))),
|
||||||
))),
|
))),
|
||||||
const SizedBox(height: 25),
|
SizedBox(height: 22 * ratio),
|
||||||
common.nextButton(context, "J'ai noté mon code secret",
|
common.nextButton(context, "J'ai noté mon code secret",
|
||||||
OnboardingStepFourteen(), false),
|
OnboardingStepTen(), false),
|
||||||
const SizedBox(height: 40),
|
SizedBox(height: 35 * ratio),
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ import 'package:durt/durt.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/screens/myWallets/generate_wallets.dart';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
// import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
|
// import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||||
|
import 'package:gecko/screens/onBoarding/5.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
|
@ -91,7 +91,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return GenerateFastChestScreen();
|
return const OnboardingStepFive(skipIntro: true);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
@ -114,7 +114,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return const RestoreChest();
|
return const RestoreChest(skipIntro: true);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
|
|
@ -160,7 +160,10 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
_sub.generatedMnemonic,
|
_sub.generatedMnemonic,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
const Text('--------'),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(_sub.debugConnection)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
// import 'package:gecko/models/home.dart';
|
||||||
|
// import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class TransactionInProgress extends StatelessWidget {
|
||||||
|
const TransactionInProgress(
|
||||||
|
{Key? key, required this.chest, required this.pin})
|
||||||
|
: super(key: key);
|
||||||
|
final int chest;
|
||||||
|
final String pin;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: true);
|
||||||
|
WalletsProfilesProvider _walletViewProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
MyWalletsProvider _myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
|
String _resultText;
|
||||||
|
bool isLoading = true;
|
||||||
|
// Map jsonResult;
|
||||||
|
final _result = _sub.transactionStatus;
|
||||||
|
|
||||||
|
final from = _myWalletProvider.getDefaultWallet()!.name!;
|
||||||
|
final to = _walletViewProvider
|
||||||
|
.getShortPubkey(_walletViewProvider.outputPubkey.text);
|
||||||
|
final amount = _walletViewProvider.payAmount.text;
|
||||||
|
|
||||||
|
switch (_result) {
|
||||||
|
case '':
|
||||||
|
{
|
||||||
|
_resultText = 'Envoi en cours ...';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'sent':
|
||||||
|
{
|
||||||
|
_resultText = 'En cours de validation ...';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
isLoading = false;
|
||||||
|
// jsonResult = json.decode(_result);
|
||||||
|
log.d(_result);
|
||||||
|
if (_result.contains('blockHash: ')) {
|
||||||
|
_resultText = 'Transcation validé !';
|
||||||
|
} else {
|
||||||
|
_resultText = "Une erreur s'est produite:\n\n$_result";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () {
|
||||||
|
_sub.transactionStatus = '';
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
return Future<bool>.value(true);
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
elevation: 0,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title: SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const <Widget>[Text('Transaction en cours')]),
|
||||||
|
)),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Align(
|
||||||
|
alignment: FractionalOffset.bottomCenter,
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
yellowC,
|
||||||
|
const Color(0xfffafafa),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
'$amount $currencyName',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text(
|
||||||
|
'de',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
from,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text(
|
||||||
|
'vers',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
to,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 20, width: double.infinity),
|
||||||
|
const Spacer(),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
|
Text(
|
||||||
|
_resultText,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 19 * ratio),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: isLoading,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 15,
|
||||||
|
width: 15,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: orangeC,
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: SizedBox(
|
||||||
|
width: 380 * ratio,
|
||||||
|
height: 60 * ratio,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 4,
|
||||||
|
primary: orangeC, // background
|
||||||
|
onPrimary: Colors.white, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Fermer',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 23 * ratio,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: isTall ? 80 : 20)
|
||||||
|
])),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/providers/cesium_plus.dart';
|
import 'package:gecko/providers/cesium_plus.dart';
|
||||||
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallet_options.dart';
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
|
@ -23,11 +24,11 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletsProfilesProvider _historyProvider =
|
WalletsProfilesProvider _walletViewProvider =
|
||||||
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);
|
||||||
_historyProvider.pubkey = pubkey!;
|
_walletViewProvider.pubkey = pubkey!;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: true,
|
resizeToAvoidBottomInset: true,
|
||||||
|
@ -41,7 +42,8 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
headerProfileView(context, _historyProvider, _cesiumPlusProvider),
|
headerProfileView(
|
||||||
|
context, _walletViewProvider, _cesiumPlusProvider),
|
||||||
SizedBox(height: isTall ? 120 : 70),
|
SizedBox(height: isTall ? 120 : 70),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
|
@ -163,7 +165,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
image: AssetImage('assets/vector_white.png'),
|
image: AssetImage('assets/vector_white.png'),
|
||||||
)),
|
)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
paymentPopup(context, _historyProvider);
|
paymentPopup(context, _walletViewProvider);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -183,12 +185,17 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
void paymentPopup(
|
void paymentPopup(
|
||||||
BuildContext context, WalletsProfilesProvider _walletViewProvider) {
|
BuildContext context, WalletsProfilesProvider _walletViewProvider) {
|
||||||
// WalletsProfilesProvider _walletViewProvider =
|
// WalletsProfilesProvider _walletViewProvider =
|
||||||
// Provider.of<WalletsProfilesProvider>(context);
|
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
const double shapeSize = 20;
|
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
WalletData? defaultWallet =
|
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
|
||||||
|
const double shapeSize = 20;
|
||||||
|
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
|
bool canValidate = false;
|
||||||
|
|
||||||
_walletViewProvider.outputPubkey.text = pubkey!;
|
_walletViewProvider.outputPubkey.text = pubkey!;
|
||||||
|
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
|
@ -203,6 +210,15 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
if (_walletViewProvider.payAmount.text != '' &&
|
||||||
|
double.parse(_walletViewProvider.payAmount.text) <=
|
||||||
|
double.parse(
|
||||||
|
balanceCache[defaultWallet!.address]!.split(' ')[0]) &&
|
||||||
|
_walletViewProvider.pubkey != defaultWallet.address) {
|
||||||
|
canValidate = true;
|
||||||
|
} else {
|
||||||
|
canValidate = false;
|
||||||
|
}
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: MediaQuery.of(context).viewInsets.bottom),
|
bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||||
|
@ -218,7 +234,8 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.only(
|
||||||
|
top: 24, bottom: 0, left: 24, right: 24),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -230,86 +247,169 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
'Saisissez dans le champ ci-dessous le montant à virer.',
|
'Depuis:',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 19,
|
fontSize: 19,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.grey[600]),
|
color: Colors.grey[600]),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const SizedBox(height: 10),
|
||||||
Center(
|
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
||||||
child: Column(children: <Widget>[
|
return InkWell(
|
||||||
TextField(
|
onTap: () {
|
||||||
controller: _walletViewProvider.payAmount,
|
Navigator.push(
|
||||||
autofocus: true,
|
context,
|
||||||
maxLines: 1,
|
MaterialPageRoute(
|
||||||
textAlign: TextAlign.center,
|
builder: (context) {
|
||||||
keyboardType: TextInputType.number,
|
return UnlockingWallet(
|
||||||
onChanged: (_) => setState(() {}),
|
wallet: defaultWallet,
|
||||||
inputFormatters: <TextInputFormatter>[
|
action: "changeWallet");
|
||||||
FilteringTextInputFormatter.allow(
|
},
|
||||||
RegExp(r'^\d+\.?\d{0,2}')),
|
),
|
||||||
],
|
);
|
||||||
// onChanged: (v) => _searchProvider.rebuildWidget(),
|
},
|
||||||
decoration: InputDecoration(
|
child: Container(
|
||||||
hintText: '0.00',
|
width: double.infinity,
|
||||||
suffix: Text(currencyName),
|
// height: 25,
|
||||||
filled: true,
|
decoration: BoxDecoration(
|
||||||
fillColor: Colors.transparent,
|
|
||||||
// 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(
|
border: Border.all(
|
||||||
borderSide: BorderSide(
|
color: Colors.blueAccent
|
||||||
color: Colors.grey[500]!, width: 2),
|
.shade200, // Set border color
|
||||||
borderRadius: BorderRadius.circular(8),
|
width: 2), // Set border width
|
||||||
),
|
borderRadius: const BorderRadius.all(
|
||||||
contentPadding: const EdgeInsets.all(20),
|
Radius.circular(10.0)), // Set ro
|
||||||
),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 40,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
|
||||||
|
child: Row(children: [
|
||||||
|
Text(defaultWallet!.name!),
|
||||||
|
const Spacer(),
|
||||||
|
FutureBuilder(
|
||||||
|
future:
|
||||||
|
_sub.getBalance(defaultWallet.address!),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<num?> _balance) {
|
||||||
|
if (_balance.connectionState !=
|
||||||
|
ConnectionState.done ||
|
||||||
|
_balance.hasError) {
|
||||||
|
if (balanceCache[
|
||||||
|
defaultWallet.address!] !=
|
||||||
|
null) {
|
||||||
|
return Text(
|
||||||
|
balanceCache[
|
||||||
|
defaultWallet.address!]!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return SizedBox(
|
||||||
|
height: 15,
|
||||||
|
width: 15,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: orangeC,
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
balanceCache[defaultWallet.address!] =
|
||||||
|
"${_balance.data.toString()} $currencyName";
|
||||||
|
return Text(
|
||||||
|
balanceCache[defaultWallet.address!]!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40),
|
);
|
||||||
// const Spacer(),
|
}),
|
||||||
SizedBox(
|
const Spacer(),
|
||||||
width: double.infinity,
|
|
||||||
height: 60,
|
// const SizedBox(height: 10),
|
||||||
child: ElevatedButton(
|
Text(
|
||||||
style: ElevatedButton.styleFrom(
|
'Montant:',
|
||||||
elevation: 4,
|
style: TextStyle(
|
||||||
primary: orangeC, // background
|
fontSize: 19,
|
||||||
onPrimary: Colors.white, // foreground
|
fontWeight: FontWeight.w500,
|
||||||
),
|
color: Colors.grey[600]),
|
||||||
onPressed:
|
|
||||||
_walletViewProvider.payAmount.text != ''
|
|
||||||
? () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) {
|
|
||||||
return UnlockingWallet(
|
|
||||||
wallet: defaultWallet,
|
|
||||||
action: "pay");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
child: const Text(
|
|
||||||
'Effectuer le virement',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
TextField(
|
||||||
|
controller: _walletViewProvider.payAmount,
|
||||||
|
autofocus: true,
|
||||||
|
maxLines: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
onChanged: (_) => setState(() {
|
||||||
|
// _walletViewProvider.reload();
|
||||||
|
}),
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(r'^\d+\.?\d{0,2}')),
|
||||||
|
],
|
||||||
|
// onChanged: (v) => _searchProvider.rebuildWidget(),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '0.00',
|
||||||
|
suffix: Text(currencyName),
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.transparent,
|
||||||
|
// border: OutlineInputBorder(
|
||||||
|
// borderSide:
|
||||||
|
// BorderSide(color: Colors.grey[500], width: 2),
|
||||||
|
// borderRadius: BorderRadius.circular(8)),
|
||||||
|
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey[500]!, width: 2),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.all(20),
|
||||||
|
),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 40,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 40),
|
||||||
|
const Spacer(),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 4,
|
||||||
|
primary: orangeC, // background
|
||||||
|
onPrimary: Colors.white, // foreground
|
||||||
|
),
|
||||||
|
onPressed: canValidate
|
||||||
|
? () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
return UnlockingWallet(
|
||||||
|
wallet: defaultWallet,
|
||||||
|
action: "pay");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: const Text(
|
||||||
|
'Effectuer le virement',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -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.6+3
|
version: 0.0.6+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
Loading…
Reference in New Issue