diff --git a/assets/translations/en.json b/assets/translations/en.json index 2b3929c..bca3f5c 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -174,5 +174,6 @@ "noContacts": "You don't have any contact", "addContact": "Add\nto contacts", "removeContact": "Remove\nthis contact", - "derivationsScanProgress": "Scan address {}/{}" + "derivationsScanProgress": "Scan address {}/{}", + "youAreOffline": "You are offline..." } \ No newline at end of file diff --git a/assets/translations/es.json b/assets/translations/es.json index 56533d0..7d985e9 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -174,5 +174,6 @@ "noContacts": "You don't have any contact", "addContact": "Add\nto contacts", "removeContact": "Remove\nthis contact", - "derivationsScanProgress": "Scan address {}/{}" + "derivationsScanProgress": "Scan address {}/{}", + "youAreOffline": "You are offline..." } \ No newline at end of file diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 188027a..9f03953 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -175,5 +175,6 @@ "noContacts": "Vous n'avez aucun contact", "addContact": "Ajouter\naux contacts", "removeContact": "Supprimer\nce contact", - "derivationsScanProgress": "Scan de l'adresse {}/{}" + "derivationsScanProgress": "Scan de l'adresse {}/{}", + "youAreOffline": "Vous êtes hors ligne..." } \ No newline at end of file diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index 8e5589d..d814bb7 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -69,7 +69,8 @@ class SubstrateSdk with ChangeNotifier { Future getStorageConst(String call) async { return (await sdk.webView! - .evalJavascript('api.consts.$call', wrapPromise: false))[0]; + .evalJavascript('api.consts.$call', wrapPromise: false) ?? + [null])[0]; } TxSenderData _setSender() { @@ -307,6 +308,8 @@ class SubstrateSdk with ChangeNotifier { Future connectNode(BuildContext ctx) async { HomeProvider homeProvider = Provider.of(ctx, listen: false); + MyWalletsProvider myWalletProvider = + Provider.of(ctx, listen: false); homeProvider.changeMessage("connectionPending".tr(), 0); @@ -347,7 +350,7 @@ class SubstrateSdk with ChangeNotifier { notifyListeners(); }); - // currencyName = await getCurencyName(); + await initCurrencyParameters(); notifyListeners(); homeProvider.changeMessage( "wellConnectedToNode" @@ -359,7 +362,7 @@ class SubstrateSdk with ChangeNotifier { debugConnection = res.toString(); notifyListeners(); homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0); - // snackNode(ctx, false); + if (!myWalletProvider.checkIfWalletExist()) snackNode(homeContext, false); } log.d(sdk.api.connectedNode?.endpoint); @@ -795,7 +798,7 @@ void snackNode(BuildContext context, bool isConnected) { String message; if (!isConnected) { message = - "${"noDuniterNodeAvailableTryLater".tr()}:\n${configBox.get('endpoint').first}"; + "noDuniterNodeAvailableTryLater".tr(); } else { SubstrateSdk sub = Provider.of(context, listen: false); diff --git a/lib/screens/common_elements.dart b/lib/screens/common_elements.dart index b104e67..59149f7 100644 --- a/lib/screens/common_elements.dart +++ b/lib/screens/common_elements.dart @@ -159,8 +159,7 @@ class CommonElements { } Widget offlineInfo(BuildContext context) { - // SubstrateSdk _sub = Provider.of(context, listen: false); - final double screenWidth = MediaQuery.of(context).size.width; + final double screenWidth = MediaQuery.of(homeContext).size.width; return Consumer(builder: (context, sub, _) { return Visibility( visible: !sub.nodeConnected, @@ -174,7 +173,7 @@ class CommonElements { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "Vous êtes hors ligne...", + 'youAreOffline'.tr(), style: TextStyle(color: Colors.grey[50]), textAlign: TextAlign.center, ), diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 464504a..297121b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -167,7 +167,6 @@ class HomeScreen extends StatelessWidget { sub.reload(); } else { await sub.connectNode(ctx); - await sub.initCurrencyParameters(); } }); } diff --git a/lib/screens/myWallets/restore_chest.dart b/lib/screens/myWallets/restore_chest.dart index ddd414b..06540a5 100644 --- a/lib/screens/myWallets/restore_chest.dart +++ b/lib/screens/myWallets/restore_chest.dart @@ -49,110 +49,114 @@ class RestoreChest extends StatelessWidget { child: Text('restoreAChest'.tr()), )), body: SafeArea( - child: Column(children: [ - SizedBox(height: isTall ? 30 : 15), - bubbleSpeak('toRestoreEnterMnemonic'.tr()), - SizedBox(height: isTall ? 30 : 15), + child: Stack(children: [ Column(children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - arrayCell(context, genW.cellController0), - arrayCell(context, genW.cellController1), - arrayCell(context, genW.cellController2), - arrayCell(context, genW.cellController3), - ]), - const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - arrayCell(context, genW.cellController4), - arrayCell(context, genW.cellController5), - arrayCell(context, genW.cellController6), - arrayCell(context, genW.cellController7), - ]), - const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - arrayCell(context, genW.cellController8), - arrayCell(context, genW.cellController9), - arrayCell(context, genW.cellController10), - arrayCell(context, genW.cellController11), - ]), - ]), - // const Spacer(), - if (genW.isSentenceComplete(context)) - Expanded( - child: Align( - alignment: Alignment.center, - child: SizedBox( - width: 410, - height: 70, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - elevation: 4, - primary: orangeC, // background - onPrimary: Colors.white, // foreground - ), - onPressed: () async { - if (await sub.isMnemonicValid(genW.generatedMnemonic!)) { - genW.resetImportView(); - await Navigator.push( - context, - FaderTransition( - page: skipIntro - ? const OnboardingStepNine( - scanDerivation: true) - : const OnboardingStepSeven( - scanDerivation: true), - isFast: true), - ); - } else { - await badMnemonicPopup(context); - } - }, - child: Text( - 'restoreThisChest'.tr(), - style: const TextStyle( - fontSize: 24, fontWeight: FontWeight.w600), - ), - ), - ), - // SizedBox(height: isTall ? 80 : 80), - )) - else - Column(children: [ - const SizedBox(height: 20), - SizedBox( - width: 190, - height: 60, - child: ElevatedButton( + SizedBox(height: isTall ? 30 : 15), + bubbleSpeak('toRestoreEnterMnemonic'.tr()), + SizedBox(height: isTall ? 30 : 15), + Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + arrayCell(context, genW.cellController0), + arrayCell(context, genW.cellController1), + arrayCell(context, genW.cellController2), + arrayCell(context, genW.cellController3), + ]), + const SizedBox(height: 15), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + arrayCell(context, genW.cellController4), + arrayCell(context, genW.cellController5), + arrayCell(context, genW.cellController6), + arrayCell(context, genW.cellController7), + ]), + const SizedBox(height: 15), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + arrayCell(context, genW.cellController8), + arrayCell(context, genW.cellController9), + arrayCell(context, genW.cellController10), + arrayCell(context, genW.cellController11), + ]), + ]), + // const Spacer(), + if (genW.isSentenceComplete(context)) + Expanded( + child: Align( + alignment: Alignment.center, + child: SizedBox( + width: 410, + height: 70, + child: ElevatedButton( style: ElevatedButton.styleFrom( elevation: 4, - primary: yellowC, // background - onPrimary: Colors.black, // foreground + primary: orangeC, // background + onPrimary: Colors.white, // foreground ), - onPressed: () { - genW.pasteMnemonic(context); + onPressed: () async { + if (await sub + .isMnemonicValid(genW.generatedMnemonic!)) { + genW.resetImportView(); + await Navigator.push( + context, + FaderTransition( + page: skipIntro + ? const OnboardingStepNine( + scanDerivation: true) + : const OnboardingStepSeven( + scanDerivation: true), + isFast: true), + ); + } else { + await badMnemonicPopup(context); + } }, - child: Row( - children: [ - const Icon( - Icons.content_paste_go, - size: 25, - ), - const SizedBox(width: 10), - Text( - 'pasteFromClipboard'.tr(), - textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 17, fontWeight: FontWeight.w400), - ), - ], - )), - ) - ]) + child: Text( + 'restoreThisChest'.tr(), + style: const TextStyle( + fontSize: 24, fontWeight: FontWeight.w600), + ), + ), + ), + // SizedBox(height: isTall ? 80 : 80), + )) + else + Column(children: [ + const SizedBox(height: 20), + SizedBox( + width: 190, + height: 60, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + elevation: 4, + primary: yellowC, // background + onPrimary: Colors.black, // foreground + ), + onPressed: () { + genW.pasteMnemonic(context); + }, + child: Row( + children: [ + const Icon( + Icons.content_paste_go, + size: 25, + ), + const SizedBox(width: 10), + Text( + 'pasteFromClipboard'.tr(), + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 17, fontWeight: FontWeight.w400), + ), + ], + )), + ) + ]) + ]), + CommonElements().offlineInfo(context), ]), ), ), diff --git a/lib/screens/onBoarding/1.dart b/lib/screens/onBoarding/1.dart index 2550f47..a13257d 100644 --- a/lib/screens/onBoarding/1.dart +++ b/lib/screens/onBoarding/1.dart @@ -27,15 +27,18 @@ class OnboardingStepOne extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro( - context, - 'geckoGenerateYourWalletFromMnemonic'.tr(), - 'fabrication-de-portefeuille.png', - '>', - const OnboardingStepTwo(), - 0, - isMd: true, - ), + child: Stack(children: [ + common.infoIntro( + context, + 'geckoGenerateYourWalletFromMnemonic'.tr(), + 'fabrication-de-portefeuille.png', + '>', + const OnboardingStepTwo(), + 0, + isMd: true, + ), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/10.dart b/lib/screens/onBoarding/10.dart index ad58bac..2680d33 100644 --- a/lib/screens/onBoarding/10.dart +++ b/lib/screens/onBoarding/10.dart @@ -49,79 +49,82 @@ class OnboardingStepTen extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: Column(children: [ - SizedBox(height: isTall ? 40 : 20), - common.buildProgressBar(9), - SizedBox(height: isTall ? 40 : 20), - common.buildText("geckoWillCheckPassword".tr()), - SizedBox(height: isTall ? 80 : 20), - Visibility( - visible: generateWalletProvider.scanedValidWalletNumber != -1, - child: Padding( - padding: const EdgeInsets.only(bottom: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("derivationsScanProgress".tr(args: [ - '${generateWalletProvider.scanedWalletNumber}', - '${generateWalletProvider.numberScan + 1}' - ])), - const SizedBox(width: 10), - SizedBox( - height: 22, - width: 22, - child: CircularProgressIndicator( - color: orangeC, - strokeWidth: 3, + child: Stack(children: [ + Column(children: [ + SizedBox(height: isTall ? 40 : 20), + common.buildProgressBar(9), + SizedBox(height: isTall ? 40 : 20), + common.buildText("geckoWillCheckPassword".tr()), + SizedBox(height: isTall ? 80 : 20), + Visibility( + visible: generateWalletProvider.scanedValidWalletNumber != -1, + child: Padding( + padding: const EdgeInsets.only(bottom: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("derivationsScanProgress".tr(args: [ + '${generateWalletProvider.scanedWalletNumber}', + '${generateWalletProvider.numberScan + 1}' + ])), + const SizedBox(width: 10), + SizedBox( + height: 22, + width: 22, + child: CircularProgressIndicator( + color: orangeC, + strokeWidth: 3, + ), ), - ), - ], + ], + ), ), ), - ), - Consumer(builder: (context, sub, _) { - return sub.nodeConnected - ? pinForm(context, walletOptions, pinLenght, 1, 2) - : Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Text( - 'Vous devez vous connecter à internet\npour valider votre coffre', - style: TextStyle( - fontSize: 20, - color: Colors.redAccent, - fontWeight: FontWeight.w500, + Consumer(builder: (context, sub, _) { + return sub.nodeConnected + ? pinForm(context, walletOptions, pinLenght, 1, 2) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Text( + 'Vous devez vous connecter à internet\npour valider votre coffre', + style: TextStyle( + fontSize: 20, + color: Colors.redAccent, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, + ]); + }), + Consumer(builder: (context, sub, _) { + return sub.nodeConnected + ? InkWell( + onTap: () { + walletOptions.changePinCacheChoice(); + }, + child: Row(children: [ + const SizedBox(height: 30), + const Spacer(), + Icon( + configBox.get('isCacheChecked') ?? false + ? Icons.check_box + : Icons.check_box_outline_blank, + color: orangeC, ), - ]); - }), - Consumer(builder: (context, sub, _) { - return sub.nodeConnected - ? InkWell( - onTap: () { - walletOptions.changePinCacheChoice(); - }, - child: Row(children: [ - const SizedBox(height: 30), - const Spacer(), - Icon( - configBox.get('isCacheChecked') ?? false - ? Icons.check_box - : Icons.check_box_outline_blank, - color: orangeC, - ), - const SizedBox(width: 8), - Text( - 'rememberPassword'.tr(), - style: - TextStyle(fontSize: 16, color: Colors.grey[700]), - ), - const Spacer() - ])) - : const Text(''); - }), - const SizedBox(height: 10), + const SizedBox(width: 8), + Text( + 'rememberPassword'.tr(), + style: TextStyle( + fontSize: 16, color: Colors.grey[700]), + ), + const Spacer() + ])) + : const Text(''); + }), + const SizedBox(height: 10), + ]), + CommonElements().offlineInfo(context), ]), )); } diff --git a/lib/screens/onBoarding/2.dart b/lib/screens/onBoarding/2.dart index ee16d16..82e21c3 100644 --- a/lib/screens/onBoarding/2.dart +++ b/lib/screens/onBoarding/2.dart @@ -29,13 +29,16 @@ class OnboardingStepTwo extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro( - context, - 'keepThisMnemonicSecure'.tr(), - 'fabrication-de-portefeuille-impossible-sans-phrase.png', - '>', - const OnboardingStepThree(), - 1), + child: Stack(children: [ + common.infoIntro( + context, + 'keepThisMnemonicSecure'.tr(), + 'fabrication-de-portefeuille-impossible-sans-phrase.png', + '>', + const OnboardingStepThree(), + 1), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/3.dart b/lib/screens/onBoarding/3.dart index 8a261d9..0099402 100644 --- a/lib/screens/onBoarding/3.dart +++ b/lib/screens/onBoarding/3.dart @@ -29,8 +29,11 @@ class OnboardingStepThree extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro(context, 'warningForgotPassword'.tr(), - 'forgot_password.png'.tr(), '>', const OnboardingStepFor(), 2), + child: Stack(children: [ + common.infoIntro(context, 'warningForgotPassword'.tr(), + 'forgot_password.png'.tr(), '>', const OnboardingStepFor(), 2), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/4.dart b/lib/screens/onBoarding/4.dart index 946f3db..d2ce061 100644 --- a/lib/screens/onBoarding/4.dart +++ b/lib/screens/onBoarding/4.dart @@ -29,14 +29,17 @@ class OnboardingStepFor extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro( - context, - 'itsTimeToUseAPenAndPaper'.tr(), - 'gecko_also_can_forget.png'.tr(), - '>', - const OnboardingStepFive(), - 3, - isMd: true), + child: Stack(children: [ + common.infoIntro( + context, + 'itsTimeToUseAPenAndPaper'.tr(), + 'gecko_also_can_forget.png'.tr(), + '>', + const OnboardingStepFive(), + 3, + isMd: true), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/5.dart b/lib/screens/onBoarding/5.dart index a2234f4..6b9426f 100644 --- a/lib/screens/onBoarding/5.dart +++ b/lib/screens/onBoarding/5.dart @@ -48,57 +48,62 @@ class _ChooseChestState extends State { ), extendBodyBehindAppBar: true, body: SafeArea( - child: Column(children: [ - SizedBox(height: isTall ? 40 : 20), - common.buildProgressBar(4), - SizedBox(height: isTall ? 40 : 20), - common.buildText('geckoGeneratedYourMnemonicKeepItSecret'.tr()), - SizedBox(height: 35 * ratio), - sentanceArray(context), - SizedBox(height: 17 * ratio), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return PrintWallet(generateWalletProvider.generatedMnemonic); - }), - ); - }, - child: Image.asset( - 'assets/printer.png', - height: 42 * ratio, - ), - ), - const SizedBox(height: 40), - Expanded( - child: Align( - alignment: Alignment.bottomCenter, - child: SizedBox( - width: 380 * ratio, - height: 60 * ratio, - child: ElevatedButton( - key: const Key('generateMnemonic'), - style: ElevatedButton.styleFrom( - elevation: 4, - primary: const Color(0xffFFD58D), - onPrimary: Colors.black, // foreground - ), - onPressed: () { - // _generateWalletProvider.reloadBuild(); - setState(() {}); - }, - child: Text("chooseAnotherMnemonic".tr(), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22 * ratio, - fontWeight: FontWeight.w600))), + child: Stack(children: [ + Column(children: [ + SizedBox(height: isTall ? 40 : 20), + common.buildProgressBar(4), + SizedBox(height: isTall ? 40 : 20), + common.buildText('geckoGeneratedYourMnemonicKeepItSecret'.tr()), + SizedBox(height: 35 * ratio), + sentanceArray(context), + SizedBox(height: 17 * ratio), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PrintWallet( + generateWalletProvider.generatedMnemonic); + }), + ); + }, + child: Image.asset( + 'assets/printer.png', + height: 42 * ratio, ), ), - ), - SizedBox(height: 22 * ratio), - nextButton(context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), - SizedBox(height: 35 * ratio), + const SizedBox(height: 40), + Expanded( + child: Align( + alignment: Alignment.bottomCenter, + child: SizedBox( + width: 380 * ratio, + height: 60 * ratio, + child: ElevatedButton( + key: const Key('generateMnemonic'), + style: ElevatedButton.styleFrom( + elevation: 4, + primary: const Color(0xffFFD58D), + onPrimary: Colors.black, // foreground + ), + onPressed: () { + // _generateWalletProvider.reloadBuild(); + setState(() {}); + }, + child: Text("chooseAnotherMnemonic".tr(), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 22 * ratio, + fontWeight: FontWeight.w600))), + ), + ), + ), + SizedBox(height: 22 * ratio), + nextButton( + context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), + SizedBox(height: 35 * ratio), + ]), + CommonElements().offlineInfo(context), ]), ), ); diff --git a/lib/screens/onBoarding/6.dart b/lib/screens/onBoarding/6.dart index 69922c3..5a58006 100644 --- a/lib/screens/onBoarding/6.dart +++ b/lib/screens/onBoarding/6.dart @@ -51,88 +51,92 @@ class OnboardingStepSix extends StatelessWidget { ), ), 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( - "didYouNoteMnemonicToBeSureTypeWord".tr( - args: [(generateWalletProvider.nbrWord + 1).toString()]), - 20, - true), - 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 - ? "itsTheGoodWord".tr() - : "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}", - 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: nextButton( - context, - 'continue'.tr(), - skipIntro - ? const OnboardingStepNine() - : const OnboardingStepSeven(), - false), + child: Stack(children: [ + Align( + alignment: Alignment.topCenter, + child: Column(children: [ + SizedBox(height: isTall ? 40 : 20), + common.buildProgressBar(5), + SizedBox(height: isTall ? 40 : 20), + common.buildText( + "didYouNoteMnemonicToBeSureTypeWord".tr(args: [ + (generateWalletProvider.nbrWord + 1).toString() + ]), + 20, + true), + 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 + ? "itsTheGoodWord".tr() + : "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}", + 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: nextButton( + context, + 'continue'.tr(), + skipIntro + ? const OnboardingStepNine() + : const OnboardingStepSeven(), + false), + ), ), ), - ), - // Visibility( - // visible: !_generateWalletProvider.isAskedWordValid, - // child: const Expanded( - // child: Align( - // alignment: Alignment.bottomCenter, - // child: Text(''), - // ), - // ), - // ), - SizedBox(height: 35 * ratio), - ]), - ), + // Visibility( + // visible: !_generateWalletProvider.isAskedWordValid, + // child: const Expanded( + // child: Align( + // alignment: Alignment.bottomCenter, + // child: Text(''), + // ), + // ), + // ), + SizedBox(height: 35 * ratio), + ]), + ), + CommonElements().offlineInfo(context), + ]), ), ), ); diff --git a/lib/screens/onBoarding/7.dart b/lib/screens/onBoarding/7.dart index b266009..4313930 100644 --- a/lib/screens/onBoarding/7.dart +++ b/lib/screens/onBoarding/7.dart @@ -29,14 +29,17 @@ class OnboardingStepSeven extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro( - context, - 'geckoWillGenerateAPassword'.tr(), - 'coffre-fort-code-secret-dans-telephone.png', - '>', - OnboardingStepEight(scanDerivation: scanDerivation), - 6, - boxHeight: 400), + child: Stack(children: [ + common.infoIntro( + context, + 'geckoWillGenerateAPassword'.tr(), + 'coffre-fort-code-secret-dans-telephone.png', + '>', + OnboardingStepEight(scanDerivation: scanDerivation), + 6, + boxHeight: 400), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/8.dart b/lib/screens/onBoarding/8.dart index 2172e2d..905535a 100644 --- a/lib/screens/onBoarding/8.dart +++ b/lib/screens/onBoarding/8.dart @@ -29,14 +29,17 @@ class OnboardingStepEight extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: common.infoIntro( - context, - 'thisPasswordProtectsYourWalletsInASecureChest'.tr(), - 'coffre-fort-protege-les-portefeuilles.png', - '>', - OnboardingStepNine(scanDerivation: scanDerivation), - 7, - isMd: true), + child: Stack(children: [ + common.infoIntro( + context, + 'thisPasswordProtectsYourWalletsInASecureChest'.tr(), + 'coffre-fort-protege-les-portefeuilles.png', + '>', + OnboardingStepNine(scanDerivation: scanDerivation), + 7, + isMd: true), + CommonElements().offlineInfo(context), + ]), ), ); } diff --git a/lib/screens/onBoarding/9.dart b/lib/screens/onBoarding/9.dart index 0cf8ecf..ed29fce 100644 --- a/lib/screens/onBoarding/9.dart +++ b/lib/screens/onBoarding/9.dart @@ -41,61 +41,65 @@ class OnboardingStepNine extends StatelessWidget { ), extendBodyBehindAppBar: true, body: SafeArea( - child: Column(children: [ - SizedBox(height: isTall ? 40 : 20), - common.buildProgressBar(8), - SizedBox(height: isTall ? 40 : 20), - common.buildText("hereIsThePasswordKeepIt".tr(), 20, true), - const SizedBox(height: 100), - Stack( - alignment: Alignment.centerRight, - children: [ - 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: 380 * ratio, - height: 60 * ratio, - child: ElevatedButton( - key: const Key('changeSecretCode'), - style: ElevatedButton.styleFrom( - elevation: 4, - primary: const Color(0xffFFD58D), - onPrimary: Colors.black, // foreground - ), - onPressed: () { - generateWalletProvider.changePinCode(reload: true); - }, - child: Text("chooseAnotherPassword".tr(), - style: TextStyle( - fontSize: 22 * ratio, - fontWeight: FontWeight.w600))), - ))), - SizedBox(height: 22 * ratio), - common.nextButton(context, "iNotedMyPassword".tr(), - OnboardingStepTen(scanDerivation: scanDerivation), false), - SizedBox(height: 35 * ratio), + child: Stack(children: [ + Column(children: [ + SizedBox(height: isTall ? 40 : 20), + common.buildProgressBar(8), + SizedBox(height: isTall ? 40 : 20), + common.buildText("hereIsThePasswordKeepIt".tr(), 20, true), + const SizedBox(height: 100), + Stack( + alignment: Alignment.centerRight, + children: [ + 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: 380 * ratio, + height: 60 * ratio, + child: ElevatedButton( + key: const Key('changeSecretCode'), + style: ElevatedButton.styleFrom( + elevation: 4, + primary: const Color(0xffFFD58D), + onPrimary: Colors.black, // foreground + ), + onPressed: () { + generateWalletProvider.changePinCode( + reload: true); + }, + child: Text("chooseAnotherPassword".tr(), + style: TextStyle( + fontSize: 22 * ratio, + fontWeight: FontWeight.w600))), + ))), + SizedBox(height: 22 * ratio), + common.nextButton(context, "iNotedMyPassword".tr(), + OnboardingStepTen(scanDerivation: scanDerivation), false), + SizedBox(height: 35 * ratio), + ]), + CommonElements().offlineInfo(context), ]), )); } diff --git a/pubspec.yaml b/pubspec.yaml index f55e8cf..aad5a24 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: Pay with G1. # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.9+22 +version: 0.0.9+23 environment: sdk: '>=2.12.0 <3.0.0'