factorize isMd text

This commit is contained in:
poka 2022-06-17 21:50:18 +02:00
parent 6f7dd4e413
commit a4d72d036f
6 changed files with 37 additions and 41 deletions

View File

@ -30,23 +30,8 @@ class CommonElements {
child: Image.asset('assets/onBoarding/$assetName', width: imageWidth)); child: Image.asset('assets/onBoarding/$assetName', width: imageWidth));
} }
Widget buildText(String text, [double size = 20]) { Widget buildText(String text, [double size = 20, bool isMd = false]) {
return Container( final mdStyle = MarkdownStyleSheet(
padding: const EdgeInsets.all(12),
width: 440,
decoration: BoxDecoration(
color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
child: Text(text,
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: isTall ? size : size * 0.9,
color: Colors.black,
letterSpacing: 0.3)),
);
}
Widget buildTextMd(String text, [double size = 20]) {
final style = MarkdownStyleSheet(
p: TextStyle( p: TextStyle(
fontSize: isTall ? size : size * 0.9, fontSize: isTall ? size : size * 0.9,
color: Colors.black, color: Colors.black,
@ -55,11 +40,19 @@ class CommonElements {
); );
return Container( return Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
width: 440, width: 440,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, border: Border.all(color: Colors.grey[900]!)), color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
child: MarkdownBody(data: text, styleSheet: style)); child: isMd
? MarkdownBody(data: text, styleSheet: mdStyle)
: Text(text,
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: isTall ? size : size * 0.9,
color: Colors.black,
letterSpacing: 0.3)),
);
} }
Widget nextButton( Widget nextButton(
@ -104,7 +97,7 @@ class CommonElements {
String buttonText, String buttonText,
nextScreen, nextScreen,
double pagePosition, { double pagePosition, {
String? textMd, bool isMd = false,
bool isFast = false, bool isFast = false,
double boxHeight = 440, double boxHeight = 440,
double imageWidth = 350, double imageWidth = 350,
@ -115,10 +108,7 @@ class CommonElements {
buildProgressBar(pagePosition), buildProgressBar(pagePosition),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
if (textMd == null) buildText(text, textSize, isMd),
buildText(text, textSize)
else
buildTextMd(textMd, textSize),
buildImage(assetName, boxHeight, imageWidth), buildImage(assetName, boxHeight, imageWidth),
Expanded( Expanded(

View File

@ -29,12 +29,12 @@ class OnboardingStepOne extends StatelessWidget {
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: common.infoIntro(
context, context,
'', 'geckoGenerateYourWalletFromMnemonic'.tr(),
'fabrication-de-portefeuille.png', 'fabrication-de-portefeuille.png',
'>', '>',
const OnboardingStepTwo(), const OnboardingStepTwo(),
0, 0,
textMd: 'geckoGenerateYourWalletFromMnemonic'.tr(), isMd: true,
), ),
), ),
); );

View File

@ -28,10 +28,14 @@ class OnboardingStepFor extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro(context, '', 'gecko-oublie-aussi.png', '>', child: common.infoIntro(
const OnboardingStepFive(), 3, context,
textMd: 'Il est temps de vous munir d**un papier et dun crayon** afin de pouvoir noter votre phrase de restauration.',
'Il est temps de vous munir d**un papier et dun crayon** afin de pouvoir noter votre phrase de restauration.'), 'gecko-oublie-aussi.png',
'>',
const OnboardingStepFive(),
3,
isMd: true),
), ),
); );
} }

View File

@ -56,9 +56,10 @@ class OnboardingStepSix extends StatelessWidget {
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(5), common.buildProgressBar(5),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildTextMd( common.buildText(
"Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le **${_generateWalletProvider.nbrWord + 1}ème mot** de votre phrase de restauration :", "Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le **${_generateWalletProvider.nbrWord + 1}ème mot** de votre phrase de restauration :",
), 20,
true),
SizedBox(height: isTall ? 70 : 20), SizedBox(height: isTall ? 70 : 20),
Text('${_generateWalletProvider.nbrWord + 1}', Text('${_generateWalletProvider.nbrWord + 1}',
key: const Key('askedWord'), key: const Key('askedWord'),

View File

@ -30,13 +30,12 @@ class OnboardingStepEight extends StatelessWidget {
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: common.infoIntro(
context, context,
'', 'Ce code secret protège vos portefeuilles dans un coffre-fort **dont vous seul possédez le code**, de sorte que vos portefeuilles seront inutilisables par dautres.',
'coffre-fort-protege-les-portefeuilles.png', 'coffre-fort-protege-les-portefeuilles.png',
'>', '>',
OnboardingStepNine(scanDerivation: scanDerivation), OnboardingStepNine(scanDerivation: scanDerivation),
7, 7,
textMd: isMd: true),
'Ce code secret protège vos portefeuilles dans un coffre-fort **dont vous seul possédez le code**, de sorte que vos portefeuilles seront inutilisables par dautres.'),
), ),
); );
} }

View File

@ -44,8 +44,10 @@ class OnboardingStepNine extends StatelessWidget {
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(8), common.buildProgressBar(8),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildTextMd( common.buildText(
"Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé **à chaque fois** que vous voudrez effectuer un paiement sur cet appareil."), "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé **à chaque fois** que vous voudrez effectuer un paiement sur cet appareil.",
20,
true),
const SizedBox(height: 100), const SizedBox(height: 100),
Stack( Stack(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,