From fb242332f07f41bbcaba66593f0d60e9fdd84634 Mon Sep 17 00:00:00 2001
From: poka <poka@p2p.legal>
Date: Mon, 8 Mar 2021 06:21:04 +0100
Subject: [PATCH] Improve transitions between screens

---
 lib/screens/commonElements.dart               | 26 +++++++++++++++++++
 lib/screens/home.dart                         |  2 +-
 lib/screens/myWallets/walletsHome.dart        |  2 +-
 ...chainFound.dart => 0_noKeychainFound.dart} |  6 +++--
 .../onBoarding/{2_stepOne.dart => 1.dart}     |  4 +--
 .../{12_stepTwelve.dart => 10.dart}           |  4 +--
 .../{13_stepThirteen.dart => 11.dart}         |  6 ++---
 .../{14_stepFourteen.dart => 12.dart}         |  5 ++--
 ...pFiveteen.dart => 13_congratulations.dart} |  0
 .../onBoarding/{3_stepTwo.dart => 2.dart}     |  4 +--
 .../onBoarding/{4_stepFor.dart => 3.dart}     |  4 +--
 .../onBoarding/{5_stepFive.dart => 4.dart}    |  4 +--
 .../onBoarding/{7_stepSeven.dart => 5.dart}   |  4 +--
 .../onBoarding/{8_stepEight.dart => 6.dart}   |  9 ++++---
 .../onBoarding/{9_stepNine.dart => 7.dart}    | 22 +++++++++++++---
 .../onBoarding/{10_stepTen.dart => 8.dart}    |  6 ++---
 .../onBoarding/{11_stepEleven.dart => 9.dart} |  4 +--
 17 files changed, 78 insertions(+), 34 deletions(-)
 rename lib/screens/onBoarding/{1_noKeychainFound.dart => 0_noKeychainFound.dart} (95%)
 rename lib/screens/onBoarding/{2_stepOne.dart => 1.dart} (93%)
 rename lib/screens/onBoarding/{12_stepTwelve.dart => 10.dart} (93%)
 rename lib/screens/onBoarding/{13_stepThirteen.dart => 11.dart} (96%)
 rename lib/screens/onBoarding/{14_stepFourteen.dart => 12.dart} (96%)
 rename lib/screens/onBoarding/{15_stepFiveteen.dart => 13_congratulations.dart} (100%)
 rename lib/screens/onBoarding/{3_stepTwo.dart => 2.dart} (93%)
 rename lib/screens/onBoarding/{4_stepFor.dart => 3.dart} (93%)
 rename lib/screens/onBoarding/{5_stepFive.dart => 4.dart} (93%)
 rename lib/screens/onBoarding/{7_stepSeven.dart => 5.dart} (95%)
 rename lib/screens/onBoarding/{8_stepEight.dart => 6.dart} (92%)
 rename lib/screens/onBoarding/{9_stepNine.dart => 7.dart} (94%)
 rename lib/screens/onBoarding/{10_stepTen.dart => 8.dart} (98%)
 rename lib/screens/onBoarding/{11_stepEleven.dart => 9.dart} (94%)

diff --git a/lib/screens/commonElements.dart b/lib/screens/commonElements.dart
index cb3ecd40..da74024c 100644
--- a/lib/screens/commonElements.dart
+++ b/lib/screens/commonElements.dart
@@ -135,6 +135,32 @@ class SmoothTransition extends PageRouteBuilder {
         );
 }
 
