2021-11-14 19:21:20 +01:00
// ignore_for_file: file_names
2022-06-17 23:10:01 +02:00
import ' package:easy_localization/easy_localization.dart ' ;
2021-03-02 07:05:47 +01:00
import ' package:flutter/services.dart ' ;
import ' package:flutter/material.dart ' ;
2021-03-08 00:32:18 +01:00
import ' package:gecko/globals.dart ' ;
2022-05-23 10:53:44 +02:00
import ' package:gecko/providers/generate_wallets.dart ' ;
2021-11-14 19:21:20 +01:00
import ' package:gecko/screens/common_elements.dart ' ;
2021-03-08 06:21:04 +01:00
import ' package:gecko/screens/onBoarding/10.dart ' ;
2022-05-23 10:53:44 +02:00
import ' package:provider/provider.dart ' ;
2021-03-02 07:05:47 +01:00
// ignore: must_be_immutable
2022-05-25 20:40:25 +02:00
class OnboardingStepNine extends StatelessWidget {
2022-06-07 01:10:40 +02:00
const OnboardingStepNine ( { Key ? key , this . scanDerivation = false } )
: super ( key: key ) ;
final bool scanDerivation ;
2021-11-14 19:21:20 +01:00
2021-03-02 07:05:47 +01:00
@ override
Widget build ( BuildContext context ) {
SystemChrome . setPreferredOrientations ( [ DeviceOrientation . portraitUp ] ) ;
2022-05-23 10:53:44 +02:00
GenerateWalletsProvider _generateWalletProvider =
Provider . of < GenerateWalletsProvider > ( context ) ;
// MyWalletsProvider myWalletProvider =
// Provider.of<MyWalletsProvider>(context);
2021-03-02 07:05:47 +01:00
CommonElements common = CommonElements ( ) ;
2022-05-28 05:59:56 +02:00
_generateWalletProvider . pin . text = debugPin // kDebugMode &&
2022-05-23 10:53:44 +02:00
? ' AAAAA '
2022-05-24 16:51:40 +02:00
: _generateWalletProvider . changePinCode ( reload: false ) . toUpperCase ( ) ;
2022-05-23 10:53:44 +02:00
2021-03-02 07:05:47 +01:00
return Scaffold (
2022-05-29 00:00:57 +02:00
backgroundColor: backgroundColor ,
2022-05-23 10:53:44 +02:00
appBar: AppBar (
toolbarHeight: 60 * ratio ,
2022-06-17 23:10:01 +02:00
title: SizedBox (
2022-05-23 10:53:44 +02:00
height: 22 ,
child: Text (
2022-06-17 23:10:01 +02:00
' myPassword ' . tr ( ) ,
style: const TextStyle ( fontWeight: FontWeight . w600 ) ,
2022-05-23 10:53:44 +02:00
) ,
) ,
) ,
2021-03-02 07:05:47 +01:00
extendBodyBehindAppBar: true ,
body: SafeArea (
child: Column ( children: < Widget > [
2022-05-23 10:53:44 +02:00
SizedBox ( height: isTall ? 40 : 20 ) ,
common . buildProgressBar ( 8 ) ,
SizedBox ( height: isTall ? 40 : 20 ) ,
2022-06-17 21:50:18 +02:00
common . buildText (
" Et voilà votre code secret ! \n \n Mémorisez-le ou notez-le, car il vous sera demandé **à chaque fois** que vous voudrez effectuer un paiement sur cet appareil. " ,
20 ,
true ) ,
2022-05-23 10:53:44 +02:00
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 ) ;
} ,
) ,
] ,
2021-03-02 07:05:47 +01:00
) ,
Expanded (
child: Align (
alignment: Alignment . bottomCenter ,
child: SizedBox (
2022-05-25 20:40:25 +02:00
width: 380 * ratio ,
height: 60 * ratio ,
2021-03-02 07:05:47 +01:00
child: ElevatedButton (
2022-05-23 10:53:44 +02:00
key: const Key ( ' changeSecretCode ' ) ,
2021-03-02 07:05:47 +01:00
style: ElevatedButton . styleFrom (
2022-05-23 10:53:44 +02:00
elevation: 4 ,
primary: const Color ( 0xffFFD58D ) ,
onPrimary: Colors . black , // foreground
2021-03-02 07:05:47 +01:00
) ,
onPressed: ( ) {
2022-05-23 10:53:44 +02:00
_generateWalletProvider . changePinCode ( reload: true ) ;
2021-03-02 07:05:47 +01:00
} ,
2022-05-25 20:40:25 +02:00
child: Text ( " Choisir un autre code secret " ,
2022-05-23 10:53:44 +02:00
style: TextStyle (
2022-05-25 20:40:25 +02:00
fontSize: 22 * ratio ,
fontWeight: FontWeight . w600 ) ) ) ,
2021-03-02 07:05:47 +01:00
) ) ) ,
2022-05-25 20:40:25 +02:00
SizedBox ( height: 22 * ratio ) ,
2022-05-23 10:53:44 +02:00
common . nextButton ( context , " J'ai noté mon code secret " ,
2022-06-07 01:10:40 +02:00
OnboardingStepTen ( scanDerivation: scanDerivation ) , false ) ,
2022-05-25 20:40:25 +02:00
SizedBox ( height: 35 * ratio ) ,
2021-03-02 07:05:47 +01:00
] ) ,
) ) ;
}
}