Skip to content

Commit

Permalink
fix: status screen UI theming (#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinenerio committed Aug 6, 2024
1 parent 5cb6e9b commit 0aab92d
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
],
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
],
),
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/espressocash_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
67 changes: 36 additions & 31 deletions packages/espressocash_app/lib/ui/status_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class StatusScreen extends StatelessWidget {
this.onBackButtonPressed,
this.statusTitle,
this.statusContent,
this.theme = const CpThemeData.black(),
});

final CpStatusType statusType;
Expand All @@ -24,49 +25,53 @@ class StatusScreen extends StatelessWidget {
final Widget? statusTitle;
final Widget? statusContent;
final VoidCallback? onBackButtonPressed;
final CpThemeData theme;

@override
Widget build(BuildContext context) {
final content = this.content;
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),
],
),
),
),
],
],
),
),
);
}
Expand Down

0 comments on commit 0aab92d

Please sign in to comment.