+class FaderTransition extends PageRouteBuilder {
+  final Widget page;
+  final bool isFast;
+
+  FaderTransition({@required this.page, @required this.isFast})
+      : super(
+          pageBuilder: (
+            BuildContext context,
+            Animation<double> animation,
+            Animation<double> secondaryAnimation,
+          ) =>
+              page,
+          transitionsBuilder: (
+            BuildContext context,
+            Animation<double> animation,
+            Animation<double> secondaryAnimation,
+            Widget child,
+          ) =>
+              FadeTransition(
+            opacity:
+                Tween(begin: 0.0, end: isFast ? 3.0 : 1.0).animate(animation),
+            child: child,
+          ),
+        );
+}
+
 class SlideLeftRoute extends PageRouteBuilder {
   final Widget page;
   SlideLeftRoute({this.page})
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index 0fdf06a3..b16b8ac2 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -4,7 +4,7 @@ import 'package:gecko/models/history.dart';
 import 'package:gecko/models/home.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/models/myWallets.dart';
-import 'package:gecko/screens/onBoarding/1_noKeychainFound.dart';
+import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
 import 'dart:ui';
 import 'package:gecko/screens/settings.dart';
 import 'package:flutter/services.dart';
diff --git a/lib/screens/myWallets/walletsHome.dart b/lib/screens/myWallets/walletsHome.dart
index 98f88f4e..d7ddd848 100644
--- a/lib/screens/myWallets/walletsHome.dart
+++ b/lib/screens/myWallets/walletsHome.dart
@@ -3,7 +3,7 @@ import 'package:gecko/models/myWallets.dart';
 import 'package:gecko/models/walletOptions.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/screens/myWallets/unlockingWallet.dart';
-import 'package:gecko/screens/onBoarding/1_noKeychainFound.dart';
+import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
 import 'package:provider/provider.dart';
 
 // ignore: must_be_immutable
diff --git a/lib/screens/onBoarding/1_noKeychainFound.dart b/lib/screens/onBoarding/0_noKeychainFound.dart
similarity index 95%
rename from lib/screens/onBoarding/1_noKeychainFound.dart
rename to lib/screens/onBoarding/0_noKeychainFound.dart
index d916cae7..e4b547f2 100644
--- a/lib/screens/onBoarding/1_noKeychainFound.dart
+++ b/lib/screens/onBoarding/0_noKeychainFound.dart
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter_svg/flutter_svg.dart';
 import 'package:gecko/screens/commonElements.dart';
 import 'package:gecko/screens/myWallets/importWallet.dart';
-import 'package:gecko/screens/onBoarding/2_stepOne.dart';
+import 'package:gecko/screens/onBoarding/1.dart';
 // import 'package:gecko/models/home.dart';
 // import 'package:provider/provider.dart';
 
@@ -39,7 +39,9 @@ class NoKeyChainScreen extends StatelessWidget {
                               height: 90)),
                       onTap: () {
                         Navigator.push(
-                            context, SlideLeftRoute(page: OnboardingStepOne()));
+                            context,
+                            FaderTransition(
+                                page: OnboardingStepOne(), isFast: true));
                       }),
                 ),
               ),
diff --git a/lib/screens/onBoarding/2_stepOne.dart b/lib/screens/onBoarding/1.dart
similarity index 93%
rename from lib/screens/onBoarding/2_stepOne.dart
rename to lib/screens/onBoarding/1.dart
index 190e40fa..2c8bf961 100644
--- a/lib/screens/onBoarding/2_stepOne.dart
+++ b/lib/screens/onBoarding/1.dart
@@ -1,7 +1,7 @@
 import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/3_stepTwo.dart';
+import 'package:gecko/screens/onBoarding/2.dart';
 // import 'package:gecko/models/home.dart';
 // import 'package:provider/provider.dart';
 
@@ -42,7 +42,7 @@ class OnboardingStepOne extends StatelessWidget {
                           ),
                           onPressed: () {
                             Navigator.push(context,
-                                SmoothTransition(page: OnboardingStepTwo()));
+                                FaderTransition(page: OnboardingStepTwo(), isFast: true));
                           },
                           child: Text('Créer mon trousseau',
                               style: TextStyle(fontSize: 20))),
