mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-31 06:55:59 +00:00
Fix Constrained width screens UI
This commit is contained in:
parent
c1bf0ee7aa
commit
5fa50c7668
4 changed files with 299 additions and 280 deletions
|
@ -1,6 +1,7 @@
|
||||||
import 'package:cake_wallet/entities/generate_name.dart';
|
import 'package:cake_wallet/entities/generate_name.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
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:cake_wallet/utils/show_pop_up.dart';
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
@ -29,9 +30,6 @@ class NewWalletPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
String get title => S.current.new_wallet;
|
String get title => S.current.new_wallet;
|
||||||
|
|
||||||
@override
|
|
||||||
Widget trailing(BuildContext context) => SizedBox.shrink();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) => WalletNameForm(
|
Widget body(BuildContext context) => WalletNameForm(
|
||||||
_walletNewVM, currentTheme.type == ThemeType.dark ? walletNameImage : walletNameLightImage);
|
_walletNewVM, currentTheme.type == ThemeType.dark ? walletNameImage : walletNameLightImage);
|
||||||
|
@ -89,12 +87,15 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(top: 24),
|
padding: EdgeInsets.only(top: 24),
|
||||||
child: Center(
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxWidth: 600),
|
|
||||||
child: ScrollableWithBottomSection(
|
child: ScrollableWithBottomSection(
|
||||||
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
content: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
content: Center(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints:
|
||||||
|
BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(left: 12, right: 12),
|
padding: EdgeInsets.only(left: 12, right: 12),
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
|
@ -191,9 +192,14 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
key: _languageSelectorKey, initialSelected: defaultSeedLanguage),
|
key: _languageSelectorKey, initialSelected: defaultSeedLanguage),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
bottomSectionPadding: EdgeInsets.all(24),
|
bottomSectionPadding: EdgeInsets.all(24),
|
||||||
bottomSection: Column(
|
bottomSection: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Observer(
|
Observer(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
@ -216,9 +222,8 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||||
child: Text(S.of(context).advanced_privacy_settings),
|
child: Text(S.of(context).advanced_privacy_settings),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
)),
|
)),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:cake_wallet/themes/theme_base.dart';
|
import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -18,9 +19,6 @@ class NewWalletTypePage extends BasePage {
|
||||||
@override
|
@override
|
||||||
String get title => S.current.wallet_list_restore_wallet;
|
String get title => S.current.wallet_list_restore_wallet;
|
||||||
|
|
||||||
@override
|
|
||||||
Widget trailing(BuildContext context) => SizedBox.shrink();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) => WalletTypeForm(
|
Widget body(BuildContext context) => WalletTypeForm(
|
||||||
onTypeSelected: onTypeSelected,
|
onTypeSelected: onTypeSelected,
|
||||||
|
@ -60,12 +58,12 @@ class WalletTypeFormState extends State<WalletTypeForm> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Center(
|
return ScrollableWithBottomSection(
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxWidth: 600),
|
|
||||||
child: ScrollableWithBottomSection(
|
|
||||||
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
content: Column(
|
content: Center(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -95,8 +93,12 @@ class WalletTypeFormState extends State<WalletTypeForm> {
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
bottomSection: PrimaryButton(
|
bottomSection: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||||
|
child: PrimaryButton(
|
||||||
onPressed: () => onTypeSelected(),
|
onPressed: () => onTypeSelected(),
|
||||||
text: S.of(context).seed_language_next,
|
text: S.of(context).seed_language_next,
|
||||||
color: Theme.of(context).accentTextTheme.bodyText1!.color!,
|
color: Theme.of(context).accentTextTheme.bodyText1!.color!,
|
||||||
|
@ -104,7 +106,6 @@ class WalletTypeFormState extends State<WalletTypeForm> {
|
||||||
isDisabled: selected == null,
|
isDisabled: selected == null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||||
import 'package:cake_wallet/utils/show_bar.dart';
|
import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:another_flushbar/flushbar.dart';
|
import 'package:another_flushbar/flushbar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -134,7 +135,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 40.0),
|
padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 40.0),
|
||||||
child: Column(children: <Widget>[
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
Spacer(flex: 2),
|
Spacer(flex: 2),
|
||||||
Text(title,
|
Text(title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -157,7 +159,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).primaryTextTheme!.headline6!.color!
|
? Theme.of(context).primaryTextTheme!.headline6!.color!
|
||||||
: Theme.of(context).accentTextTheme!.bodyText2!.color!.withOpacity(0.25),
|
: Theme.of(context)
|
||||||
|
.accentTextTheme!
|
||||||
|
.bodyText2!
|
||||||
|
.color!
|
||||||
|
.withOpacity(0.25),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -183,9 +189,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 24,
|
flex: 24,
|
||||||
child: Center(
|
child: Center(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,
|
||||||
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.height * 0.6,
|
|
||||||
width: MediaQuery.of(context).size.height * 0.6,
|
|
||||||
key: _gridViewKey,
|
key: _gridViewKey,
|
||||||
child: _aspectRatio > 0
|
child: _aspectRatio > 0
|
||||||
? ScrollConfiguration(
|
? ScrollConfiguration(
|
||||||
|
@ -270,8 +278,10 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 30.0,
|
fontSize: 30.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color:
|
color: Theme.of(context)
|
||||||
Theme.of(context).primaryTextTheme!.headline6!.color!)),
|
.primaryTextTheme!
|
||||||
|
.headline6!
|
||||||
|
.color!)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
@ -280,9 +290,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ResponsiveLayoutUtil {
|
class ResponsiveLayoutUtil {
|
||||||
static const double _kMobileThreshold = 900;
|
static const double _kMobileThreshold = 900;
|
||||||
|
static const double kDesktopMaxWidthConstraint = 400;
|
||||||
|
|
||||||
const ResponsiveLayoutUtil._();
|
const ResponsiveLayoutUtil._();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue