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';
@ -19,7 +20,7 @@ class WelcomePage extends BasePage {
if (isHaven) { if (isHaven) {
return S.of(context).haven_app; return S.of(context).haven_app;
} }
return S.of(context).cake_wallet; return S.of(context).cake_wallet;
} }
@ -31,172 +32,137 @@ class WelcomePage extends BasePage {
if (isHaven) { if (isHaven) {
return S.of(context).haven_app_wallet_text; return S.of(context).haven_app_wallet_text;
} }
return S.of(context).first_wallet_text; return S.of(context).first_wallet_text;
} }
@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(
padding: EdgeInsets.only(top: 64, bottom: 24, left: 24, right: 24), onWillPop: () async => false,
child: Column( child: Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: EdgeInsets.only(top: 64, bottom: 24, left: 24, right: 24),
children: <Widget>[ child: Center(
Flexible( child: ConstrainedBox(
flex: 2, constraints:
child: AspectRatio( BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
aspectRatio: aspectRatioImage,
child: FittedBox(child: welcomeImage, fit: BoxFit.fill)
)
),
Flexible(
flex: 3,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Flexible(
children: <Widget>[ flex: 2,
Padding( child: AspectRatio(
padding: EdgeInsets.only(top: 24), aspectRatio: aspectRatioImage,
child: Text( child: FittedBox(child: welcomeImage, fit: BoxFit.fill))),
S Flexible(
.of(context) flex: 3,
.welcome, child: Column(
style: TextStyle( mainAxisAlignment: MainAxisAlignment.spaceBetween,
fontSize: 18, children: <Widget>[
fontWeight: FontWeight.w500, Column(
color: Theme children: <Widget>[
.of(context) Padding(
.accentTextTheme! padding: EdgeInsets.only(top: 24),
.headline2! child: Text(
.color!, S.of(context).welcome,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.color!,
),
textAlign: TextAlign.center,
),
),
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
appTitle(context),
style: TextStyle(
fontSize: 36,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
),
textAlign: TextAlign.center,
),
),
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
appDescription(context),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme!.headline2!.color!,
),
textAlign: TextAlign.center,
),
),
],
), ),
textAlign: TextAlign.center, Column(
), children: <Widget>[
), Text(
Padding( S.of(context).please_make_selection,
padding: EdgeInsets.only(top: 5), style: TextStyle(
child: Text( fontSize: 12,
appTitle(context), fontWeight: FontWeight.normal,
style: TextStyle( color: Theme.of(context).accentTextTheme!.headline2!.color!,
fontSize: 36, ),
fontWeight: FontWeight.bold, textAlign: TextAlign.center,
color: Theme.of(context) ),
.primaryTextTheme! Padding(
.headline6! padding: EdgeInsets.only(top: 24),
.color!, child: PrimaryImageButton(
), onPressed: () =>
textAlign: TextAlign.center, Navigator.pushNamed(context, Routes.newWalletFromWelcome),
), image: newWalletImage,
), text: S.of(context).create_new,
Padding( color: Theme.of(context)
padding: EdgeInsets.only(top: 5), .accentTextTheme!
child: Text( .subtitle2!
appDescription(context), .decorationColor!,
style: TextStyle( textColor: Theme.of(context)
fontSize: 16, .accentTextTheme!
fontWeight: FontWeight.w500, .headline5!
color: Theme .decorationColor!,
.of(context) ),
.accentTextTheme! ),
.headline2! Padding(
.color!, padding: EdgeInsets.only(top: 10),
), child: PrimaryImageButton(
textAlign: TextAlign.center, onPressed: () {
), Navigator.pushNamed(context, Routes.restoreOptions);
), },
], image: restoreWalletImage,
), text: S.of(context).restore_wallet,
Column( color: Theme.of(context).accentTextTheme!.caption!.color!,
children: <Widget>[ textColor:
Text( Theme.of(context).primaryTextTheme!.headline6!.color!),
S )
.of(context) ],
.please_make_selection, )
style: TextStyle( ],
fontSize: 12, ))
fontWeight: FontWeight.normal,
color: Theme.of(context)
.accentTextTheme!
.headline2!
.color!,
),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton(
onPressed: () =>
Navigator.pushNamed(context,
Routes.newWalletFromWelcome),
image: newWalletImage,
text: S.of(context).create_new,
color: Theme.of(context)
.accentTextTheme!
.subtitle2!
.decorationColor!,
textColor: Theme
.of(context)
.accentTextTheme!
.headline5!
.decorationColor!,
),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: PrimaryImageButton(
onPressed: () {
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!),
)
],
)
], ],
) ),
) ),
], )));
)
));
} }
} }