diff --git a/lib/screens/onBoarding/12_stepTwelve.dart b/lib/screens/onBoarding/10.dart
similarity index 93%
rename from lib/screens/onBoarding/12_stepTwelve.dart
rename to lib/screens/onBoarding/10.dart
index a841e4ff..4bf73713 100644
--- a/lib/screens/onBoarding/12_stepTwelve.dart
+++ b/lib/screens/onBoarding/10.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/13_stepThirteen.dart';
+import 'package:gecko/screens/onBoarding/11.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepTwelve extends StatelessWidget {
@@ -41,7 +41,7 @@ class OnboardingStepTwelve extends StatelessWidget {
                           onPressed: () {
                             Navigator.push(
                               context,
-                              SmoothTransition(page: OnboardingStepThirteen()),
+                              FaderTransition(page: OnboardingStepThirteen(), isFast: true),
                             );
                           },
                           child: Text("Générer le code secret",
diff --git a/lib/screens/onBoarding/13_stepThirteen.dart b/lib/screens/onBoarding/11.dart
similarity index 96%
rename from lib/screens/onBoarding/13_stepThirteen.dart
rename to lib/screens/onBoarding/11.dart
index 04c5eaeb..f552b075 100644
--- a/lib/screens/onBoarding/13_stepThirteen.dart
+++ b/lib/screens/onBoarding/11.dart
@@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/models/generateWallets.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/14_stepFourteen.dart';
+import 'package:gecko/screens/onBoarding/12.dart';
 import 'package:provider/provider.dart';
 
 // ignore: must_be_immutable
@@ -106,9 +106,9 @@ class OnboardingStepThirteen extends StatelessWidget {
                     _generateWalletProvider.askedWordColor = Colors.black;
                     Navigator.push(
                       context,
-                      SmoothTransition(
+                      FaderTransition(
                           page: OnboardingStepFourteen(
-                              generatedWallet: generatedWallet)),
+                              generatedWallet: generatedWallet), isFast: true),
                     );
                   },
                   child: Text("J'ai noté mon code secret",
diff --git a/lib/screens/onBoarding/14_stepFourteen.dart b/lib/screens/onBoarding/12.dart
similarity index 96%
rename from lib/screens/onBoarding/14_stepFourteen.dart
rename to lib/screens/onBoarding/12.dart
index 3f1b0867..01294e54 100644
--- a/lib/screens/onBoarding/14_stepFourteen.dart
+++ b/lib/screens/onBoarding/12.dart
@@ -8,7 +8,7 @@ import 'package:gecko/models/generateWallets.dart';
 import 'package:gecko/models/myWallets.dart';
 import 'package:gecko/models/walletOptions.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/15_stepFiveteen.dart';
+import 'package:gecko/screens/onBoarding/13_congratulations.dart';
 import 'package:pin_code_fields/pin_code_fields.dart';
 import 'package:provider/provider.dart';
 
@@ -123,7 +123,8 @@ class OnboardingStepFourteen extends StatelessWidget {
                 _myWalletProvider.rebuildWidget();
                 Navigator.push(
                   context,
-                  SmoothTransition(page: OnboardingStepFiveteen()),
+                  FaderTransition(
+                      page: OnboardingStepFiveteen(), isFast: false),
                 );
               } else {
                 errorController.add(ErrorAnimationType
diff --git a/lib/screens/onBoarding/15_stepFiveteen.dart b/lib/screens/onBoarding/13_congratulations.dart
similarity index 100%
rename from lib/screens/onBoarding/15_stepFiveteen.dart
rename to lib/screens/onBoarding/13_congratulations.dart
diff --git a/lib/screens/onBoarding/3_stepTwo.dart b/lib/screens/onBoarding/2.dart
similarity index 93%
rename from lib/screens/onBoarding/3_stepTwo.dart
rename to lib/screens/onBoarding/2.dart
index b523c07d..f2491f17 100644
--- a/lib/screens/onBoarding/3_stepTwo.dart
+++ b/lib/screens/onBoarding/2.dart
@@ -1,7 +1,7 @@
 import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/4_stepFor.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';
@@ -42,7 +42,7 @@ class OnboardingStepTwo extends StatelessWidget {
                         onPressed: () {
                           Navigator.push(
                             context,
-                            SmoothTransition(page: OnboardingStepFor()),
+                            FaderTransition(page: OnboardingStepFor(), isFast: true),
                           );
                         },
                         child: Text("D'accord", style: TextStyle(fontSize: 20)),
diff --git a/lib/screens/onBoarding/4_stepFor.dart b/lib/screens/onBoarding/3.dart
similarity index 93%
rename from lib/screens/onBoarding/4_stepFor.dart
rename to lib/screens/onBoarding/3.dart
index 8df36eee..bf11c93a 100644
--- a/lib/screens/onBoarding/4_stepFor.dart
+++ b/lib/screens/onBoarding/3.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/5_stepFive.dart';
+import 'package:gecko/screens/onBoarding/4.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepFor extends StatelessWidget {
@@ -47,7 +47,7 @@ class OnboardingStepFor extends StatelessWidget {
                           onPressed: () {
                             Navigator.push(
                               context,
-                              SmoothTransition(page: OnboardingStepFive()),
+                              FaderTransition(page: OnboardingStepFive(), isFast: true),
                             );
                           },
                           child: Text("J'ai compris",
diff --git a/lib/screens/onBoarding/5_stepFive.dart b/lib/screens/onBoarding/4.dart
similarity index 93%
rename from lib/screens/onBoarding/5_stepFive.dart
rename to lib/screens/onBoarding/4.dart
index 4a9f289c..87b3880c 100644
--- a/lib/screens/onBoarding/5_stepFive.dart
+++ b/lib/screens/onBoarding/4.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/7_stepSeven.dart';
+import 'package:gecko/screens/onBoarding/5.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepFive extends StatelessWidget {
@@ -42,7 +42,7 @@ class OnboardingStepFive extends StatelessWidget {
                           onPressed: () {
                             Navigator.push(
                               context,
-                              SmoothTransition(page: OnboardingStepSeven()),
+                              FaderTransition(page: OnboardingStepSeven(), isFast: true),
                             );
                           },
                           child: Text("J'ai compris",
diff --git a/lib/screens/onBoarding/7_stepSeven.dart b/lib/screens/onBoarding/5.dart
similarity index 95%
rename from lib/screens/onBoarding/7_stepSeven.dart
rename to lib/screens/onBoarding/5.dart
index b98dc82a..af61bb25 100644
--- a/lib/screens/onBoarding/7_stepSeven.dart
+++ b/lib/screens/onBoarding/5.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/8_stepEight.dart';
+import 'package:gecko/screens/onBoarding/6.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepSeven extends StatelessWidget {
@@ -59,7 +59,7 @@ class OnboardingStepSeven extends StatelessWidget {
                   onPressed: () {
                     Navigator.push(
                       context,
-                      SmoothTransition(page: OnboardingStepEight()),
+                      FaderTransition(page: OnboardingStepEight(), isFast: true),
                     );
                   },
                   child: Text("J'ai de quoi noter",
diff --git a/lib/screens/onBoarding/8_stepEight.dart b/lib/screens/onBoarding/6.dart
similarity index 92%
rename from lib/screens/onBoarding/8_stepEight.dart
rename to lib/screens/onBoarding/6.dart
index 685d934d..9a09fb84 100644
--- a/lib/screens/onBoarding/8_stepEight.dart
+++ b/lib/screens/onBoarding/6.dart
@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/9_stepNine.dart';
+import 'package:gecko/screens/onBoarding/7.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepEight extends StatelessWidget {
@@ -42,7 +42,8 @@ class OnboardingStepEight extends StatelessWidget {
                           onPressed: () {
                             Navigator.push(
                               context,
-                              SmoothTransition(page: OnboardingStepNine()),
+                              FaderTransition(
+                                  page: OnboardingStepNine(), isFast: false),
                             );
                           },
                           child: Text("Afficher ma phrase",
@@ -100,13 +101,13 @@ Widget arrayCell(dataWord) {
       child: Column(
         children: <Widget>[
           ImageFiltered(
-            imageFilter: ImageFilter.blur(sigmaX: 2.5, sigmaY: 2.5),
+            imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
             child: Text(dataWord.split(':')[0],
                 style: TextStyle(fontSize: 14, color: Colors.black)),
           ),
           SizedBox(height: 2),
           ImageFiltered(
-            imageFilter: ImageFilter.blur(sigmaX: 3, sigmaY: 3),
+            imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
             child: Text(dataWord.split(':')[1],
                 style: TextStyle(fontSize: 20, color: Colors.black)),
           )
diff --git a/lib/screens/onBoarding/9_stepNine.dart b/lib/screens/onBoarding/7.dart
similarity index 94%
rename from lib/screens/onBoarding/9_stepNine.dart
rename to lib/screens/onBoarding/7.dart
index baf95102..36a0abc2 100644
--- a/lib/screens/onBoarding/9_stepNine.dart
+++ b/lib/screens/onBoarding/7.dart
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/models/generateWallets.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/10_stepTen.dart';
+import 'package:gecko/screens/onBoarding/8.dart';
 import 'package:printing/printing.dart';
 import 'package:provider/provider.dart';
 
@@ -84,12 +84,13 @@ class OnboardingStepNine extends StatelessWidget {
 
                     Navigator.push(
                       context,
-                      SmoothTransition(
+                      FaderTransition(
                           page: OnboardingStepTen(
                               generatedMnemonic:
                                   _generateWalletProvider.generatedMnemonic,
                               generatedWallet:
-                                  _generateWalletProvider.actualWallet)),
+                                  _generateWalletProvider.actualWallet),
+                          isFast: true),
                     );
                   },
                   child: Text("J'ai noté ma phrase",
@@ -107,7 +108,20 @@ Widget sentanceArray(BuildContext context) {
 
   return FutureBuilder(
       future: _generateWalletProvider.generateWordList(),
-      initialData: '::::::::::::',
+      initialData: [
+        '1:...',
+        '2:...',
+        '3:...',
+        '4:...',
+        '5:...',
+        '6:...',
+        '7:...',
+        '8:...',
+        '9:...',
+        '10:...',
+        '11:...',
+        '12:...',
+      ],
       builder: (context, formatedArray) {
         return Container(
             padding: EdgeInsets.symmetric(horizontal: 12),
diff --git a/lib/screens/onBoarding/10_stepTen.dart b/lib/screens/onBoarding/8.dart
similarity index 98%
rename from lib/screens/onBoarding/10_stepTen.dart
rename to lib/screens/onBoarding/8.dart
index 9df37abd..0b16f08b 100644
--- a/lib/screens/onBoarding/10_stepTen.dart
+++ b/lib/screens/onBoarding/8.dart
@@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/models/generateWallets.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/11_stepEleven.dart';
+import 'package:gecko/screens/onBoarding/9.dart';
 import 'package:provider/provider.dart';
 
 // ignore: must_be_immutable
@@ -163,8 +163,8 @@ class OnboardingStepTen extends StatelessWidget {
                                   onPressed: () {
                                     Navigator.push(
                                       context,
-                                      SmoothTransition(
-                                          page: OnboardingStepEleven()),
+                                      FaderTransition(
+                                          page: OnboardingStepEleven(), isFast: true),
                                     );
                                   },
                                   child: Text("Continuer",
diff --git a/lib/screens/onBoarding/11_stepEleven.dart b/lib/screens/onBoarding/9.dart
similarity index 94%
rename from lib/screens/onBoarding/11_stepEleven.dart
rename to lib/screens/onBoarding/9.dart
index c1868061..4ce10283 100644
--- a/lib/screens/onBoarding/11_stepEleven.dart
+++ b/lib/screens/onBoarding/9.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/material.dart';
 import 'package:gecko/globals.dart';
 import 'package:gecko/screens/commonElements.dart';
-import 'package:gecko/screens/onBoarding/12_stepTwelve.dart';
+import 'package:gecko/screens/onBoarding/10.dart';
 
 // ignore: must_be_immutable
 class OnboardingStepEleven extends StatelessWidget {
@@ -48,7 +48,7 @@ class OnboardingStepEleven extends StatelessWidget {
                           onPressed: () {
                             Navigator.push(
                               context,
-                              SmoothTransition(page: OnboardingStepTwelve()),
+                              FaderTransition(page: OnboardingStepTwelve(), isFast: true),
                             );
                           },
                           child: Text("J'ai compris",
-- 
GitLab