Refactoring onboarding
This commit is contained in:
parent
847619bef0
commit
ed734e271e
|
@ -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),
|
||||
)))
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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!;
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ Widget welcomeHome(context) {
|
|||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return OnboardingStepOne();
|
||||
return const OnboardingStepOne();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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!),
|
||||
|
|
|
@ -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),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
]),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
]),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -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))),
|
||||
);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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),
|
||||
]),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
CommonElements common = CommonElements();
|
||||
GenerateWalletsProvider _generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: true);
|
||||
|
||||
return Scaffold(
|
||||
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, '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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue