Fix: reload home page after cesium wallet creation

This commit is contained in:
poka 2021-12-21 11:06:11 +01:00
parent de18062b7a
commit 7c7f604585
4 changed files with 88 additions and 66 deletions

View File

@ -13,6 +13,7 @@ class ChangePinProvider with ChangeNotifier {
try {
final _dewif = chestBox.get(configBox.get('currentChest')).dewif;
// TODO: Durt: Detect if CesiumWallet
NewWallet newWalletFile = Dewif().changePassword(
dewif: _dewif,
oldPassword: _oldPin.toUpperCase(),

View File

@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/generate_wallets.dart';
import 'package:flutter/material.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
@ -21,6 +22,8 @@ class ImportWalletScreen extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context, listen: false);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context, listen: false);
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
_generateWalletProvider.pin.text = randomSecretCode(5);
return WillPopScope(
@ -177,7 +180,7 @@ class ImportWalletScreen extends StatelessWidget {
? () async {
final chestKey =
await walletProvider.importCesiumWallet();
walletProvider.reloadBuild();
_myWalletProvider.rebuildWidget();
await Navigator.pushAndRemoveUntil(
context,

View File

@ -32,6 +32,7 @@ class UnlockingWallet extends StatelessWidget {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
final double statusBarHeight = MediaQuery.of(context).padding.top;
int _pinLenght;
ChestData currentChest = chestBox.get(configBox.get('currentChest'));
@ -47,71 +48,88 @@ class UnlockingWallet extends StatelessWidget {
return Scaffold(
// backgroundColor: Colors.brown[600],
body: SafeArea(
child: Column(children: <Widget>[
Expanded(
child: Column(children: <Widget>[
SizedBox(height: isTall ? 100 : 20),
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
currentChest.imageFile == null
? Image.asset(
'assets/chests/${currentChest.imageName}',
width: isTall ? 130 : 100,
)
: Image.file(
currentChest.imageFile,
width: isTall ? 130 : 100,
),
const SizedBox(width: 5),
SizedBox(
width: 250,
child: Text(
currentChest.name,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 25,
color: Colors.black,
fontWeight: FontWeight.w700),
)),
]),
SizedBox(height: 30 * ratio),
const SizedBox(
width: 400,
child: Text(
'Pour déverrouiller votre coffre, composez votre code secret à labri des lézards indiscrets :',
style: TextStyle(
fontSize: 19,
color: Colors.black,
fontWeight: FontWeight.w400),
)),
SizedBox(height: 40 * ratio),
pinForm(context, _pinLenght, currentChest),
SizedBox(height: 3 * ratio),
InkWell(
key: const Key('chooseChest'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ChooseChest(action: action);
}),
);
},
child: SizedBox(
width: 400,
height: 70,
child: Center(
child: Text(
'Changer de coffre',
style: TextStyle(
fontSize: 22,
color: orangeC,
fontWeight: FontWeight.w600),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Stack(children: <Widget>[
Positioned(
top: statusBarHeight + 10,
left: 15,
child: Builder(
builder: (context) => IconButton(
key: const Key('popButton'),
icon: const Icon(
Icons.arrow_back,
color: Colors.black,
size: 25,
),
)),
]),
),
]),
onPressed: () => Navigator.pop(context),
),
),
),Column(children: <Widget>[
SizedBox(height: isTall ? 100 : 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
currentChest.imageFile == null
? Image.asset(
'assets/chests/${currentChest.imageName}',
width: isTall ? 130 : 100,
)
: Image.file(
currentChest.imageFile,
width: isTall ? 130 : 100,
),
const SizedBox(width: 5),
SizedBox(
width: 250,
child: Text(
currentChest.name,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 25,
color: Colors.black,
fontWeight: FontWeight.w700),
)),
]),
SizedBox(height: 30 * ratio),
const SizedBox(
width: 400,
child: Text(
'Pour déverrouiller votre coffre, composez votre code secret à labri des lézards indiscrets :',
style: TextStyle(
fontSize: 19,
color: Colors.black,
fontWeight: FontWeight.w400),
)),
SizedBox(height: 40 * ratio),
pinForm(context, _pinLenght, currentChest),
SizedBox(height: 3 * ratio),
InkWell(
key: const Key('chooseChest'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ChooseChest(action: action);
}),
);
},
child: SizedBox(
width: 400,
height: 70,
child: Center(
child: Text(
'Changer de coffre',
style: TextStyle(
fontSize: 22,
color: orangeC,
fontWeight: FontWeight.w600),
),
),
)),
]),
]),]),
));
}

View File

@ -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.4+1
version: 0.0.4+2
environment:
sdk: ">=2.7.0 <3.0.0"