Improve choose_chest and unlocking_wallet screens

This commit is contained in:
poka 2021-11-15 00:39:40 +01:00
parent 97f20bafe5
commit 30d5cd2e31
7 changed files with 80 additions and 31 deletions

BIN
assets/avatars/3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -128,7 +128,7 @@ class MyWalletsProvider with ChangeNotifier {
number: _newWalletNbr,
name: _name,
derivation: _newDerivationNbr,
imageName: '${_newWalletNbr % 3}.png');
imageName: '${_newWalletNbr % 4}.png');
await walletBox.add(newWallet);

View File

@ -1,18 +1,28 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/onBoarding/1.dart';
import 'package:carousel_slider/carousel_slider.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
class ChooseChest extends StatelessWidget {
class _ChooseChestState extends State<ChooseChest> {
TextEditingController tplController = TextEditingController();
CarouselController buttonCarouselController = CarouselController();
ChooseChest({Key key}) : super(key: key);
int currentChest = configBox.get('currentChest');
@override
Widget build(BuildContext context) {
@ -20,8 +30,6 @@ class ChooseChest extends StatelessWidget {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
int currentChest = configBox.get('currentChest');
return Scaffold(
appBar: AppBar(
title: const SizedBox(
@ -30,13 +38,14 @@ class ChooseChest extends StatelessWidget {
)),
body: SafeArea(
child: Column(children: <Widget>[
const SizedBox(height: 190),
SizedBox(height: 160 * ratio),
CarouselSlider(
carouselController: buttonCarouselController,
options: CarouselOptions(
height: 210,
onPageChanged: (index, reason) {
currentChest = index;
setState(() {});
},
enableInfiniteScroll: false,
initialPage: currentChest,
@ -60,14 +69,29 @@ class ChooseChest extends StatelessWidget {
);
}).toList(),
),
Image.asset('assets/chests/vector.png'),
const SizedBox(height: 15),
const Text(
'Choisir un autre\ncoffre',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 13),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: chestBox.toMap().entries.map((entry) {
return GestureDetector(
onTap: () =>
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(
width: 400,
height: 70,
@ -78,11 +102,16 @@ class ChooseChest extends StatelessWidget {
),
onPressed: () {
configBox.put('currentChest', currentChest);
WalletData defaultWallet = _myWalletProvider
.getDefaultWallet(configBox.get('currentChest'));
_myWalletProvider.rebuildWidget();
Navigator.popUntil(
context,
ModalRoute.withName('/mywallets'),
);
Navigator.pushAndRemoveUntil(context,
MaterialPageRoute(builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "mywallets",
);
}), ModalRoute.withName('/'));
},
child: Text(
'Ouvrir ce coffre',

View File

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/history.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
@ -37,6 +38,7 @@ class UnlockingWallet extends StatelessWidget {
// log.d("defaultWallet: " + defaultWallet.toString());
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
errorController = StreamController<ErrorAnimationType>();
ChestData currentChest = chestBox.get(wallet.chest);
return Scaffold(
// backgroundColor: Colors.brown[600],
@ -45,15 +47,33 @@ class UnlockingWallet extends StatelessWidget {
const SizedBox(height: 20),
Expanded(
child: Column(children: <Widget>[
const SizedBox(height: 150),
const Text(
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15.0,
color: Colors.black,
fontWeight: FontWeight.w400),
),
const SizedBox(height: 50),
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Image.asset(
'assets/chests/${currentChest.imageName}',
),
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),
)),
]),
const SizedBox(height: 50),
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),
)),
const SizedBox(height: 50),
pinForm(context, _pinLenght, wallet.number, wallet.derivation),
]),

View File

@ -113,7 +113,7 @@ class WalletsHome extends StatelessWidget {
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ChooseChest();
return const ChooseChest();
}),
),
label: const Text(

View File

@ -814,7 +814,7 @@ packages:
name: pin_code_fields
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
version: "7.3.0"
platform:
dependency: transitive
description:

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.2+7
version: 0.0.2+8
environment:
sdk: ">=2.7.0 <3.0.0"
@ -36,7 +36,7 @@ dependencies:
path_provider: ^2.0.3
pdf: ^3.5.0
permission_handler: 8.1.6
pin_code_fields: ^6.0.2
pin_code_fields: ^7.3.0
printing: ^5.6.0
provider: ^6.0.0
qrscan: ^0.3.2