Improve choose_chest and unlocking_wallet screens
This commit is contained in:
parent
97f20bafe5
commit
30d5cd2e31
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
|
@ -128,7 +128,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
number: _newWalletNbr,
|
number: _newWalletNbr,
|
||||||
name: _name,
|
name: _name,
|
||||||
derivation: _newDerivationNbr,
|
derivation: _newDerivationNbr,
|
||||||
imageName: '${_newWalletNbr % 3}.png');
|
imageName: '${_newWalletNbr % 4}.png');
|
||||||
|
|
||||||
await walletBox.add(newWallet);
|
await walletBox.add(newWallet);
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/my_wallets.dart';
|
import 'package:gecko/models/my_wallets.dart';
|
||||||
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/onBoarding/1.dart';
|
import 'package:gecko/screens/onBoarding/1.dart';
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ChooseChest extends StatefulWidget {
|
||||||
|
const ChooseChest({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _ChooseChestState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class ChooseChest extends StatelessWidget {
|
class _ChooseChestState extends State<ChooseChest> {
|
||||||
TextEditingController tplController = TextEditingController();
|
TextEditingController tplController = TextEditingController();
|
||||||
CarouselController buttonCarouselController = CarouselController();
|
CarouselController buttonCarouselController = CarouselController();
|
||||||
|
int currentChest = configBox.get('currentChest');
|
||||||
ChooseChest({Key key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -20,8 +30,6 @@ class ChooseChest extends StatelessWidget {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
int currentChest = configBox.get('currentChest');
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
@ -30,13 +38,14 @@ class ChooseChest extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
const SizedBox(height: 190),
|
SizedBox(height: 160 * ratio),
|
||||||
CarouselSlider(
|
CarouselSlider(
|
||||||
carouselController: buttonCarouselController,
|
carouselController: buttonCarouselController,
|
||||||
options: CarouselOptions(
|
options: CarouselOptions(
|
||||||
height: 210,
|
height: 210,
|
||||||
onPageChanged: (index, reason) {
|
onPageChanged: (index, reason) {
|
||||||
currentChest = index;
|
currentChest = index;
|
||||||
|
setState(() {});
|
||||||
},
|
},
|
||||||
enableInfiniteScroll: false,
|
enableInfiniteScroll: false,
|
||||||
initialPage: currentChest,
|
initialPage: currentChest,
|
||||||
|
@ -60,14 +69,29 @@ class ChooseChest extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
Image.asset('assets/chests/vector.png'),
|
Row(
|
||||||
const SizedBox(height: 15),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
const Text(
|
children: chestBox.toMap().entries.map((entry) {
|
||||||
'Choisir un autre\ncoffre',
|
return GestureDetector(
|
||||||
textAlign: TextAlign.center,
|
onTap: () =>
|
||||||
style: TextStyle(fontSize: 13),
|
buttonCarouselController.animateToPage(entry.key),
|
||||||
|
child: Container(
|
||||||
|
width: 12.0,
|
||||||
|
height: 12.0,
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8.0, horizontal: 4.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: (Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black)
|
||||||
|
.withOpacity(
|
||||||
|
currentChest == entry.key ? 0.9 : 0.4)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 80),
|
SizedBox(height: 80 * ratio),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 70,
|
height: 70,
|
||||||
|
@ -78,11 +102,16 @@ class ChooseChest extends StatelessWidget {
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
configBox.put('currentChest', currentChest);
|
configBox.put('currentChest', currentChest);
|
||||||
|
WalletData defaultWallet = _myWalletProvider
|
||||||
|
.getDefaultWallet(configBox.get('currentChest'));
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
Navigator.popUntil(
|
Navigator.pushAndRemoveUntil(context,
|
||||||
context,
|
MaterialPageRoute(builder: (context) {
|
||||||
ModalRoute.withName('/mywallets'),
|
return UnlockingWallet(
|
||||||
);
|
wallet: defaultWallet,
|
||||||
|
action: "mywallets",
|
||||||
|
);
|
||||||
|
}), ModalRoute.withName('/'));
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Ouvrir ce coffre',
|
'Ouvrir ce coffre',
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/models/chest_data.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/my_wallets.dart';
|
import 'package:gecko/models/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
|
@ -37,6 +38,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
// log.d("defaultWallet: " + defaultWallet.toString());
|
// log.d("defaultWallet: " + defaultWallet.toString());
|
||||||
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
|
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
ChestData currentChest = chestBox.get(wallet.chest);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// backgroundColor: Colors.brown[600],
|
// backgroundColor: Colors.brown[600],
|
||||||
|
@ -45,15 +47,33 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
const SizedBox(height: 150),
|
const SizedBox(height: 50),
|
||||||
const Text(
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.',
|
Image.asset(
|
||||||
textAlign: TextAlign.center,
|
'assets/chests/${currentChest.imageName}',
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: 15.0,
|
const SizedBox(width: 5),
|
||||||
color: Colors.black,
|
SizedBox(
|
||||||
fontWeight: FontWeight.w400),
|
width: 250,
|
||||||
),
|
child: Text(
|
||||||
|
currentChest.name,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
const SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: Text(
|
||||||
|
'Pour déverrouiller votre coffre, composez votre code secret à l’abri des lézards indiscrets :',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 19,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
)),
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
pinForm(context, _pinLenght, wallet.number, wallet.derivation),
|
pinForm(context, _pinLenght, wallet.number, wallet.derivation),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -113,7 +113,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return ChooseChest();
|
return const ChooseChest();
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
label: const Text(
|
label: const Text(
|
||||||
|
|
|
@ -814,7 +814,7 @@ packages:
|
||||||
name: pin_code_fields
|
name: pin_code_fields
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.0"
|
version: "7.3.0"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.2+7
|
version: 0.0.2+8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -36,7 +36,7 @@ dependencies:
|
||||||
path_provider: ^2.0.3
|
path_provider: ^2.0.3
|
||||||
pdf: ^3.5.0
|
pdf: ^3.5.0
|
||||||
permission_handler: 8.1.6
|
permission_handler: 8.1.6
|
||||||
pin_code_fields: ^6.0.2
|
pin_code_fields: ^7.3.0
|
||||||
printing: ^5.6.0
|
printing: ^5.6.0
|
||||||
provider: ^6.0.0
|
provider: ^6.0.0
|
||||||
qrscan: ^0.3.2
|
qrscan: ^0.3.2
|
||||||
|
|
Loading…
Reference in New Issue