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