improve responsive; skip tuto after onboarding

This commit is contained in:
poka 2022-05-25 20:40:25 +02:00
parent 16d42d7f5f
commit e9291d9277
13 changed files with 101 additions and 297 deletions

View File

@ -13,7 +13,7 @@ class CommonElements {
return Container(
padding: const EdgeInsets.all(0),
width: 440,
height: boxHeight,
height: isTall ? boxHeight : boxHeight * 0.9,
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topLeft,
@ -37,7 +37,9 @@ class CommonElements {
textAlign: TextAlign.justify,
text: TextSpan(
style: TextStyle(
fontSize: size, color: Colors.black, letterSpacing: 0.3),
fontSize: isTall ? size : size * 0.9,
color: Colors.black,
letterSpacing: 0.3),
children: text,
),
),
@ -47,8 +49,8 @@ class CommonElements {
Widget nextButton(
BuildContext context, String text, nextScreen, bool isFast) {
return SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 4,
@ -61,7 +63,7 @@ class CommonElements {
},
child: 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),
SizedBox(height: isTall ? 40 : 10),
SizedBox(height: isTall ? 40 : 20),
]);
}

View File

@ -221,11 +221,12 @@ Widget geckHome(context) {
child: Material(
color: orangeC, // button color
child: InkWell(
child: const Padding(
padding: EdgeInsets.all(18),
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: AssetImage('assets/home/loupe.png'),
height: 70),
image:
const AssetImage('assets/home/loupe.png'),
height: 62 * ratio),
),
onTap: () {
Navigator.push(
@ -249,12 +250,12 @@ Widget geckHome(context) {
),
),
const SizedBox(height: 12),
const Text(
Text(
"Rechercher un\nportefeuille",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
]),
@ -266,11 +267,12 @@ Widget geckHome(context) {
child: Material(
color: orangeC, // button color
child: InkWell(
child: const Padding(
padding: EdgeInsets.all(18),
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: AssetImage('assets/home/wallet.png'),
height: 75)),
image: const AssetImage(
'assets/home/wallet.png'),
height: 68 * ratio)),
onTap: () {
WalletData? defaultWallet =
_myWalletProvider.getDefaultWallet(
@ -304,18 +306,18 @@ Widget geckHome(context) {
),
),
const SizedBox(height: 12),
const Text(
Text(
"Gérer mes\nportefeuilles",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])
]),
Padding(
padding: const EdgeInsets.only(top: 40),
padding: EdgeInsets.only(top: 35 * ratio),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@ -325,12 +327,12 @@ Widget geckHome(context) {
child: Material(
color: orangeC, // button color
child: InkWell(
child: const Padding(
padding: EdgeInsets.all(18),
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: AssetImage(
image: const AssetImage(
'assets/home/qrcode.png'),
height: 75)),
height: 68 * ratio)),
onTap: () async {
await _historyProvider.scan(context);
}),
@ -348,12 +350,12 @@ Widget geckHome(context) {
),
),
const SizedBox(height: 12),
const Text(
Text(
"Scanner un\nQR code",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])

View File

@ -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),
// ),
// ),
// );
// }
// }

View File

@ -5,13 +5,15 @@ import 'package:flutter/material.dart';
import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/7.dart';
import 'package:gecko/screens/onBoarding/9.dart';
import 'package:provider/provider.dart';
// import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart';
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
Widget build(BuildContext context) {
@ -98,7 +100,9 @@ class RestoreChest extends StatelessWidget {
await Navigator.push(
context,
FaderTransition(
page: const OnboardingStepThirteen(),
page: skipIntro
? const OnboardingStepNine()
: const OnboardingStepSeven(),
isFast: true),
);
} else {

View File

@ -14,8 +14,8 @@ import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class OnboardingStepFourteen extends StatelessWidget {
OnboardingStepFourteen({
class OnboardingStepTen extends StatelessWidget {
OnboardingStepTen({
Key? validationKey,
}) : super(key: validationKey);
@ -146,7 +146,7 @@ class OnboardingStepFourteen extends StatelessWidget {
Navigator.push(
context,
FaderTransition(
page: const OnboardingStepFiveteen(), isFast: false),
page: const OnboardingStepEleven(), isFast: false),
);
} else {
errorController.add(ErrorAnimationType

View File

@ -7,8 +7,8 @@ import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/myWallets/wallets_home.dart';
// ignore: must_be_immutable
class OnboardingStepFiveteen extends StatelessWidget {
const OnboardingStepFiveteen({Key? key}) : super(key: key);
class OnboardingStepEleven extends StatelessWidget {
const OnboardingStepEleven({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -54,8 +54,8 @@ class OnboardingStepFiveteen extends StatelessWidget {
Widget finishButton(BuildContext context) {
return SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
key: const Key('goWalletHome'),
style: ElevatedButton.styleFrom(
@ -72,7 +72,8 @@ Widget finishButton(BuildContext context) {
ModalRoute.withName('/'),
);
},
child: const Text("Accéder à mon coffre",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600))),
child: Text("Accéder à mon coffre",
style:
TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600))),
);
}

View File

@ -13,7 +13,9 @@ import 'package:provider/provider.dart';
AsyncSnapshot<List>? mnemoList;
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
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 daccéder à tous vos portefeuilles.'),
],
),
const SizedBox(height: 40),
SizedBox(height: 35 * ratio),
sentanceArray(context),
const SizedBox(height: 20),
SizedBox(height: 17 * ratio),
GestureDetector(
onTap: () {
Navigator.push(
@ -61,7 +63,7 @@ class OnboardingStepFive extends StatelessWidget {
},
child: Image.asset(
'assets/printer.png',
height: 45,
height: 42 * ratio,
),
),
const SizedBox(height: 40),
@ -69,8 +71,8 @@ class OnboardingStepFive extends StatelessWidget {
child: Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
key: const Key('generateMnemonic'),
style: ElevatedButton.styleFrom(
@ -82,15 +84,16 @@ class OnboardingStepFive extends StatelessWidget {
_generateWalletProvider.reloadBuild();
// setState(() {});
},
child: const Text("Choisir une autre phrase",
child: Text("Choisir une autre phrase",
style: TextStyle(
fontSize: 24, fontWeight: FontWeight.w600))),
fontSize: 22 * ratio,
fontWeight: FontWeight.w600))),
),
),
),
const SizedBox(height: 25),
nextButton(context, "J'ai noté ma phrase", false),
const SizedBox(height: 40),
SizedBox(height: 22 * ratio),
nextButton(context, "J'ai noté ma phrase", false, skipIntro),
SizedBox(height: 35 * ratio),
]),
),
);
@ -157,12 +160,12 @@ Widget arrayCell(dataWord) {
child: Column(children: <Widget>[
Text(
dataWord.split(':')[0],
style: const TextStyle(fontSize: 15, color: Color(0xff6b6b52)),
style: TextStyle(fontSize: 13 * ratio, color: const Color(0xff6b6b52)),
),
Text(
dataWord.split(':')[1],
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 =
Provider.of<GenerateWalletsProvider>(context, listen: false);
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false);
return SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 4,
@ -232,13 +236,14 @@ Widget nextButton(BuildContext context, String text, bool isFast) {
context,
FaderTransition(
page: OnboardingStepSix(
generatedMnemonic: _generateWalletProvider.generatedMnemonic),
generatedMnemonic: _generateWalletProvider.generatedMnemonic,
skipIntro: skipIntro),
isFast: true),
);
},
child: Text(
text,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
style: TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600),
),
),
);

View File

@ -6,13 +6,16 @@ import 'package:gecko/globals.dart';
import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/7.dart';
import 'package:gecko/screens/onBoarding/9.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class OnboardingStepSix extends StatelessWidget {
OnboardingStepSix({Key? key, required this.generatedMnemonic})
OnboardingStepSix(
{Key? key, required this.skipIntro, required this.generatedMnemonic})
: super(key: key);
final bool skipIntro;
String? generatedMnemonic;
TextEditingController wordController = TextEditingController();
final TextEditingController _mnemonicController = TextEditingController();
@ -116,8 +119,13 @@ class OnboardingStepSix extends StatelessWidget {
child: Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: nextButton(context, 'Continuer',
const OnboardingStepSeven(), false),
child: nextButton(
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;
return SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 4,

View File

@ -40,7 +40,7 @@ class OnboardingStepEight extends StatelessWidget {
],
'coffre-fort-protege-les-portefeuilles.png',
'>',
const OnboardingStepThirteen(),
const OnboardingStepNine(),
7),
),
);

View File

@ -9,8 +9,8 @@ import 'package:gecko/screens/onBoarding/10.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class OnboardingStepThirteen extends StatelessWidget {
const OnboardingStepThirteen({Key? key}) : super(key: key);
class OnboardingStepNine extends StatelessWidget {
const OnboardingStepNine({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -84,8 +84,8 @@ class OnboardingStepThirteen extends StatelessWidget {
child: Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: 410,
height: 70,
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
key: const Key('changeSecretCode'),
style: ElevatedButton.styleFrom(
@ -96,14 +96,15 @@ class OnboardingStepThirteen extends StatelessWidget {
onPressed: () {
_generateWalletProvider.changePinCode(reload: true);
},
child: const Text("Choisir un autre code secret",
child: Text("Choisir un autre code secret",
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",
OnboardingStepFourteen(), false),
const SizedBox(height: 40),
OnboardingStepTen(), false),
SizedBox(height: 35 * ratio),
]),
));
}

View File

@ -3,11 +3,11 @@ import 'package:durt/durt.dart';
import 'package:flutter/services.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/screens/myWallets/generate_wallets.dart';
import 'dart:io';
// import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/screens/myWallets/restore_chest.dart';
import 'package:gecko/screens/onBoarding/5.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
@ -91,7 +91,7 @@ class SettingsScreen extends StatelessWidget {
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return GenerateFastChestScreen();
return const OnboardingStepFive(skipIntro: true);
}),
),
child: const Text(
@ -114,7 +114,7 @@ class SettingsScreen extends StatelessWidget {
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const RestoreChest();
return const RestoreChest(skipIntro: true);
}),
),
child: const Text(

View File

@ -160,7 +160,10 @@ class SubstrateSandBox extends StatelessWidget {
_sub.generatedMnemonic,
textAlign: TextAlign.center,
),
)
),
const Text('--------'),
const SizedBox(height: 10),
Text(_sub.debugConnection)
])
]),
);

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.6+3
version: 0.0.6+4
environment:
sdk: '>=2.12.0 <3.0.0'