From 0aab92d60bf36418e5ee60e100f4e850de246240 Mon Sep 17 00:00:00 2001 From: Justin Enerio Date: Tue, 6 Aug 2024 17:45:03 +0000 Subject: [PATCH] fix: status screen UI theming (#1541) --- .../ramp/screens/off_ramp_order_screen.dart | 66 +++++++------- .../ramp/screens/on_ramp_order_screen.dart | 88 +++++++++---------- .../espressocash_app/lib/l10n/intl_en.arb | 2 +- .../lib/ui/status_screen.dart | 67 +++++++------- 4 files changed, 112 insertions(+), 111 deletions(-) diff --git a/packages/espressocash_app/lib/features/ramp/screens/off_ramp_order_screen.dart b/packages/espressocash_app/lib/features/ramp/screens/off_ramp_order_screen.dart index 2e5037c65f..21d550dfc2 100644 --- a/packages/espressocash_app/lib/features/ramp/screens/off_ramp_order_screen.dart +++ b/packages/espressocash_app/lib/features/ramp/screens/off_ramp_order_screen.dart @@ -196,42 +196,40 @@ class OffRampOrderScreenContent extends StatelessWidget { ), ]; - return CpTheme( + return StatusScreen( theme: theme, - child: StatusScreen( - title: context.l10n.offRampWithdrawTitle.toUpperCase(), - statusType: order.status.toStatusType(), - statusTitle: statusTitle?.let(Text.new), - statusContent: Column( - children: [ - Text(statusContent), - if (order.status.isWaitingForBridge) ...bridgeSubtitleContent, - ], - ), - content: CpContentPadding( - child: SingleChildScrollView( - child: Column( - children: [ - _Timeline( - order: order, - amount: totalAmount, - receiveAmount: receiveAmount, - ), - if (isMoneygramOrder) _MgAdditionalInfo(order: order), - PartnerOrderIdWidget(orderId: order.partnerOrderId), - if (primaryButton != null) ...[ - const SizedBox(height: 12), - primaryButton, - ], - Visibility( - visible: showCancelButton, - maintainSize: true, - maintainAnimation: true, - maintainState: true, - child: _CancelButton(handleCanceled: handleCanceled), - ), + title: context.l10n.offRampWithdrawTitle.toUpperCase(), + statusType: order.status.toStatusType(), + statusTitle: statusTitle?.let(Text.new), + statusContent: Column( + children: [ + Text(statusContent), + if (order.status.isWaitingForBridge) ...bridgeSubtitleContent, + ], + ), + content: CpContentPadding( + child: SingleChildScrollView( + child: Column( + children: [ + _Timeline( + order: order, + amount: totalAmount, + receiveAmount: receiveAmount, + ), + if (isMoneygramOrder) _MgAdditionalInfo(order: order), + PartnerOrderIdWidget(orderId: order.partnerOrderId), + if (primaryButton != null) ...[ + const SizedBox(height: 12), + primaryButton, ], - ), + Visibility( + visible: showCancelButton, + maintainSize: true, + maintainAnimation: true, + maintainState: true, + child: _CancelButton(handleCanceled: handleCanceled), + ), + ], ), ), ), diff --git a/packages/espressocash_app/lib/features/ramp/screens/on_ramp_order_screen.dart b/packages/espressocash_app/lib/features/ramp/screens/on_ramp_order_screen.dart index 5079bf425e..10ade47c18 100644 --- a/packages/espressocash_app/lib/features/ramp/screens/on_ramp_order_screen.dart +++ b/packages/espressocash_app/lib/features/ramp/screens/on_ramp_order_screen.dart @@ -156,57 +156,55 @@ class OnRampOrderScreenContent extends StatelessWidget { ? manualDeposit?.transferAmount : order.submittedAmount; - return CpTheme( + return StatusScreen( theme: theme, - child: StatusScreen( - title: context.l10n.depositTitle.toUpperCase(), - statusType: order.status.toStatusType(), - statusTitle: statusTitle?.let(Text.new), - statusContent: Column( + title: context.l10n.depositTitle.toUpperCase(), + statusType: order.status.toStatusType(), + statusTitle: statusTitle?.let(Text.new), + statusContent: Column( + children: [ + Text(statusContent), + if (statusSubtitle != null) ...[ + const SizedBox(height: 8), + Text( + statusSubtitle, + style: _contentSubtitleTextStyle, + ), + ], + ], + ), + content: CpContentPadding( + child: Column( children: [ - Text(statusContent), - if (statusSubtitle != null) ...[ - const SizedBox(height: 8), - Text( - statusSubtitle, - style: _contentSubtitleTextStyle, + const Spacer(flex: 1), + _Timeline( + status: order.status, + amount: depositAmount ?? order.submittedAmount, + receiveAmount: order.receiveAmount, + manualDeposit: manualDeposit, + created: order.created, + partner: order.partner, + ), + const Spacer(flex: 4), + if (isMoneygramOrder) + _MgAdditionalInfo( + details: order.additionalDetails, + status: order.status.toMoneygramStatus(), ), + PartnerOrderIdWidget(orderId: order.partnerOrderId), + if (primaryButton != null) ...[ + const SizedBox(height: 12), + primaryButton, ], + Visibility( + visible: order.status == OnRampOrderStatus.depositExpired, + maintainSize: true, + maintainAnimation: true, + maintainState: true, + child: _CancelButton(orderId: order.id), + ), ], ), - content: CpContentPadding( - child: Column( - children: [ - const Spacer(flex: 1), - _Timeline( - status: order.status, - amount: depositAmount ?? order.submittedAmount, - receiveAmount: order.receiveAmount, - manualDeposit: manualDeposit, - created: order.created, - partner: order.partner, - ), - const Spacer(flex: 4), - if (isMoneygramOrder) - _MgAdditionalInfo( - details: order.additionalDetails, - status: order.status.toMoneygramStatus(), - ), - PartnerOrderIdWidget(orderId: order.partnerOrderId), - if (primaryButton != null) ...[ - const SizedBox(height: 12), - primaryButton, - ], - Visibility( - visible: order.status == OnRampOrderStatus.depositExpired, - maintainSize: true, - maintainAnimation: true, - maintainState: true, - child: _CancelButton(orderId: order.id), - ), - ], - ), - ), ), ); } diff --git a/packages/espressocash_app/lib/l10n/intl_en.arb b/packages/espressocash_app/lib/l10n/intl_en.arb index f1441a201b..5284bc81dd 100644 --- a/packages/espressocash_app/lib/l10n/intl_en.arb +++ b/packages/espressocash_app/lib/l10n/intl_en.arb @@ -838,7 +838,7 @@ "@viewMoneygramTransferInstructions": {}, "confirmYourTransferOf": "Confirm your transfer of", "@confirmYourTransferOf": {}, - "transferInProgressText": "Transfer could take a few minutes...'", + "transferInProgressText": "Transfer could take a few minutes...", "@transferInProgressText": {}, "openMoneygramIframeText": "Open Moneygram to continue", "@openMoneygramIframeText": {}, diff --git a/packages/espressocash_app/lib/ui/status_screen.dart b/packages/espressocash_app/lib/ui/status_screen.dart index 7c1f0a37dc..d689733a07 100644 --- a/packages/espressocash_app/lib/ui/status_screen.dart +++ b/packages/espressocash_app/lib/ui/status_screen.dart @@ -16,6 +16,7 @@ class StatusScreen extends StatelessWidget { this.onBackButtonPressed, this.statusTitle, this.statusContent, + this.theme = const CpThemeData.black(), }); final CpStatusType statusType; @@ -24,6 +25,7 @@ class StatusScreen extends StatelessWidget { final Widget? statusTitle; final Widget? statusContent; final VoidCallback? onBackButtonPressed; + final CpThemeData theme; @override Widget build(BuildContext context) { @@ -31,42 +33,45 @@ class StatusScreen extends StatelessWidget { final title = this.title; final onBackButtonPressed = this.onBackButtonPressed; - final logo = CpTheme.of(context) == const CpThemeData.black() + final logo = theme == const CpThemeData.black() ? Assets.icons.logoBg.svg(alignment: Alignment.bottomCenter) : Assets.icons.logoBgLight.svg(alignment: Alignment.bottomCenter); - return Scaffold( - appBar: CpAppBar( - title: title != null ? Text(title, style: _titleStyle) : null, - leading: onBackButtonPressed != null - ? CpBackButton(onPressed: onBackButtonPressed) - : null, - automaticallyImplyLeading: onBackButtonPressed != null, - ), - body: Stack( - children: [ - SizedBox( - height: double.infinity, - child: logo, - ), - SizedBox( - width: double.infinity, - child: Column( - children: [ - if (statusContent case final statusContent?) - CpContentPadding( - bottom: false, - child: CpStatusWidget( - statusType: statusType, - title: statusTitle, - content: statusContent, + return CpTheme( + theme: theme, + child: Scaffold( + appBar: CpAppBar( + title: title != null ? Text(title, style: _titleStyle) : null, + leading: onBackButtonPressed != null + ? CpBackButton(onPressed: onBackButtonPressed) + : null, + automaticallyImplyLeading: onBackButtonPressed != null, + ), + body: Stack( + children: [ + SizedBox( + height: double.infinity, + child: logo, + ), + SizedBox( + width: double.infinity, + child: Column( + children: [ + if (statusContent case final statusContent?) + CpContentPadding( + bottom: false, + child: CpStatusWidget( + statusType: statusType, + title: statusTitle, + content: statusContent, + ), ), - ), - if (content != null) Expanded(child: content), - ], + if (content != null) Expanded(child: content), + ], + ), ), - ), - ], + ], + ), ), ); }