Add max width constrain to Welcome page

This commit is contained in:
OmarHatem 2023-02-11 00:41:48 +02:00
parent 770e3b6f52
commit dd13172cfe

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -38,36 +39,30 @@ class WelcomePage extends BasePage {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Theme backgroundColor: Theme.of(context).backgroundColor,
.of(context)
.backgroundColor,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
body: body(context)); body: body(context));
} }
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final welcomeImage = currentTheme.type == ThemeType.dark final welcomeImage = currentTheme.type == ThemeType.dark ? welcomeImageDark : welcomeImageLight;
? welcomeImageDark : welcomeImageLight;
final newWalletImage = Image.asset('assets/images/new_wallet.png', final newWalletImage = Image.asset('assets/images/new_wallet.png',
height: 12, height: 12,
width: 12, width: 12,
color: Theme color: Theme.of(context).accentTextTheme!.headline5!.decorationColor!);
.of(context)
.accentTextTheme!
.headline5!
.decorationColor!);
final restoreWalletImage = Image.asset('assets/images/restore_wallet.png', final restoreWalletImage = Image.asset('assets/images/restore_wallet.png',
height: 12, height: 12, width: 12, color: Theme.of(context).primaryTextTheme!.headline6!.color!);
width: 12,
color: Theme.of(context)
.primaryTextTheme!
.headline6!
.color!);
return WillPopScope(onWillPop: () async => false, child: Container( return WillPopScope(
onWillPop: () async => false,
child: Container(
padding: EdgeInsets.only(top: 64, bottom: 24, left: 24, right: 24), padding: EdgeInsets.only(top: 64, bottom: 24, left: 24, right: 24),
child: Center(
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -75,9 +70,7 @@ class WelcomePage extends BasePage {
flex: 2, flex: 2,
child: AspectRatio( child: AspectRatio(
aspectRatio: aspectRatioImage, aspectRatio: aspectRatioImage,
child: FittedBox(child: welcomeImage, fit: BoxFit.fill) child: FittedBox(child: welcomeImage, fit: BoxFit.fill))),
)
),
Flexible( Flexible(
flex: 3, flex: 3,
child: Column( child: Column(
@ -88,17 +81,11 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: Text( child: Text(
S S.of(context).welcome,
.of(context)
.welcome,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme color: Theme.of(context).accentTextTheme!.headline2!.color!,
.of(context)
.accentTextTheme!
.headline2!
.color!,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -110,10 +97,7 @@ class WelcomePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 36, fontSize: 36,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context) color: Theme.of(context).primaryTextTheme!.headline6!.color!,
.primaryTextTheme!
.headline6!
.color!,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -125,11 +109,7 @@ class WelcomePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme color: Theme.of(context).accentTextTheme!.headline2!.color!,
.of(context)
.accentTextTheme!
.headline2!
.color!,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -139,16 +119,11 @@ class WelcomePage extends BasePage {
Column( Column(
children: <Widget>[ children: <Widget>[
Text( Text(
S S.of(context).please_make_selection,
.of(context)
.please_make_selection,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context) color: Theme.of(context).accentTextTheme!.headline2!.color!,
.accentTextTheme!
.headline2!
.color!,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -156,16 +131,14 @@ class WelcomePage extends BasePage {
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton( child: PrimaryImageButton(
onPressed: () => onPressed: () =>
Navigator.pushNamed(context, Navigator.pushNamed(context, Routes.newWalletFromWelcome),
Routes.newWalletFromWelcome),
image: newWalletImage, image: newWalletImage,
text: S.of(context).create_new, text: S.of(context).create_new,
color: Theme.of(context) color: Theme.of(context)
.accentTextTheme! .accentTextTheme!
.subtitle2! .subtitle2!
.decorationColor!, .decorationColor!,
textColor: Theme textColor: Theme.of(context)
.of(context)
.accentTextTheme! .accentTextTheme!
.headline5! .headline5!
.decorationColor!, .decorationColor!,
@ -178,25 +151,18 @@ class WelcomePage extends BasePage {
Navigator.pushNamed(context, Routes.restoreOptions); Navigator.pushNamed(context, Routes.restoreOptions);
}, },
image: restoreWalletImage, image: restoreWalletImage,
text: S text: S.of(context).restore_wallet,
.of(context) color: Theme.of(context).accentTextTheme!.caption!.color!,
.restore_wallet, textColor:
color: Theme.of(context) Theme.of(context).primaryTextTheme!.headline6!.color!),
.accentTextTheme!
.caption!
.color!,
textColor: Theme.of(context)
.primaryTextTheme!
.headline6!
.color!),
) )
], ],
) )
], ],
) ))
)
], ],
) ),
)); ),
)));
} }
} }