From 52468e13310d02b8e53249b07bfbaa9e269e5981 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Fri, 17 Feb 2023 18:19:26 +0200 Subject: [PATCH 1/5] Fix desktop background color and address book view issues --- .../dashboard/desktop_dashboard_page.dart | 45 ++++++++++--------- .../desktop_sidebar_wrapper.dart | 1 + .../exchange/widgets/exchange_card.dart | 10 +++-- lib/src/widgets/address_text_field.dart | 8 +++- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/lib/src/screens/dashboard/desktop_dashboard_page.dart b/lib/src/screens/dashboard/desktop_dashboard_page.dart index f79d2f9e2..069da201e 100644 --- a/lib/src/screens/dashboard/desktop_dashboard_page.dart +++ b/lib/src/screens/dashboard/desktop_dashboard_page.dart @@ -32,29 +32,32 @@ class DesktopDashboardPage extends StatelessWidget { Widget build(BuildContext context) { _setEffects(context); - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 400, - child: balancePage, - ), - Flexible( - child: ConstrainedBox( - constraints: BoxConstraints(maxWidth: 500), - child: Navigator( - key: desktopKey, - initialRoute: Routes.desktop_actions, - onGenerateRoute: (settings) => Router.createRoute(settings), - onGenerateInitialRoutes: (NavigatorState navigator, String initialRouteName) { - return [ - navigator.widget.onGenerateRoute!(RouteSettings(name: initialRouteName))! - ]; - }, + return Container( + color: Theme.of(context).backgroundColor, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 400, + child: balancePage, + ), + Flexible( + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: 500), + child: Navigator( + key: desktopKey, + initialRoute: Routes.desktop_actions, + onGenerateRoute: (settings) => Router.createRoute(settings), + onGenerateInitialRoutes: (NavigatorState navigator, String initialRouteName) { + return [ + navigator.widget.onGenerateRoute!(RouteSettings(name: initialRouteName))! + ]; + }, + ), ), ), - ), - ], + ], + ), ); } diff --git a/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart index ec6ff1a32..7eec1dce6 100644 --- a/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart @@ -160,6 +160,7 @@ class DesktopSidebarWrapper extends BasePage { children: [ child, Container( + color: Theme.of(context).backgroundColor, padding: EdgeInsets.all(20), child: Navigator( initialRoute: Routes.support, diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 40aa679a4..6aa201772 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -1,6 +1,8 @@ import 'package:cake_wallet/entities/contact_base.dart'; import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; +import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/payment_request.dart'; @@ -430,10 +432,10 @@ class ExchangeCardState extends State { padding: EdgeInsets.only(top: 0), child: InkWell( onTap: () async { - final contact = - await Navigator.of(context, - rootNavigator: true) - .pushNamed(Routes + final navigatorState = ResponsiveLayoutUtil.instance.isMobile(context) + ? Navigator.of(context, rootNavigator: true) + : DesktopDashboardPage.desktopKey.currentState!; + final contact = await navigatorState.pushNamed(Routes .pickerAddressBook); if (contact is ContactBase && diff --git a/lib/src/widgets/address_text_field.dart b/lib/src/widgets/address_text_field.dart index 7e0727312..fb041cfeb 100644 --- a/lib/src/widgets/address_text_field.dart +++ b/lib/src/widgets/address_text_field.dart @@ -1,3 +1,5 @@ +import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart'; +import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; @@ -209,8 +211,10 @@ class AddressTextField extends StatelessWidget { } Future _presetAddressBookPicker(BuildContext context) async { - final contact = await Navigator.of(context, rootNavigator: true) - .pushNamed(Routes.pickerAddressBook,arguments: selectedCurrency); + final navigatorState = ResponsiveLayoutUtil.instance.isMobile(context) ? Navigator.of(context, rootNavigator: true) + : DesktopDashboardPage.desktopKey.currentState!; + final contact = await navigatorState.pushNamed(Routes.pickerAddressBook,arguments: selectedCurrency); + if (contact is ContactBase && contact.address != null) { controller?.text = contact.address; From 59a79242af2f85a2b4b9bd7ab2ccf0163c49504a Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Fri, 17 Feb 2023 19:06:41 +0200 Subject: [PATCH 2/5] Fix input field --- lib/src/screens/ionia/cards/ionia_buy_gift_card.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index 3182d366f..f012f486b 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -44,7 +44,6 @@ class IoniaBuyGiftCardPage extends BasePage { @override Widget body(BuildContext context) { - final _width = MediaQuery.of(context).size.width; final merchant = ioniaBuyCardViewModel.ioniaMerchant; return KeyboardActions( disableScroll: true, @@ -101,7 +100,7 @@ class IoniaBuyGiftCardPage extends BasePage { prefixIcon: Padding( padding: EdgeInsets.only( top: 5.0, - left: _width / 4, + left: 150, ), child: Text( 'USD: ', From cf125d1e069a3185305b79d7e0f327799f05ad56 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Sat, 18 Feb 2023 14:23:48 +0200 Subject: [PATCH 3/5] Fix issue from code review --- lib/src/screens/exchange/widgets/exchange_card.dart | 10 +++------- lib/src/screens/ionia/cards/ionia_buy_gift_card.dart | 7 ++++--- lib/src/widgets/address_text_field.dart | 8 ++------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 6aa201772..7fdac5ba2 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -1,8 +1,6 @@ import 'package:cake_wallet/entities/contact_base.dart'; import 'package:cake_wallet/routes.dart'; -import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; -import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/payment_request.dart'; @@ -432,11 +430,9 @@ class ExchangeCardState extends State { padding: EdgeInsets.only(top: 0), child: InkWell( onTap: () async { - final navigatorState = ResponsiveLayoutUtil.instance.isMobile(context) - ? Navigator.of(context, rootNavigator: true) - : DesktopDashboardPage.desktopKey.currentState!; - final contact = await navigatorState.pushNamed(Routes - .pickerAddressBook); + final contact = + await Navigator.of(context) + .pushNamed(Routes.pickerAddressBook); if (contact is ContactBase && contact.address != null) { diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index f012f486b..23bb03ed6 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/themes/theme_base.dart'; +import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/view_model/ionia/ionia_buy_card_view_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -44,6 +45,7 @@ class IoniaBuyGiftCardPage extends BasePage { @override Widget body(BuildContext context) { + final _width = MediaQuery.of(context).size.width; final merchant = ioniaBuyCardViewModel.ioniaMerchant; return KeyboardActions( disableScroll: true, @@ -100,9 +102,8 @@ class IoniaBuyGiftCardPage extends BasePage { prefixIcon: Padding( padding: EdgeInsets.only( top: 5.0, - left: 150, - ), - child: Text( + left: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint) / 3, + child: Text( 'USD: ', style: TextStyle( color: Colors.white, diff --git a/lib/src/widgets/address_text_field.dart b/lib/src/widgets/address_text_field.dart index fb041cfeb..e4549ee14 100644 --- a/lib/src/widgets/address_text_field.dart +++ b/lib/src/widgets/address_text_field.dart @@ -1,5 +1,3 @@ -import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart'; -import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; @@ -211,10 +209,8 @@ class AddressTextField extends StatelessWidget { } Future _presetAddressBookPicker(BuildContext context) async { - final navigatorState = ResponsiveLayoutUtil.instance.isMobile(context) ? Navigator.of(context, rootNavigator: true) - : DesktopDashboardPage.desktopKey.currentState!; - final contact = await navigatorState.pushNamed(Routes.pickerAddressBook,arguments: selectedCurrency); - + final contact = await Navigator.of(context) + .pushNamed(Routes.pickerAddressBook,arguments: selectedCurrency); if (contact is ContactBase && contact.address != null) { controller?.text = contact.address; From 8d482464d95275c5b720c63863dea7f63d0773d7 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Thu, 23 Feb 2023 18:56:20 +0200 Subject: [PATCH 4/5] Fix ionia input field alignment --- .../ionia/cards/ionia_buy_gift_card.dart | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index 23bb03ed6..8b3e62a75 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -45,7 +45,6 @@ class IoniaBuyGiftCardPage extends BasePage { @override Widget body(BuildContext context) { - final _width = MediaQuery.of(context).size.width; final merchant = ioniaBuyCardViewModel.ioniaMerchant; return KeyboardActions( disableScroll: true, @@ -76,43 +75,40 @@ class IoniaBuyGiftCardPage extends BasePage { ), child: Column( mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: 150), - BaseTextFormField( - controller: _amountController, - focusNode: _amountFieldFocus, - keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), - inputFormatters: [ - FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')), - FilteringTextInputFormatter.allow(RegExp(r'^\d+(\.|\,)?\d{0,2}'))], - hintText: '1000', - placeholderTextStyle: TextStyle( - color: Theme.of(context).primaryTextTheme!.headline5!.color!, - fontWeight: FontWeight.w600, - fontSize: 36, - ), - borderColor: Theme.of(context).primaryTextTheme!.headline5!.color!, - textColor: Colors.white, - textStyle: TextStyle( - color: Colors.white, - fontSize: 36, - ), - prefixIcon: Padding( - padding: EdgeInsets.only( - top: 5.0, - left: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint) / 3, - child: Text( - 'USD: ', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 36, - ), + SizedBox( + width: 200, + child: BaseTextFormField( + controller: TextEditingController(), + keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), + hintText: '1000', + placeholderTextStyle: TextStyle( + color: Theme.of(context).primaryTextTheme.headline5!.color!, + fontWeight: FontWeight.w600, + fontSize: 36, ), + prefixIcon: Text( + 'USD: ', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 36, + ), + ), + textColor: Colors.white, + textStyle: TextStyle( + color: Colors.white, + fontSize: 36, + ), + ), ), + Divider( + color: Theme.of(context).primaryTextTheme.headline5!.color!, + height: 1, + ), SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, From d3eb22e1d4e84a4c65debcb1eff00cfdf2efd38e Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Thu, 23 Feb 2023 21:16:28 +0200 Subject: [PATCH 5/5] Replace removed code --- .../ionia/cards/ionia_buy_gift_card.dart | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index 8b3e62a75..a60b967f2 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -67,7 +67,10 @@ class IoniaBuyGiftCardPage extends BasePage { Container( padding: EdgeInsets.symmetric(horizontal: 25), decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(24), + bottomRight: Radius.circular(24), + ), gradient: LinearGradient(colors: [ Theme.of(context).primaryTextTheme!.subtitle1!.color!, Theme.of(context).primaryTextTheme!.subtitle1!.decorationColor!, @@ -78,31 +81,37 @@ class IoniaBuyGiftCardPage extends BasePage { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: 150), - SizedBox( + SizedBox( width: 200, child: BaseTextFormField( - controller: TextEditingController(), + controller: _amountController, + focusNode: _amountFieldFocus, keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), + inputFormatters: [ + FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')), + FilteringTextInputFormatter.allow( + RegExp(r'^\d+(\.|\,)?\d{0,2}'), + ), + ], hintText: '1000', placeholderTextStyle: TextStyle( color: Theme.of(context).primaryTextTheme.headline5!.color!, fontWeight: FontWeight.w600, fontSize: 36, ), - prefixIcon: Text( - 'USD: ', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 36, - ), + prefixIcon: Text( + 'USD: ', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 36, ), + ), textColor: Colors.white, textStyle: TextStyle( color: Colors.white, fontSize: 36, ), - ), ), Divider( @@ -136,7 +145,11 @@ class IoniaBuyGiftCardPage extends BasePage { padding: const EdgeInsets.all(24.0), child: CardItem( title: merchant.legalName, - backgroundColor: Theme.of(context).accentTextTheme!.headline1!.backgroundColor!.withOpacity(0.1), + backgroundColor: Theme.of(context) + .accentTextTheme! + .headline1! + .backgroundColor! + .withOpacity(0.1), discount: merchant.discount, titleColor: Theme.of(context).accentTextTheme!.headline1!.backgroundColor!, subtitleColor: Theme.of(context).hintColor,