diff --git a/lib/providers/generate_wallets.dart b/lib/providers/generate_wallets.dart
index 8d4c2678a8c3bf4dfb377e66f187ce1f6d02f72e..ffa30da122df3aee7b561867ae29bb07054def47 100644
--- a/lib/providers/generate_wallets.dart
+++ b/lib/providers/generate_wallets.dart
@@ -10,7 +10,6 @@ import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
-import 'package:printing/printing.dart';
import 'package:provider/provider.dart';
import "package:unorm_dart/unorm_dart.dart" as unorm;
@@ -163,37 +162,70 @@ class GenerateWalletsProvider with ChangeNotifier {
return pin.text;
}
- Future<Uint8List> printWallet(String? _title) async {
+ Future<Uint8List> printWallet(AsyncSnapshot<List>? mnemoList) async {
final ByteData fontData =
await rootBundle.load("assets/OpenSans-Regular.ttf");
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
final pdf = pw.Document();
- const imageProvider = AssetImage('assets/icon/gecko_final.png');
- final geckoLogo = await flutterImageProvider(imageProvider);
+ // const imageProvider = AssetImage('assets/icon/gecko_final.png');
+ // final geckoLogo = await flutterImageProvider(imageProvider);
+
+ pw.Widget arrayCell(dataWord) {
+ return pw.SizedBox(
+ width: 120,
+ child: pw.Column(children: <pw.Widget>[
+ pw.Text(
+ dataWord.split(':')[0],
+ style: pw.TextStyle(
+ fontSize: 15, color: const PdfColor(0.5, 0, 0), font: ttf),
+ ),
+ pw.Text(
+ dataWord.split(':')[1],
+ style: pw.TextStyle(
+ fontSize: 20, color: const PdfColor(0, 0, 0), font: ttf),
+ ),
+ pw.SizedBox(height: 10)
+ ]),
+ );
+ }
pdf.addPage(
pw.Page(
pageFormat: PdfPageFormat.a4,
build: (context) {
- return pw.Column(children: <pw.Widget>[
- pw.SizedBox(height: 20),
- pw.Text("Phrase de restauration:",
- style: pw.TextStyle(fontSize: 20, font: ttf)),
- pw.SizedBox(height: 10),
- pw.Text(_title!,
- style: pw.TextStyle(fontSize: 15, font: ttf),
- textAlign: pw.TextAlign.center),
- pw.Expanded(
- child: pw.Align(
- alignment: pw.Alignment.bottomCenter,
- child: pw.Text(
- "Gardez cette feuille en lieu sûr, à l'abris des regards indiscrets.",
- style: pw.TextStyle(fontSize: 10, font: ttf),
- ))),
- pw.SizedBox(height: 15),
- pw.Image(geckoLogo, height: 50)
- ]);
+ return pw.Column(
+ // mainAxisAlignment: pw.MainAxisAlignment.center,
+ // mainAxisSize: pw.MainAxisSize.max,
+ // crossAxisAlignment: pw.CrossAxisAlignment.center,
+ children: <pw.Widget>[
+ pw.Row(children: <pw.Widget>[
+ arrayCell(mnemoList!.data![0]),
+ arrayCell(mnemoList.data![1]),
+ arrayCell(mnemoList.data![2]),
+ arrayCell(mnemoList.data![3]),
+ ]),
+ pw.Row(children: <pw.Widget>[
+ arrayCell(mnemoList.data![4]),
+ arrayCell(mnemoList.data![5]),
+ arrayCell(mnemoList.data![6]),
+ arrayCell(mnemoList.data![7]),
+ ]),
+ pw.Row(children: <pw.Widget>[
+ arrayCell(mnemoList.data![8]),
+ arrayCell(mnemoList.data![9]),
+ arrayCell(mnemoList.data![10]),
+ arrayCell(mnemoList.data![11])
+ ]),
+ pw.Expanded(
+ child: pw.Align(
+ alignment: pw.Alignment.bottomCenter,
+ child: pw.Text(
+ "Gardez cette feuille préciseusement, à l’abri des lézards indiscrets.",
+ style: pw.TextStyle(fontSize: 15, font: ttf),
+ )))
+ ],
+ );
},
),
);
diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart
index d865caf0c095811b6b052ff0d04944d709501270..c41d9c70c69467e18b2a9c601f98e9e7cf83b3fa 100644
--- a/lib/providers/substrate_sdk.dart
+++ b/lib/providers/substrate_sdk.dart
@@ -214,7 +214,7 @@ class SubstrateSdk with ChangeNotifier {
generatedMnemonic = gen.mnemonic!;
// final res = await importAccount(fromMnemonic: true);
- await Clipboard.setData(ClipboardData(text: generatedMnemonic));
+ // await Clipboard.setData(ClipboardData(text: generatedMnemonic));
return gen.mnemonic!;
}
diff --git a/lib/screens/common_elements.dart b/lib/screens/common_elements.dart
index 009eb4814926a75a5fe1507c044c2dbd811d3815..c094e97d669752988aab888bad28f48ea14fb38c 100644
--- a/lib/screens/common_elements.dart
+++ b/lib/screens/common_elements.dart
@@ -1,5 +1,5 @@
+import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
-import 'package:bubble/bubble.dart';
import 'package:gecko/globals.dart';
class CommonElements {
@@ -8,95 +8,104 @@ class CommonElements {
return const Text('Coucou');
}
- Widget bubbleSpeak(String text,
- {double? long, Key? textKey, bool isMaxWidth = true}) {
+ Widget buildImage(String assetName,
+ [double boxHeight = 440, double imageWidth = 350]) {
+ return Container(
+ padding: const EdgeInsets.all(0),
+ width: 440,
+ height: boxHeight,
+ decoration: BoxDecoration(
+ gradient: const LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [
+ Color(0xffd2d4cf),
+ Color(0xffeaeae7),
+ ],
+ ),
+ border: Border.all(color: Colors.grey[900]!)),
+ child: Image.asset('assets/onBoarding/$assetName', width: imageWidth));
+ }
+
+ Widget buildText(List<TextSpan> text, [double size = 20]) {
+ return Container(
+ padding: const EdgeInsets.all(12),
+ width: 440,
+ decoration: BoxDecoration(
+ color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
+ child: RichText(
+ textAlign: TextAlign.justify,
+ text: TextSpan(
+ style: TextStyle(
+ fontSize: size, color: Colors.black, letterSpacing: 0.3),
+ children: text,
+ ),
+ ),
+ );
+ }
+
+ Widget nextButton(
+ BuildContext context, String text, nextScreen, bool isFast) {
return SizedBox(
- width: isMaxWidth ? double.infinity : 300,
- child: Bubble(
- padding: long == null
- ? const BubbleEdges.all(18)
- : BubbleEdges.symmetric(horizontal: long, vertical: 30),
- elevation: 5,
- color: Colors.white,
- margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
- // nip: BubbleNip.leftTop,
+ width: 410,
+ height: 70,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 4,
+ primary: orangeC, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () {
+ Navigator.push(
+ context, FaderTransition(page: nextScreen, isFast: isFast));
+ },
child: Text(
text,
- key: textKey,
- style: const TextStyle(
- color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400),
+ style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
),
),
);
}
- Widget bubbleSpeakRich(List<TextSpan> text, {Key? textKey}) {
- return SizedBox(
- width: double.infinity,
- child: Bubble(
- padding: const BubbleEdges.all(18),
- elevation: 5,
- color: Colors.white,
- margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
- // nip: BubbleNip.leftTop,
- child: RichText(
- key: textKey,
- text: TextSpan(
- style: const TextStyle(
- fontSize: 18.0,
- color: Colors.black,
- ),
- children: text,
- ),
- ),
+ Widget buildProgressBar(double pagePosition) {
+ return DotsIndicator(
+ dotsCount: 11,
+ position: pagePosition,
+ decorator: DotsDecorator(
+ spacing: const EdgeInsets.symmetric(horizontal: 10),
+ color: Colors.grey[300]!, // Inactive color
+ activeColor: orangeC,
),
);
}
- Widget onboardingProgressBar(
- BuildContext context, String screenTitle, int progress) {
- return Stack(children: [
- Container(height: 100),
- Positioned(
- top: 0, left: 0, right: 0, child: GeckoSpeechAppBar(screenTitle)),
- Positioned(
- top: 0,
- left: 0,
- child: GestureDetector(
- onTap: () {
- Navigator.popUntil(
- context,
- ModalRoute.withName('/'),
- );
- },
- child: Image.asset(
- 'assets/onBoarding/gecko_bar.png',
- ),
+ Widget infoIntro(
+ BuildContext context,
+ List<TextSpan> text,
+ String assetName,
+ String buttonText,
+ nextScreen,
+ double pagePosition, {
+ bool isFast = false,
+ double boxHeight = 440,
+ double imageWidth = 350,
+ double textSize = 20,
+ }) {
+ return Column(children: <Widget>[
+ SizedBox(height: isTall ? 40 : 20),
+ buildProgressBar(pagePosition),
+ SizedBox(height: isTall ? 40 : 20),
+
+ buildText(text, textSize),
+ buildImage(assetName, boxHeight, imageWidth),
+ Expanded(
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: nextButton(context, buttonText, nextScreen, false),
),
),
- if (progress != 0)
- Positioned(
- top: 75,
- left: 90,
- child: Image.asset(
- 'assets/onBoarding/progress_bar/total.png',
- ),
- ),
- if (progress != 0)
- Positioned(
- top: 75,
- left: 90,
- child: Image.asset(
- 'assets/onBoarding/progress_bar/$progress.png',
- ),
- ),
- if (progress != 0)
- Positioned(
- top: 70,
- right: 90,
- child: Text(progress == 12 ? '11/11' : '$progress/11',
- style: const TextStyle(fontSize: 12, color: Colors.black)),
- ),
+ // const SizedBox(height: 40),
+ SizedBox(height: isTall ? 40 : 10),
]);
}
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index c87e207fb6f0a0b4a2844b7bd3d298f2690628e4..f796033bcfaa3ca5b021e0c1d5e8a521cf7fda0a 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -483,7 +483,7 @@ Widget welcomeHome(context) {
context,
MaterialPageRoute(
builder: (context) {
- return OnboardingStepOne();
+ return const OnboardingStepOne();
},
),
);
diff --git a/lib/screens/myWallets/change_pin.dart b/lib/screens/myWallets/change_pin.dart
index e2bc2a6d1a8bd0e475c31e4c1d51d2a369025e56..fcf51b8b9bc6c7e1b2a5ade19ce6625577e0857e 100644
--- a/lib/screens/myWallets/change_pin.dart
+++ b/lib/screens/myWallets/change_pin.dart
@@ -100,10 +100,11 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
),
onPressed: () async {
final _chest = chestBox.get(configBox.get('currentChest'));
- _sub.changePassword(
+ await _sub.changePassword(
_chest!.address!, walletProvider.pinCode, newPin.text);
- newPin.text = '';
walletProvider.pinCode = newPin.text;
+ newPin.text = '';
+ Navigator.pop(context);
},
child: const Text(
'Confirmer',
diff --git a/lib/screens/myWallets/chest_options.dart b/lib/screens/myWallets/chest_options.dart
index 5b6e524070f25f6d3ddbacd769fd97f4db30a008..47bb5e12ae8b1018248804627a01fd201503c0e2 100644
--- a/lib/screens/myWallets/chest_options.dart
+++ b/lib/screens/myWallets/chest_options.dart
@@ -24,14 +24,15 @@ class ChestOptions extends StatelessWidget {
resizeToAvoidBottomInset: false,
appBar: AppBar(
toolbarHeight: 60 * ratio,
- leading: IconButton(
- icon: const Icon(Icons.arrow_back, color: Colors.black),
- onPressed: () {
- Navigator.popUntil(
- context,
- ModalRoute.withName('/mywallets'),
- );
- }),
+ // leading: IconButton(
+ // icon: const Icon(Icons.arrow_back, color: Colors.black),
+ // onPressed: () {
+ // // Navigator.popUntil(
+ // // context,
+ // // ModalRoute.withName('/mywallets'),
+ // // );
+ // Navigator.pop(context);
+ // }),
title: SizedBox(
height: 22,
child: Text(currentChest.name!),
diff --git a/lib/screens/myWallets/generate_wallets.dart b/lib/screens/myWallets/generate_wallets.dart
index 91360b100e88d1a91b1a5d89dea657c62d78cc8b..fe3a24efe4a711e77423e94be13ba19e645c3f75 100644
--- a/lib/screens/myWallets/generate_wallets.dart
+++ b/lib/screens/myWallets/generate_wallets.dart
@@ -4,7 +4,6 @@ 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:printing/printing.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
@@ -141,17 +140,17 @@ class GenerateFastChestScreen extends StatelessWidget {
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))
+ // GestureDetector(
+ // onTap: () {
+ // Navigator.push(
+ // context,
+ // MaterialPageRoute(builder: (context) {
+ // return PrintWallet(
+ // _generateWalletProvider.generatedMnemonic);
+ // }),
+ // );
+ // },
+ // child: const Icon(Icons.print))
]),
),
),
@@ -194,30 +193,30 @@ class GenerateFastChestScreen extends StatelessWidget {
}
}
-// ignore: must_be_immutable
-class PrintWallet extends StatelessWidget {
- const PrintWallet(this.sentence, {Key? key}) : super(key: key);
+// // ignore: must_be_immutable
+// class PrintWallet extends StatelessWidget {
+// const PrintWallet(this.sentence, {Key? key}) : super(key: key);
- final String? sentence;
+// 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),
- ),
- ),
- );
- }
-}
+// @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),
+// ),
+// ),
+// );
+// }
+// }
diff --git a/lib/screens/myWallets/restore_chest.dart b/lib/screens/myWallets/restore_chest.dart
index 51106f7b96bfe079d9e658ec4ddbbfd44ed0bea2..3772eacb0a689a5806ca1b9addecd18b91c2dbd6 100644
--- a/lib/screens/myWallets/restore_chest.dart
+++ b/lib/screens/myWallets/restore_chest.dart
@@ -5,7 +5,7 @@ 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/11.dart';
+import 'package:gecko/screens/onBoarding/9.dart';
import 'package:provider/provider.dart';
// import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart';
diff --git a/lib/screens/onBoarding/0_no_keychain_found.dart b/lib/screens/onBoarding/0_no_keychain_found.dart
deleted file mode 100644
index 59604ff8dd3f1131f47faa0f993074bd5be7e259..0000000000000000000000000000000000000000
--- a/lib/screens/onBoarding/0_no_keychain_found.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-// ignore_for_file: file_names
-import 'package:flutter/services.dart';
-import 'package:flutter/material.dart';
-import 'package:gecko/globals.dart';
-import 'package:gecko/screens/common_elements.dart';
-import 'package:gecko/screens/onBoarding/1.dart';
-
-class NoKeyChainScreen extends StatelessWidget {
- const NoKeyChainScreen({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- CommonElements common = CommonElements();
- return Scaffold(
- extendBodyBehindAppBar: true,
- // backgroundColor: Colors.white,
- // appBar: GeckoSpeechAppBar('Mes portefeuilles'),
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(context, 'Mes portefeuilles', 0),
- common.bubbleSpeak(
- "Je ne connais pour l’instant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.",
- textKey: const Key('textOnboarding')),
- const SizedBox(height: 90),
- Container(
- child: ClipOval(
- child: Material(
- color: const Color(0xffFFD58D), // button color
- child: InkWell(
- key: const Key('goStep1'),
- splashColor: orangeC, // inkwell color
- child: const Padding(
- padding: EdgeInsets.all(8),
- child: Image(
- image: AssetImage('assets/onBoarding/wallet.png'),
- height: 90)),
- onTap: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepOne(), isFast: true));
- }),
- ),
- ),
- decoration: const BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.white,
- boxShadow: [
- BoxShadow(
- color: Colors.grey,
- blurRadius: 4.0,
- offset: Offset(2.0, 2.5),
- spreadRadius: 0.5)
- ],
- ),
- ),
- const SizedBox(height: 15),
- const Text(
- "Créer un nouveau\nportefeuille",
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.black,
- fontSize: 16,
- fontWeight: FontWeight.w500),
- ),
- ]),
- ));
- }
-}
diff --git a/lib/screens/onBoarding/1.dart b/lib/screens/onBoarding/1.dart
index 126c3b2a9963c3134eae3f363c7e82b53a7a0d0f..2d8fba9c3ddbc3a5b55674b66b982bce3dc30439 100644
--- a/lib/screens/onBoarding/1.dart
+++ b/lib/screens/onBoarding/1.dart
@@ -1,73 +1,47 @@
// ignore_for_file: file_names
-
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/2.dart';
-// import 'package:gecko/models/home.dart';
-// import 'package:provider/provider.dart';
-// ignore: must_be_immutable
class OnboardingStepOne extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 1;
-
- OnboardingStepOne({Key? key}) : super(key: key);
+ const OnboardingStepOne({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- ////TODO: Continue onbarding refactoring
-
+ CommonElements common = CommonElements();
return Scaffold(
- appBar: AppBar(
- toolbarHeight: 60 * ratio,
- title: const SizedBox(
- height: 22,
- child: Text(
- 'Nouveau portefeuille',
- style: TextStyle(fontWeight: FontWeight.w600),
- ),
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Nouveau portefeuille',
+ style: TextStyle(fontWeight: FontWeight.w600),
),
),
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- // common.onboardingProgressBar(
- // context, 'Nouveau portefeuilles', progress),
- // common.bubbleSpeak(
- // "Il semblerait que vous n’ayez pas encore de coffre.\n\nUn coffre vous permet de gérer un ou plusieurs portefeuilles.",
- // textKey: const Key('step1')),
- const SizedBox(height: 90),
- Image.asset(
- 'assets/onBoarding/fabrication-de-portefeuille.png',
- height: 200,
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep2'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepTwo(), isFast: true));
- },
- child: const Text('Créer mon coffre',
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 80),
- ]),
- ));
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(
+ text: 'Gecko fabrique votre portefeuille à partir d’une '),
+ const TextSpan(
+ text: 'phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.bold)),
+ const TextSpan(
+ text:
+ '. Elle est un peu comme le plan qui permet de construire votre portefeuille.'),
+ ],
+ 'fabrication-de-portefeuille.png',
+ '>',
+ const OnboardingStepTwo(),
+ 0),
+ ),
+ );
}
}
diff --git a/lib/screens/onBoarding/10.dart b/lib/screens/onBoarding/10.dart
index a1301905439320eedfb3474dfcf4c20460de341f..c4fd8bde63cc0ef303499122bf470457d68148fb 100644
--- a/lib/screens/onBoarding/10.dart
+++ b/lib/screens/onBoarding/10.dart
@@ -1,64 +1,167 @@
// ignore_for_file: file_names
+import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
+import 'package:gecko/providers/generate_wallets.dart';
+import 'package:gecko/providers/my_wallets.dart';
+import 'package:gecko/providers/substrate_sdk.dart';
+import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/screens/common_elements.dart';
-import 'package:gecko/screens/onBoarding/11.dart';
+import 'package:gecko/screens/onBoarding/11_congratulations.dart';
+import 'package:pin_code_fields/pin_code_fields.dart';
+import 'package:provider/provider.dart';
// ignore: must_be_immutable
-class OnboardingStepTwelve extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 9;
+class OnboardingStepFourteen extends StatelessWidget {
+ OnboardingStepFourteen({
+ Key? validationKey,
+ }) : super(key: validationKey);
- OnboardingStepTwelve({Key? key}) : super(key: key);
+ final formKey = GlobalKey<FormState>();
+ Color? pinColor = const Color(0xFFA4B600);
+ bool hasError = false;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context);
+ WalletOptionsProvider _walletOptions =
+ Provider.of<WalletOptionsProvider>(context);
CommonElements common = CommonElements();
+ final int _pinLenght = _generateWalletProvider.pin.text.length;
return Scaffold(
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Mon code secret',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
extendBodyBehindAppBar: true,
body: SafeArea(
child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre coffre.",
- textKey: const Key('step10'),
- ),
- const SizedBox(height: 10),
- Image.asset(
- 'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png',
- height: isTall ? 410 : 380,
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep11'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: const OnboardingStepThirteen(),
- isFast: true),
- );
- },
- child: const Text("Générer le code secret",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 80),
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildProgressBar(9),
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildText(<TextSpan>[
+ TextSpan(
+ text:
+ "Gecko va vérifier avec vous si vous avez bien mémorisé votre code secret.\n\nTapez votre code secret dans le champ ci-dessous pour vérifier que vous l’avez bien noté.",
+ style: TextStyle(fontSize: 16 * ratio))
+ ]),
+ SizedBox(height: isTall ? 80 : 20),
+ pinForm(context, _walletOptions, _pinLenght, 1, 2)
]),
));
}
+
+ Widget pinForm(context, WalletOptionsProvider _walletOptions, _pinLenght,
+ int _walletNbr, int _derivation) {
+ // var _walletPin = '';
+// ignore: close_sinks
+ StreamController<ErrorAnimationType> errorController =
+ StreamController<ErrorAnimationType>();
+ TextEditingController _enterPin = TextEditingController();
+ MyWalletsProvider _myWalletProvider =
+ Provider.of<MyWalletsProvider>(context);
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context);
+ SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
+
+ final int? _currentChest = _myWalletProvider.getCurrentChest();
+
+ return Form(
+ key: formKey,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
+ child: PinCodeTextField(
+ key: const Key('formKey2'),
+ autoFocus: true,
+ appContext: context,
+ pastedTextStyle: TextStyle(
+ color: Colors.green.shade600,
+ fontWeight: FontWeight.bold,
+ ),
+ length: _pinLenght,
+ obscureText: true,
+ obscuringCharacter: '*',
+ animationType: AnimationType.fade,
+ validator: (v) {
+ if (v!.length < _pinLenght) {
+ return "Votre code PIN fait $_pinLenght caractères";
+ } else {
+ return null;
+ }
+ },
+ pinTheme: PinTheme(
+ activeColor: pinColor,
+ borderWidth: 4,
+ shape: PinCodeFieldShape.box,
+ borderRadius: BorderRadius.circular(5),
+ fieldHeight: 60,
+ fieldWidth: 50,
+ activeFillColor: hasError ? Colors.blueAccent : Colors.black,
+ ),
+ cursorColor: Colors.black,
+ animationDuration: const Duration(milliseconds: 300),
+ textStyle: const TextStyle(fontSize: 20, height: 1.6),
+ backgroundColor: const Color(0xffF9F9F1),
+ enableActiveFill: false,
+ errorAnimationController: errorController,
+ controller: _enterPin,
+ keyboardType: TextInputType.text,
+ boxShadows: const [
+ BoxShadow(
+ offset: Offset(0, 1),
+ color: Colors.black12,
+ blurRadius: 10,
+ )
+ ],
+ onCompleted: (_pin) async {
+ _myWalletProvider.pinCode = _pin.toUpperCase();
+ _myWalletProvider.pinLenght = _pinLenght;
+ log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
+ if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
+ pinColor = Colors.green[500];
+ final address = await _sub.importAccount(
+ fromMnemonic: true,
+ mnemonic: _generateWalletProvider.generatedMnemonic!,
+ derivePath: '//2',
+ password: _generateWalletProvider.pin.text);
+ await _generateWalletProvider.storeHDWChest(
+ address, 'Mon portefeuille courant', context);
+ _myWalletProvider.readAllWallets(_currentChest);
+ // scheduleMicrotask(() {
+ // _walletOptions.reloadBuild();
+ _myWalletProvider.rebuildWidget();
+ // });
+ _generateWalletProvider.generatedMnemonic = '';
+ Navigator.push(
+ context,
+ FaderTransition(
+ page: const OnboardingStepFiveteen(), isFast: false),
+ );
+ } else {
+ errorController.add(ErrorAnimationType
+ .shake); // Triggering error shake animation
+ hasError = true;
+ pinColor = Colors.red[600];
+ _walletOptions.reloadBuild();
+ }
+ },
+ onChanged: (value) {
+ if (pinColor != const Color(0xFFA4B600)) {
+ pinColor = const Color(0xFFA4B600);
+ }
+ },
+ )),
+ );
+ }
}
diff --git a/lib/screens/onBoarding/11.dart b/lib/screens/onBoarding/11.dart
deleted file mode 100644
index 5212863d4f58b06ae2696de977e34786bec519f4..0000000000000000000000000000000000000000
--- a/lib/screens/onBoarding/11.dart
+++ /dev/null
@@ -1,121 +0,0 @@
-// ignore_for_file: file_names
-import 'package:flutter/foundation.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter/material.dart';
-import 'package:gecko/globals.dart';
-import 'package:gecko/providers/generate_wallets.dart';
-import 'package:gecko/screens/common_elements.dart';
-import 'package:gecko/screens/onBoarding/12.dart';
-import 'package:provider/provider.dart';
-
-// ignore: must_be_immutable
-class OnboardingStepThirteen extends StatelessWidget {
- final int progress = 10;
-
- const OnboardingStepThirteen({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
- // MyWalletsProvider myWalletProvider =
- // Provider.of<MyWalletsProvider>(context);
- CommonElements common = CommonElements();
-
- _generateWalletProvider.pin.text = kDebugMode && debugPin
- ? 'AAAAA'
- : _generateWalletProvider.changePinCode(reload: false);
-
- return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeakRich(
- <TextSpan>[
- const TextSpan(
- text:
- "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "),
- const TextSpan(
- text: 'à chaque fois',
- style: TextStyle(fontWeight: FontWeight.bold)),
- const TextSpan(
- text:
- " que vous voudrez effectuer un paiement sur cet appareil."),
- ],
- textKey: const Key('step11'),
- ),
- const SizedBox(height: 100),
- 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(
- letterSpacing: 5,
- fontSize: 35.0,
- color: Colors.black,
- fontWeight: FontWeight.bold)),
- IconButton(
- icon: const Icon(Icons.replay),
- color: orangeC,
- onPressed: () {
- _generateWalletProvider.changePinCode(reload: true);
- },
- ),
- ],
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('changeSecretCode'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: const Color(0xffFFD58D),
- onPrimary: Colors.black, // foreground
- ),
- onPressed: () {
- _generateWalletProvider.changePinCode(reload: true);
- },
- child: const Text("Choisir un autre code secret",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 25),
- SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep12'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () async {
- _generateWalletProvider.isAskedWordValid = false;
- _generateWalletProvider.askedWordColor = Colors.black;
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepFourteen(), isFast: true),
- );
- },
- child: const Text("J'ai noté mon code secret",
- style: TextStyle(fontSize: 20))),
- ),
- const SizedBox(height: 80),
- ]),
- ));
- }
-}
diff --git a/lib/screens/onBoarding/11_congratulations.dart b/lib/screens/onBoarding/11_congratulations.dart
new file mode 100644
index 0000000000000000000000000000000000000000..67f077780bda85dcdc54b84ee619392a72510b6a
--- /dev/null
+++ b/lib/screens/onBoarding/11_congratulations.dart
@@ -0,0 +1,78 @@
+// ignore_for_file: file_names
+
+import 'package:flutter/services.dart';
+import 'package:flutter/material.dart';
+import 'package:gecko/globals.dart';
+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);
+
+ @override
+ Widget build(BuildContext context) {
+ SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
+ CommonElements common = CommonElements();
+
+ return Scaffold(
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'C’est tout bon !',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: Column(children: <Widget>[
+ const SizedBox(height: 40),
+ common.buildText(<TextSpan>[
+ const TextSpan(
+ text:
+ "Top !\n\nVotre coffre votre premier portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
+ )
+ ]),
+ SizedBox(height: isTall ? 20 : 10),
+ Image.asset(
+ 'assets/onBoarding/gecko-clin.gif',
+ height: isTall ? 400 : 300,
+ ),
+ Expanded(
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: finishButton(context)),
+ ),
+ const SizedBox(height: 40),
+ ]),
+ ));
+ }
+}
+
+Widget finishButton(BuildContext context) {
+ return SizedBox(
+ width: 410,
+ height: 70,
+ child: ElevatedButton(
+ key: const Key('goWalletHome'),
+ style: ElevatedButton.styleFrom(
+ elevation: 4,
+ primary: orangeC,
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () {
+ Navigator.pushAndRemoveUntil(
+ context,
+ MaterialPageRoute(builder: (context) {
+ return const WalletsHome();
+ }),
+ ModalRoute.withName('/'),
+ );
+ },
+ child: const Text("Accéder à mon coffre",
+ style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600))),
+ );
+}
diff --git a/lib/screens/onBoarding/12.dart b/lib/screens/onBoarding/12.dart
deleted file mode 100644
index 3e10c496a2d367520e88c17d0dfa0eeae16761c1..0000000000000000000000000000000000000000
--- a/lib/screens/onBoarding/12.dart
+++ /dev/null
@@ -1,155 +0,0 @@
-// ignore_for_file: file_names
-
-import 'dart:async';
-import 'package:flutter/services.dart';
-import 'package:flutter/material.dart';
-import 'package:gecko/globals.dart';
-import 'package:gecko/providers/generate_wallets.dart';
-import 'package:gecko/providers/my_wallets.dart';
-import 'package:gecko/providers/substrate_sdk.dart';
-import 'package:gecko/providers/wallet_options.dart';
-import 'package:gecko/screens/common_elements.dart';
-import 'package:gecko/screens/onBoarding/13_congratulations.dart';
-import 'package:pin_code_fields/pin_code_fields.dart';
-import 'package:provider/provider.dart';
-
-// ignore: must_be_immutable
-class OnboardingStepFourteen extends StatelessWidget {
- OnboardingStepFourteen({
- Key? validationKey,
- }) : super(key: validationKey);
-
- final int progress = 11;
- final formKey = GlobalKey<FormState>();
- Color? pinColor = const Color(0xFFA4B600);
- bool hasError = false;
-
- @override
- Widget build(BuildContext context) {
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
- WalletOptionsProvider _walletOptions =
- Provider.of<WalletOptionsProvider>(context);
- CommonElements common = CommonElements();
- final int _pinLenght = _generateWalletProvider.pin.text.length;
-
- return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après c’est fini, promis-juré-gecko).",
- textKey: const Key('step12'),
- ),
- SizedBox(height: isTall ? 80 : 10),
- pinForm(context, _walletOptions, _pinLenght, 1, 2)
- ]),
- ));
- }
-
- Widget pinForm(context, WalletOptionsProvider _walletOptions, _pinLenght,
- int _walletNbr, int _derivation) {
- // var _walletPin = '';
-// ignore: close_sinks
- StreamController<ErrorAnimationType> errorController =
- StreamController<ErrorAnimationType>();
- TextEditingController _enterPin = TextEditingController();
- MyWalletsProvider _myWalletProvider =
- Provider.of<MyWalletsProvider>(context);
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
- SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
-
- final int? _currentChest = _myWalletProvider.getCurrentChest();
-
- return Form(
- key: formKey,
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
- child: PinCodeTextField(
- key: const Key('formKey2'),
- autoFocus: true,
- appContext: context,
- pastedTextStyle: TextStyle(
- color: Colors.green.shade600,
- fontWeight: FontWeight.bold,
- ),
- length: _pinLenght,
- obscureText: true,
- obscuringCharacter: '*',
- animationType: AnimationType.fade,
- validator: (v) {
- if (v!.length < _pinLenght) {
- return "Votre code PIN fait $_pinLenght caractères";
- } else {
- return null;
- }
- },
- pinTheme: PinTheme(
- activeColor: pinColor,
- borderWidth: 4,
- shape: PinCodeFieldShape.box,
- borderRadius: BorderRadius.circular(5),
- fieldHeight: 60,
- fieldWidth: 50,
- activeFillColor: hasError ? Colors.blueAccent : Colors.black,
- ),
- cursorColor: Colors.black,
- animationDuration: const Duration(milliseconds: 300),
- textStyle: const TextStyle(fontSize: 20, height: 1.6),
- backgroundColor: const Color(0xffF9F9F1),
- enableActiveFill: false,
- errorAnimationController: errorController,
- controller: _enterPin,
- keyboardType: TextInputType.text,
- boxShadows: const [
- BoxShadow(
- offset: Offset(0, 1),
- color: Colors.black12,
- blurRadius: 10,
- )
- ],
- onCompleted: (_pin) async {
- _myWalletProvider.pinCode = _pin.toUpperCase();
- _myWalletProvider.pinLenght = _pinLenght;
- log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
- if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
- pinColor = Colors.green[500];
- final address = await _sub.importAccount(
- fromMnemonic: true,
- mnemonic: _generateWalletProvider.generatedMnemonic!,
- derivePath: '//2',
- password: _generateWalletProvider.pin.text);
- await _generateWalletProvider.storeHDWChest(
- address, 'Mon portefeuille courant', context);
- _myWalletProvider.readAllWallets(_currentChest);
- // scheduleMicrotask(() {
- // _walletOptions.reloadBuild();
- _myWalletProvider.rebuildWidget();
- // });
- _generateWalletProvider.generatedMnemonic = '';
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepFiveteen(), isFast: false),
- );
- } else {
- errorController.add(ErrorAnimationType
- .shake); // Triggering error shake animation
- hasError = true;
- pinColor = Colors.red[600];
- _walletOptions.reloadBuild();
- }
- },
- onChanged: (value) {
- if (pinColor != const Color(0xFFA4B600)) {
- pinColor = const Color(0xFFA4B600);
- }
- },
- )),
- );
- }
-}
diff --git a/lib/screens/onBoarding/13_congratulations.dart b/lib/screens/onBoarding/13_congratulations.dart
deleted file mode 100644
index 31b68dd7eeeca285f74bf95214a6e5d0385f4758..0000000000000000000000000000000000000000
--- a/lib/screens/onBoarding/13_congratulations.dart
+++ /dev/null
@@ -1,67 +0,0 @@
-// ignore_for_file: file_names
-
-import 'package:flutter/services.dart';
-import 'package:flutter/material.dart';
-import 'package:gecko/globals.dart';
-import 'package:gecko/screens/common_elements.dart';
-import 'package:gecko/screens/myWallets/wallets_home.dart';
-
-// ignore: must_be_immutable
-class OnboardingStepFiveteen extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 12;
-
- OnboardingStepFiveteen({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- CommonElements common = CommonElements();
-
- return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "Top !\n\nVotre coffre de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
- textKey: const Key('step13'),
- ),
- SizedBox(height: isTall ? 20 : 10),
- Image.asset(
- 'assets/onBoarding/gecko-clin.gif',
- height: isTall ? 400 : 300,
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goWalletHome'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.pushAndRemoveUntil(
- context,
- MaterialPageRoute(builder: (context) {
- return const WalletsHome();
- }),
- ModalRoute.withName('/'),
- );
- },
- child: const Text("Accéder à mes portefeuilles",
- style: TextStyle(fontSize: 20))),
- ),
- ),
- ),
- const SizedBox(height: 80),
- ]),
- ));
- }
-}
diff --git a/lib/screens/onBoarding/2.dart b/lib/screens/onBoarding/2.dart
index ab5bf13b064fc27d795b2ff37a251b734fbf842c..6f2d4967b2fe0cd67d85acac310417d32191f6a0 100644
--- a/lib/screens/onBoarding/2.dart
+++ b/lib/screens/onBoarding/2.dart
@@ -5,16 +5,9 @@ import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/3.dart';
-// import 'package:gecko/screens/commonElements.dart';
-// import 'package:gecko/models/home.dart';
-// import 'package:provider/provider.dart';
-// ignore: must_be_immutable
class OnboardingStepTwo extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 2;
-
- OnboardingStepTwo({Key? key}) : super(key: key);
+ const OnboardingStepTwo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -22,44 +15,30 @@ class OnboardingStepTwo extends StatelessWidget {
CommonElements common = CommonElements();
return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Nouveau portefeuilles', progress),
- common.bubbleSpeak(
- "Un coffre est créé à partir d’une phrase de restauration.",
- textKey: const Key('step2'),
- ),
- const SizedBox(height: 70),
- Image.asset(
- 'assets/onBoarding/keys-and-wallets-horizontal-plus-phrase.png'),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep3'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepFor(), isFast: true),
- );
- },
- child: const Text("D'accord",
- style: TextStyle(fontSize: 20)),
- ),
- ))),
- const SizedBox(height: 80),
- ]),
- ));
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Votre phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(
+ text:
+ 'Conservez cette phrase précieusement, car sans elle Gecko ne pourra pas reconstruire vos portefeuilles le jour où vous changez de téléphone.'),
+ ],
+ 'fabrication-de-portefeuille-impossible-sans-phrase.png',
+ '>',
+ const OnboardingStepThree(),
+ 1),
+ ),
+ );
}
}
diff --git a/lib/screens/onBoarding/3.dart b/lib/screens/onBoarding/3.dart
index 7f331ca21492ce874123d7a3efacf98cfe99ab94..ebce3a42a0aa41a0536dcf4db4c296d33b60c333 100644
--- a/lib/screens/onBoarding/3.dart
+++ b/lib/screens/onBoarding/3.dart
@@ -6,12 +6,8 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/4.dart';
-// ignore: must_be_immutable
-class OnboardingStepFor extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 3;
-
- OnboardingStepFor({Key? key}) : super(key: key);
+class OnboardingStepThree extends StatelessWidget {
+ const OnboardingStepThree({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -19,50 +15,28 @@ class OnboardingStepFor extends StatelessWidget {
CommonElements common = CommonElements();
return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre coffre.",
- textKey: const Key('step3'),
- ),
- SizedBox(height: isTall ? 15 : 0),
- // Row(children: <Widget>[
- // Align(
- // alignment: Alignment.centerRight,
- // child:
- Image.asset(
- 'assets/onBoarding/plusieurs-appareils-un-trousseau.png',
- height: 400 * ratio,
- ),
- // ]),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep4'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepFive(), isFast: true),
- );
- },
- child: const Text("J'ai compris",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 80),
- ]),
- ));
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Votre phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(text: 'Dans une blockchain, pas de procédure de récupération par mail. Seule votre phrase de restauration peut vous permettre de récupérer vos Ğ1 à tout moment.'),
+ ],
+ 'mot-de-passe-oublie.png',
+ '>',
+ const OnboardingStepFor(),
+ 2),
+ ),
+ );
}
}
diff --git a/lib/screens/onBoarding/4.dart b/lib/screens/onBoarding/4.dart
index 831100081d0bef6fb3a0eebcc25f068b4139196c..3b481a4c78173f2a47a1ac1ab3b9f863d678dc68 100644
--- a/lib/screens/onBoarding/4.dart
+++ b/lib/screens/onBoarding/4.dart
@@ -6,12 +6,8 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/5.dart';
-// ignore: must_be_immutable
-class OnboardingStepFive extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 4;
-
- OnboardingStepFive({Key? key}) : super(key: key);
+class OnboardingStepFor extends StatelessWidget {
+ const OnboardingStepFor({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -19,45 +15,33 @@ class OnboardingStepFive extends StatelessWidget {
CommonElements common = CommonElements();
return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "Par contre, attention :\n\nDans une blockchain, il n’y a pas de procédure de récupération de coffre.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.",
- textKey: const Key('step4'),
- ),
- SizedBox(height: isTall ? 30 : 10),
- Image.asset(
- 'assets/onBoarding/maison-qui-brule.png',
- width: 320 * ratio,
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep5'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepSeven(), isFast: true),
- );
- },
- child: const Text("J'ai compris",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 80),
- ]),
- ));
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Votre phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(text: 'Il est temps de vous munir d’'),
+ const TextSpan(
+ text: 'un d’un papier et d’un crayon',
+ style: TextStyle(fontWeight: FontWeight.bold)),
+ const TextSpan(
+ text: ' afin de pouvoir noter votre phrase de restauration.'),
+ ],
+ 'gecko-oublie-aussi.png',
+ '>',
+ const OnboardingStepFive(),
+ 3),
+ ),
+ );
}
}
diff --git a/lib/screens/onBoarding/5.dart b/lib/screens/onBoarding/5.dart
index af8c3ad6bc1b9519cb48c9f348ead71912f8d6f6..fca4806292538d52e7c01b763ebf3ae5de2f7e06 100644
--- a/lib/screens/onBoarding/5.dart
+++ b/lib/screens/onBoarding/5.dart
@@ -3,78 +3,243 @@
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
+import 'package:gecko/providers/generate_wallets.dart';
+import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/6.dart';
+import 'package:printing/printing.dart';
+import 'package:provider/provider.dart';
-// ignore: must_be_immutable
-class OnboardingStepSeven extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 5;
+AsyncSnapshot<List>? mnemoList;
- OnboardingStepSeven({Key? key}) : super(key: key);
+class OnboardingStepFive extends StatelessWidget {
+ const OnboardingStepFive({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context, listen: false);
+
CommonElements common = CommonElements();
return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeakRich(
- <TextSpan>[
- const TextSpan(text: "Munissez-vous d'"),
- const TextSpan(
- text: 'un papier et d’un crayon\n',
- style: TextStyle(fontWeight: FontWeight.bold)),
- const TextSpan(
- text:
- "afin de pouvoir noter votre phrase de restauration."),
- ],
- textKey: const Key('step5'),
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Votre phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: Column(children: [
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildProgressBar(4),
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildText(
+ <TextSpan>[
+ const TextSpan(
+ text:
+ '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),
+ sentanceArray(context),
+ const SizedBox(height: 20),
+ GestureDetector(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) {
+ return PrintWallet(_generateWalletProvider.generatedMnemonic);
+ }),
+ );
+ },
+ child: Image.asset(
+ 'assets/printer.png',
+ height: 45,
),
- Expanded(
- child: Align(
+ ),
+ const SizedBox(height: 40),
+ Expanded(
+ child: Align(
alignment: Alignment.bottomCenter,
- child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
- Container(
- padding: const EdgeInsets.only(bottom: 90),
- child: common.bubbleSpeak(
- "Moi, j’ai déjà essayé de\nmémoriser une phrase de\nrestauration, mais je n’ai\npas une mémoire\nd’éléphant.",
- isMaxWidth: false),
- ),
- Image.asset(
- 'assets/onBoarding/chopp-gecko.png',
- height: 200,
- ),
- ]),
- )),
- SizedBox(height: isTall ? 120 : 50),
- SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep6'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepEight(), isFast: true),
- );
- },
- child: const Text("J'ai de quoi noter",
- style: TextStyle(fontSize: 20))),
+ child: SizedBox(
+ width: 410,
+ height: 70,
+ child: ElevatedButton(
+ key: const Key('generateMnemonic'),
+ style: ElevatedButton.styleFrom(
+ elevation: 4,
+ primary: const Color(0xffFFD58D),
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () {
+ _generateWalletProvider.reloadBuild();
+ // setState(() {});
+ },
+ child: const Text("Choisir une autre phrase",
+ style: TextStyle(
+ fontSize: 24, fontWeight: FontWeight.w600))),
+ ),
),
- const SizedBox(height: 80),
- ]),
- ));
+ ),
+ const SizedBox(height: 25),
+ nextButton(context, "J'ai noté ma phrase", false),
+ const SizedBox(height: 40),
+ ]),
+ ),
+ );
}
}
+
+Widget sentanceArray(BuildContext context) {
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context);
+
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 3),
+ child: Container(
+ constraints: const BoxConstraints(maxWidth: 450),
+ decoration: BoxDecoration(
+ border: Border.all(color: Colors.black),
+ color: const Color(0xffeeeedd),
+ borderRadius: const BorderRadius.all(
+ Radius.circular(10),
+ )),
+ padding: const EdgeInsets.all(20),
+ child: FutureBuilder(
+ future: _generateWalletProvider.generateWordList(context),
+ builder: (BuildContext context, AsyncSnapshot<List> _data) {
+ if (!_data.hasData) {
+ return const Text('');
+ } else {
+ mnemoList = _data;
+ return Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: <Widget>[
+ Row(children: <Widget>[
+ arrayCell(_data.data![0]),
+ arrayCell(_data.data![1]),
+ arrayCell(_data.data![2]),
+ arrayCell(_data.data![3]),
+ ]),
+ const SizedBox(height: 15),
+ Row(children: <Widget>[
+ arrayCell(_data.data![4]),
+ arrayCell(_data.data![5]),
+ arrayCell(_data.data![6]),
+ arrayCell(_data.data![7]),
+ ]),
+ const SizedBox(height: 15),
+ Row(children: <Widget>[
+ arrayCell(_data.data![8]),
+ arrayCell(_data.data![9]),
+ arrayCell(_data.data![10]),
+ arrayCell(_data.data![11]),
+ ]),
+ ]);
+ }
+ }),
+ ),
+ );
+}
+
+Widget arrayCell(dataWord) {
+ return SizedBox(
+ width: 100,
+ child: Column(children: <Widget>[
+ Text(
+ dataWord.split(':')[0],
+ style: const TextStyle(fontSize: 15, color: Color(0xff6b6b52)),
+ ),
+ Text(
+ dataWord.split(':')[1],
+ key: Key('word${dataWord.split(':')[0]}'),
+ style: const TextStyle(fontSize: 20, color: Colors.black),
+ ),
+ ]),
+ );
+}
+
+// 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.black),
+ onPressed: () {
+ Navigator.pop(context);
+ }),
+ backgroundColor: yellowC,
+ foregroundColor: Colors.black,
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Imprimer ma phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ body: PdfPreview(
+ canDebug: false,
+ canChangeOrientation: false,
+ build: (format) => _generateWalletProvider.printWallet(mnemoList),
+ ),
+ ),
+ );
+ }
+}
+
+Widget nextButton(BuildContext context, String text, bool isFast) {
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context, listen: false);
+ MyWalletsProvider _myWalletProvider =
+ Provider.of<MyWalletsProvider>(context, listen: false);
+ return SizedBox(
+ width: 410,
+ height: 70,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 4,
+ primary: orangeC, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () {
+ _generateWalletProvider.nbrWord =
+ _generateWalletProvider.getRandomInt();
+ _generateWalletProvider.nbrWordAlpha = _generateWalletProvider
+ .intToString(_generateWalletProvider.nbrWord + 1);
+ _myWalletProvider.mnemonic = _generateWalletProvider.generatedMnemonic!;
+
+ Navigator.push(
+ context,
+ FaderTransition(
+ page: OnboardingStepSix(
+ generatedMnemonic: _generateWalletProvider.generatedMnemonic),
+ isFast: true),
+ );
+ },
+ child: Text(
+ text,
+ style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
+ ),
+ ),
+ );
+}
diff --git a/lib/screens/onBoarding/6.dart b/lib/screens/onBoarding/6.dart
index dc2b11985d5cd40724774561291702ecbcc00fcc..ba256c07ba3ed81ca4645d01b55753fc735171a1 100644
--- a/lib/screens/onBoarding/6.dart
+++ b/lib/screens/onBoarding/6.dart
@@ -1,124 +1,238 @@
// ignore_for_file: file_names
-import 'dart:ui';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
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:provider/provider.dart';
// ignore: must_be_immutable
-class OnboardingStepEight extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 6;
+class OnboardingStepSix extends StatelessWidget {
+ OnboardingStepSix({Key? key, required this.generatedMnemonic})
+ : super(key: key);
- OnboardingStepEight({Key? key}) : super(key: key);
+ String? generatedMnemonic;
+ TextEditingController wordController = TextEditingController();
+ final TextEditingController _mnemonicController = TextEditingController();
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context, listen: true);
+
CommonElements common = CommonElements();
+ _mnemonicController.text = generatedMnemonic!;
- return Scaffold(
+ return WillPopScope(
+ onWillPop: () {
+ _generateWalletProvider.isAskedWordValid = false;
+ _generateWalletProvider.askedWordColor = Colors.black;
+ return Future<bool>.value(true);
+ },
+ child: Scaffold(
+ resizeToAvoidBottomInset: false,
extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "J’ai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.",
- textKey: const Key('step6'),
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Votre phrase de restauration',
+ style: TextStyle(fontWeight: FontWeight.w600),
),
- SizedBox(height: isTall ? 70 : 40),
- // SizedBox(height: 30),
- sentanceArray(context),
- // ),
- Expanded(
- child: Align(
+ ),
+ ),
+ body: SafeArea(
+ child: Align(
+ alignment: Alignment.topCenter,
+ child: Column(children: [
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildProgressBar(5),
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildText(
+ <TextSpan>[
+ TextSpan(
+ text:
+ "Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le ",
+ style: TextStyle(fontSize: 16 * ratio)),
+ TextSpan(
+ text: '${_generateWalletProvider.nbrWord + 1}ème mot',
+ style: TextStyle(
+ fontWeight: FontWeight.bold, fontSize: 16 * ratio)),
+ TextSpan(
+ text: " de votre phrase de restauration :",
+ style: TextStyle(fontSize: 16 * ratio)),
+ ],
+ ),
+ SizedBox(height: isTall ? 70 : 20),
+ Text('${_generateWalletProvider.nbrWord + 1}',
+ key: const Key('askedWord'),
+ style: TextStyle(
+ fontSize: isTall ? 17 : 15,
+ color: orangeC,
+ fontWeight: FontWeight.w400)),
+ const SizedBox(height: 10),
+ Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(7),
+ border: Border.all(
+ color: Colors.grey[600]!,
+ width: 3,
+ )),
+ width: 430,
+ child: TextFormField(
+ key: const Key('inputWord'),
+ autofocus: true,
+ enabled: !_generateWalletProvider.isAskedWordValid,
+ controller: wordController,
+ textInputAction: TextInputAction.next,
+ onChanged: (value) {
+ _generateWalletProvider.checkAskedWord(
+ value, _mnemonicController.text);
+ },
+ maxLines: 1,
+ textAlign: TextAlign.center,
+ decoration: InputDecoration(
+ labelStyle: TextStyle(
+ fontSize: 22.0,
+ color: Colors.grey[500],
+ fontWeight: FontWeight.w500),
+ labelText: _generateWalletProvider.isAskedWordValid
+ ? "C'est le bon mot !"
+ : "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration",
+ fillColor: const Color(0xffeeeedd),
+ filled: true,
+ contentPadding: const EdgeInsets.all(12),
+ ),
+ style: TextStyle(
+ fontSize: 40.0,
+ color: _generateWalletProvider.askedWordColor,
+ fontWeight: FontWeight.w500))),
+ Visibility(
+ visible: _generateWalletProvider.isAskedWordValid,
+ child: Expanded(
+ child: Align(
alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep7'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepNine(), isFast: false),
- );
- },
- child: const Text("Afficher ma phrase",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 80),
- ]),
- ));
+ child: nextButton(context, 'Continuer',
+ const OnboardingStepSeven(), false),
+ ),
+ ),
+ ),
+ // Visibility(
+ // visible: !_generateWalletProvider.isAskedWordValid,
+ // child: const Expanded(
+ // child: Align(
+ // alignment: Alignment.bottomCenter,
+ // child: Text(''),
+ // ),
+ // ),
+ // ),
+ const SizedBox(height: 40),
+ ]),
+ ),
+ ),
+ ),
+ );
}
}
Widget sentanceArray(BuildContext context) {
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context);
+
return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 12),
- child: Container(
- constraints: const BoxConstraints(maxWidth: 450),
- decoration: BoxDecoration(
- border: Border.all(color: Colors.black),
- color: Colors.grey[300],
- borderRadius: const BorderRadius.all(
- Radius.circular(10),
- )),
- // color: Colors.grey[300],
- padding: const EdgeInsets.all(20),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Row(children: <Widget>[
- arrayCell("1:exquis"),
- arrayCell("2:favori"),
- arrayCell("3:curseur"),
- arrayCell("4:relatif"),
- ]),
- const SizedBox(height: 15),
- Row(children: <Widget>[
- arrayCell("5:embellir"),
- arrayCell("6:cultiver"),
- arrayCell("7:bureau"),
- arrayCell("8:ossature"),
- ]),
- const SizedBox(height: 15),
- Row(children: <Widget>[
- arrayCell("9:labial"),
- arrayCell("10:science"),
- arrayCell("11:théorie"),
- arrayCell("12:Monnaie"),
- ]),
- ])));
+ padding: const EdgeInsets.symmetric(horizontal: 3),
+ child: Container(
+ constraints: const BoxConstraints(maxWidth: 450),
+ decoration: BoxDecoration(
+ border: Border.all(color: Colors.black),
+ color: const Color(0xffeeeedd),
+ borderRadius: const BorderRadius.all(
+ Radius.circular(10),
+ )),
+ padding: const EdgeInsets.all(20),
+ child: FutureBuilder(
+ future: _generateWalletProvider.generateWordList(context),
+ builder: (BuildContext context, AsyncSnapshot<List> _data) {
+ if (!_data.hasData) {
+ return const Text('');
+ } else {
+ return Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: <Widget>[
+ Row(children: <Widget>[
+ arrayCell(_data.data![0]),
+ arrayCell(_data.data![1]),
+ arrayCell(_data.data![2]),
+ arrayCell(_data.data![3]),
+ ]),
+ const SizedBox(height: 15),
+ Row(children: <Widget>[
+ arrayCell(_data.data![4]),
+ arrayCell(_data.data![5]),
+ arrayCell(_data.data![6]),
+ arrayCell(_data.data![7]),
+ ]),
+ const SizedBox(height: 15),
+ Row(children: <Widget>[
+ arrayCell(_data.data![8]),
+ arrayCell(_data.data![9]),
+ arrayCell(_data.data![10]),
+ arrayCell(_data.data![11]),
+ ]),
+ ]);
+ }
+ }),
+ ),
+ );
}
Widget arrayCell(dataWord) {
return SizedBox(
- width: 102,
- child: Column(
- children: <Widget>[
- ImageFiltered(
- imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
- child: Text(dataWord.split(':')[0],
- style: const TextStyle(fontSize: 14, color: Colors.black)),
- ),
- const SizedBox(height: 2),
- ImageFiltered(
- imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
- child: Text(dataWord.split(':')[1],
- style: const TextStyle(fontSize: 19, color: Colors.black)),
- )
- ],
- ));
+ width: 100,
+ child: Column(children: <Widget>[
+ Text(
+ dataWord.split(':')[0],
+ style: const TextStyle(fontSize: 15, color: Color(0xff6b6b52)),
+ ),
+ Text(
+ dataWord.split(':')[1],
+ key: Key('word${dataWord.split(':')[0]}'),
+ style: const TextStyle(fontSize: 20, color: Colors.black),
+ ),
+ ]),
+ );
+}
+
+Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context, listen: false);
+
+ _generateWalletProvider.isAskedWordValid = false;
+ _generateWalletProvider.askedWordColor = Colors.black;
+
+ return SizedBox(
+ width: 410,
+ height: 70,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 4,
+ primary: orangeC, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () {
+ Navigator.push(
+ context, FaderTransition(page: nextScreen, isFast: isFast));
+ },
+ child: Text(
+ text,
+ style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
+ ),
+ ),
+ );
}
diff --git a/lib/screens/onBoarding/7.dart b/lib/screens/onBoarding/7.dart
index c7182a0fada7126235a648c372e9a40d6e54754c..1c0c96c2c3af3f604deb49c377571d927da4215e 100644
--- a/lib/screens/onBoarding/7.dart
+++ b/lib/screens/onBoarding/7.dart
@@ -1,231 +1,43 @@
// ignore_for_file: file_names
-
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
-import 'package:gecko/providers/generate_wallets.dart';
-import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/8.dart';
-import 'package:printing/printing.dart';
-import 'package:provider/provider.dart';
-
-// ignore: must_be_immutable
-class OnboardingStepNine extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 6;
- OnboardingStepNine({Key? key}) : super(key: key);
+class OnboardingStepSeven extends StatelessWidget {
+ const OnboardingStepSeven({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
- MyWalletsProvider _myWalletProvider =
- Provider.of<MyWalletsProvider>(context);
CommonElements common = CommonElements();
-
- // _generateWalletProvider.generateMnemonic();
-
return Scaffold(
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeak(
- "C'est le moment de noter votre phrase !",
- textKey: const Key('step7'),
- long: 60,
- ),
- SizedBox(height: isTall ? 100 : 70),
- sentanceArray(context),
- SizedBox(height: isTall ? 20 : 15),
- GestureDetector(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) {
- return PrintWallet(
- _generateWalletProvider.generatedMnemonic);
- }),
- );
- },
- child: Image.asset(
- 'assets/printer.png',
- height: 35,
- ),
- ),
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('generateMnemonic'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: const Color(0xffFFD58D),
- onPrimary: Colors.black, // foreground
- ),
- onPressed: () {
- _generateWalletProvider.reloadBuild();
- },
- child: const Text("Choisir une autre phrase",
- style: TextStyle(fontSize: 20))),
- ))),
- const SizedBox(height: 25),
- SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep8'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- _generateWalletProvider.nbrWord =
- _generateWalletProvider.getRandomInt();
- _generateWalletProvider.nbrWordAlpha =
- _generateWalletProvider
- .intToString(_generateWalletProvider.nbrWord + 1);
- _myWalletProvider.mnemonic =
- _generateWalletProvider.generatedMnemonic!;
-
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepTen(
- generatedMnemonic:
- _generateWalletProvider.generatedMnemonic),
- isFast: true),
- );
- },
- child: const Text("J'ai noté ma phrase",
- style: TextStyle(fontSize: 20))),
- ),
- const SizedBox(height: 80),
- ]),
- ));
- }
-}
-
-Widget sentanceArray(BuildContext context) {
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
-
- // List formatedArray = _generateWalletProvider.generateWordList();
- // List formatedArray = [
- // '0:',
- // '1:',
- // '2:',
- // '3:',
- // '4:',
- // '5:',
- // '6:',
- // '7:',
- // '8:',
- // '9:',
- // '10:',
- // '11:',
- // ];
-
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 12),
- child: Container(
- constraints: const BoxConstraints(maxWidth: 450),
- decoration: BoxDecoration(
- border: Border.all(color: Colors.black),
- color: Colors.grey[300],
- borderRadius: const BorderRadius.all(
- Radius.circular(10),
- )),
- // color: Colors.grey[300],
- padding: const EdgeInsets.all(20),
- child: FutureBuilder(
- future: _generateWalletProvider.generateWordList(context),
- builder: (BuildContext context, AsyncSnapshot<List> _data) {
- if (!_data.hasData) {
- return const Text('');
- } else {
- return Column(
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Row(children: <Widget>[
- arrayCell(_data.data![0]),
- arrayCell(_data.data![1]),
- arrayCell(_data.data![2]),
- arrayCell(_data.data![3]),
- ]),
- const SizedBox(height: 15),
- Row(children: <Widget>[
- arrayCell(_data.data![4]),
- arrayCell(_data.data![5]),
- arrayCell(_data.data![6]),
- arrayCell(_data.data![7]),
- ]),
- const SizedBox(height: 15),
- Row(children: <Widget>[
- arrayCell(_data.data![8]),
- arrayCell(_data.data![9]),
- arrayCell(_data.data![10]),
- arrayCell(_data.data![11]),
- ]),
- ]);
- }
- }),
- ),
- );
-}
-
-Widget arrayCell(dataWord) {
- return SizedBox(
- width: 102,
- child: Column(children: <Widget>[
- Text(
- dataWord.split(':')[0],
- style: const TextStyle(fontSize: 14),
- ),
- const SizedBox(height: 2),
- Text(
- dataWord.split(':')[1],
- key: Key('word${dataWord.split(':')[0]}'),
- style: const TextStyle(fontSize: 19, color: Colors.black),
- ),
- ]),
- );
-}
-
-// 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),
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Mon code secret',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
),
),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(
+ text:
+ 'Gecko va maintenant générer pour vous un code secret court qui vous permettra d’accéder rapidement à vos portefeuilles, sans avoir à taper votre phrase de restauration à chaque fois.'),
+ ],
+ 'coffre-fort-code-secret-dans-telephone.png',
+ '>',
+ const OnboardingStepEight(),
+ 6,
+ boxHeight: 400),
+ ),
);
}
}
diff --git a/lib/screens/onBoarding/8.dart b/lib/screens/onBoarding/8.dart
index c9ec4ca9eacabace88a93ce0d290ded0274dac3b..dd7ce567d644ab16fd51e7d14feb2975f76f98b9 100644
--- a/lib/screens/onBoarding/8.dart
+++ b/lib/screens/onBoarding/8.dart
@@ -2,134 +2,47 @@
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
-import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/9.dart';
-import 'package:provider/provider.dart';
-// ignore: must_be_immutable
-class OnboardingStepTen extends StatelessWidget {
- OnboardingStepTen({
- Key? validationKey,
- required this.generatedMnemonic,
- }) : super(key: validationKey);
-
- String? generatedMnemonic;
- TextEditingController tplController = TextEditingController();
- TextEditingController wordController = TextEditingController();
- final TextEditingController _mnemonicController = TextEditingController();
-
- final int progress = 7;
+class OnboardingStepEight extends StatelessWidget {
+ const OnboardingStepEight({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- GenerateWalletsProvider _generateWalletProvider =
- Provider.of<GenerateWalletsProvider>(context);
CommonElements common = CommonElements();
- _mnemonicController.text = generatedMnemonic!;
-
- return WillPopScope(
- onWillPop: () {
- _generateWalletProvider.isAskedWordValid = false;
- _generateWalletProvider.askedWordColor = Colors.black;
- return Future<bool>.value(true);
- },
- child: Scaffold(
- resizeToAvoidBottomInset: false,
- extendBodyBehindAppBar: true,
- body: SafeArea(
- child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Valider ma phrase de restauration', progress),
- common.bubbleSpeakRich(
- <TextSpan>[
- TextSpan(
- text:
- "Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le ",
- style: TextStyle(fontSize: 16 * ratio)),
- TextSpan(
- text: '${_generateWalletProvider.nbrWord + 1}ème mot',
- style: TextStyle(
- fontWeight: FontWeight.bold, fontSize: 16 * ratio)),
- TextSpan(
- text: " de votre phrase de restauration :",
- style: TextStyle(fontSize: 16 * ratio)),
- ],
- textKey: const Key('step8'),
- ),
- SizedBox(height: isTall ? 70 : 10),
- Text('${_generateWalletProvider.nbrWord + 1}',
- key: const Key('askedWord'),
- style: TextStyle(
- fontSize: isTall ? 17 : 10,
- color: orangeC,
- fontWeight: FontWeight.w400)),
- SizedBox(height: isTall ? 10 : 0),
- Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(7),
- border: Border.all(
- color: Colors.grey[600]!,
- width: 3,
- )),
- width: 430,
- child: TextFormField(
- key: const Key('inputWord'),
- autofocus: true,
- enabled: !_generateWalletProvider.isAskedWordValid,
- controller: wordController,
- textInputAction: TextInputAction.next,
- onChanged: (value) {
- _generateWalletProvider.checkAskedWord(
- value, _mnemonicController.text);
- },
- maxLines: 1,
- textAlign: TextAlign.center,
- decoration: InputDecoration(
- labelStyle: TextStyle(
- fontSize: 22.0,
- color: Colors.grey[500],
- fontWeight: FontWeight.w500),
- labelText: _generateWalletProvider.isAskedWordValid
- ? "C'est le bon mot !"
- : "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration",
- fillColor: Colors.grey[300],
- filled: true,
- contentPadding: const EdgeInsets.all(12),
- ),
- style: TextStyle(
- fontSize: 40.0,
- color: _generateWalletProvider.askedWordColor,
- fontWeight: FontWeight.w500))),
- Visibility(
- visible: _generateWalletProvider.isAskedWordValid,
- child: Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 400,
- height: 62,
- child: ElevatedButton(
- key: const Key('goStep9'),
- style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
- ),
- onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepEleven(),
- isFast: true),
- );
- },
- child: const Text("Continuer",
- style: TextStyle(fontSize: 20))),
- )))),
- const SizedBox(height: 80),
- ]),
- )));
+ return Scaffold(
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Mon code secret',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
+ extendBodyBehindAppBar: true,
+ body: SafeArea(
+ child: common.infoIntro(
+ context,
+ <TextSpan>[
+ const TextSpan(
+ text:
+ 'Ce code secret protège vos portefeuilles dans un coffre-fort '),
+ const TextSpan(
+ text: 'dont vous seul possédez le code',
+ style: TextStyle(fontWeight: FontWeight.bold)),
+ const TextSpan(
+ text:
+ ', de sorte que vos portefeuilles seront inutilisables par d’autres.'),
+ ],
+ 'coffre-fort-protege-les-portefeuilles.png',
+ '>',
+ const OnboardingStepThirteen(),
+ 7),
+ ),
+ );
}
}
diff --git a/lib/screens/onBoarding/9.dart b/lib/screens/onBoarding/9.dart
index cbde0048cd480ab5972d379040f3207c6def0c96..61dc4f6ae6cb2bb9d420a499eb99600851d0d528 100644
--- a/lib/screens/onBoarding/9.dart
+++ b/lib/screens/onBoarding/9.dart
@@ -1,71 +1,109 @@
// ignore_for_file: file_names
-
+import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
+import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/10.dart';
+import 'package:provider/provider.dart';
// ignore: must_be_immutable
-class OnboardingStepEleven extends StatelessWidget {
- TextEditingController tplController = TextEditingController();
- final int progress = 8;
-
- OnboardingStepEleven({Key? key}) : super(key: key);
+class OnboardingStepThirteen extends StatelessWidget {
+ const OnboardingStepThirteen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
+ GenerateWalletsProvider _generateWalletProvider =
+ Provider.of<GenerateWalletsProvider>(context);
+ // MyWalletsProvider myWalletProvider =
+ // Provider.of<MyWalletsProvider>(context);
CommonElements common = CommonElements();
+ _generateWalletProvider.pin.text = kDebugMode && debugPin
+ ? 'AAAAA'
+ : _generateWalletProvider.changePinCode(reload: false);
+
return Scaffold(
+ appBar: AppBar(
+ toolbarHeight: 60 * ratio,
+ title: const SizedBox(
+ height: 22,
+ child: Text(
+ 'Mon code secret',
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
+ ),
+ ),
extendBodyBehindAppBar: true,
body: SafeArea(
child: Column(children: <Widget>[
- common.onboardingProgressBar(
- context, 'Ma phrase de restauration', progress),
- common.bubbleSpeakRich(
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildProgressBar(8),
+ SizedBox(height: isTall ? 40 : 20),
+ common.buildText(
<TextSpan>[
const TextSpan(
- text: "Super !\n\nJe vais maintenant créer votre "),
+ text:
+ "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "),
const TextSpan(
- text: 'code secret.',
+ text: 'à chaque fois',
style: TextStyle(fontWeight: FontWeight.bold)),
const TextSpan(
text:
- " \n\nVotre code secret chiffre votre coffre de clefs, ce qui le rend inutilisable par d’autres, par exemple si vous perdez votre téléphone ou si on vous le vole."),
+ " que vous voudrez effectuer un paiement sur cet appareil."),
],
- textKey: const Key('step9'),
),
- SizedBox(height: isTall ? 50 : 10),
- Image.asset(
- 'assets/onBoarding/treasure-chest-gecko-souligne.png',
- height: 280 * ratio, //5": 400
+ const SizedBox(height: 100),
+ 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(
+ letterSpacing: 5,
+ fontSize: 35.0,
+ color: Colors.black,
+ fontWeight: FontWeight.bold)),
+ IconButton(
+ icon: const Icon(Icons.replay),
+ color: orangeC,
+ onPressed: () {
+ _generateWalletProvider.changePinCode(reload: true);
+ },
+ ),
+ ],
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
- width: 400,
- height: 62,
+ width: 410,
+ height: 70,
child: ElevatedButton(
- key: const Key('goStep10'),
+ key: const Key('changeSecretCode'),
style: ElevatedButton.styleFrom(
- elevation: 5,
- primary: orangeC,
- onPrimary: Colors.white, // foreground
+ elevation: 4,
+ primary: const Color(0xffFFD58D),
+ onPrimary: Colors.black, // foreground
),
onPressed: () {
- Navigator.push(
- context,
- FaderTransition(
- page: OnboardingStepTwelve(), isFast: true),
- );
+ _generateWalletProvider.changePinCode(reload: true);
},
- child: const Text("J'ai compris",
- style: TextStyle(fontSize: 20))),
+ child: const Text("Choisir un autre code secret",
+ style: TextStyle(
+ fontSize: 24, fontWeight: FontWeight.w600))),
))),
- const SizedBox(height: 80),
+ const SizedBox(height: 25),
+ common.nextButton(context, "J'ai noté mon code secret",
+ OnboardingStepFourteen(), false),
+ const SizedBox(height: 40),
]),
));
}
diff --git a/pubspec.lock b/pubspec.lock
index 12dc69daf9b3cec0265b436d53b3e8d925da8267..20798a7aaa6e6739b643cf9f0adcf496c710878f 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -295,6 +295,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.6"
+ dots_indicator:
+ dependency: "direct main"
+ description:
+ name: dots_indicator
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
durt:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 3398932e5c4c1a8e7ed81455a74e4553e88158bf..0745de2d5fe5b8ebc6e9ef37bb98d16fc9253882 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -79,6 +79,7 @@ dependencies:
git:
url: https://github.com/poka-IT/sdk.git
ref: fixAndroidActivityVersion
+ dots_indicator: ^2.1.0
dev_dependencies:
# flutter_launcher_icons: ^0.9.2