diff --git a/packages/espressocash_app/lib/features/authenticated/widgets/investment_header.dart b/packages/espressocash_app/lib/features/authenticated/widgets/investment_header.dart index 464ad3332f..ec40d24761 100644 --- a/packages/espressocash_app/lib/features/authenticated/widgets/investment_header.dart +++ b/packages/espressocash_app/lib/features/authenticated/widgets/investment_header.dart @@ -59,65 +59,69 @@ class _Buttons extends StatelessWidget { final VoidCallback onSendMoneyPressed; @override - Widget build(BuildContext context) => DecoratedBox( - decoration: const BoxDecoration( - color: CpColors.dashboardBackgroundColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(31), - topRight: Radius.circular(31), - ), + Widget build(BuildContext context) { + final MediaQueryData mediaQueryData = MediaQuery.of(context); + + return DecoratedBox( + decoration: const BoxDecoration( + color: CpColors.dashboardBackgroundColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(31), + topRight: Radius.circular(31), ), - child: ValueStreamBuilder( - create: () => - sl().call().map((it) => it.isZero), - builder: (context, isZeroAmount) => Padding( - padding: - const EdgeInsets.only(left: 18, top: 20, right: 18, bottom: 8), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - FittedBox( - child: Text( - isZeroAmount - ? context.l10n.fundYourAccount - : context.l10n.investmentHeaderButtonsTitle, - textAlign: TextAlign.center, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 17, - letterSpacing: 0.23, - ), + ), + child: ValueStreamBuilder( + create: () => sl().call().map((it) => it.isZero), + builder: (context, isZeroAmount) => Padding( + padding: + const EdgeInsets.only(left: 18, top: 20, right: 18, bottom: 8), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + FittedBox( + child: Text( + isZeroAmount + ? context.l10n.fundYourAccount + : context.l10n.investmentHeaderButtonsTitle, + textAlign: TextAlign.center, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 17, + letterSpacing: 0.23, ), ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (!isZeroAmount) ...[ - Flexible( - child: CpButton( - minWidth: 250, - size: CpButtonSize.wide, - text: context.l10n.sendMoney, - onPressed: onSendMoneyPressed, - ), - ), - const SizedBox(width: 8), - ], - const AddCashButton(size: CpButtonSize.wide), - if (!isZeroAmount) ...[ - const SizedBox(width: 8), - const CashOutButton(size: CpButtonSize.wide), - ], + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + if (!isZeroAmount) ...[ + SizedBox( + width: mediaQueryData.size.width * 0.3, + child: + PayOrRequestButton(voidCallback: onSendMoneyPressed), + ), ], - ), - ], - ), + SizedBox( + width: mediaQueryData.size.width * 0.3, + child: const AddCashButton(size: CpButtonSize.wide), + ), + if (!isZeroAmount) ...[ + SizedBox( + width: mediaQueryData.size.width * 0.3, + child: const CashOutButton(size: CpButtonSize.wide), + ), + ], + ], + ), + ], ), ), - ); + ), + ); + } } class _Info extends StatelessWidget { diff --git a/packages/espressocash_app/lib/features/ramp/widgets/ramp_buttons.dart b/packages/espressocash_app/lib/features/ramp/widgets/ramp_buttons.dart index 749199cf45..9e95cc7b69 100644 --- a/packages/espressocash_app/lib/features/ramp/widgets/ramp_buttons.dart +++ b/packages/espressocash_app/lib/features/ramp/widgets/ramp_buttons.dart @@ -34,25 +34,23 @@ class PayOrRequestButton extends StatelessWidget { final CpButtonSize size; final VoidCallback voidCallback; @override - Widget build(BuildContext context) => Flexible( - child: Column( - children: [ - CpIconButton( - icon: Assets.icons.dolar.svg(color: Colors.black), - variant: CpIconButtonVariant.dark, - size: CpIconButtonSize.large, - onPressed: voidCallback, - ), - const SizedBox(height: 8), - Text( - context.l10n.sendMoney, - style: Theme.of(context) - .textTheme - .bodyLarge - ?.copyWith(fontWeight: FontWeight.w500), - ), - ], - ), + Widget build(BuildContext context) => Column( + children: [ + CpIconButton( + icon: Assets.icons.dolar.svg(color: Colors.black), + variant: CpIconButtonVariant.dark, + size: CpIconButtonSize.large, + onPressed: voidCallback, + ), + const SizedBox(height: 8), + Text( + context.l10n.sendMoney, + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(fontWeight: FontWeight.w500), + ), + ], ); } @@ -65,33 +63,31 @@ class AddCashButton extends StatelessWidget { final CpButtonSize size; @override - Widget build(BuildContext context) => Flexible( - child: Column( - children: [ - CpIconButton( - icon: Assets.icons.addAlternative.svg(color: Colors.black), - variant: CpIconButtonVariant.dark, - size: CpIconButtonSize.large, - onPressed: () async { - final data = await context.ensureProfileData(RampType.onRamp); - if (context.mounted && data != null) { - context.launchOnRampFlow( - profile: data, - address: sl().wallet.publicKey.toBase58(), - ); - } - }, - ), - const SizedBox(height: 8), - Text( - context.l10n.ramp_btnAddCash, - style: Theme.of(context) - .textTheme - .bodyLarge - ?.copyWith(fontWeight: FontWeight.w500), - ), - ], - ), + Widget build(BuildContext context) => Column( + children: [ + CpIconButton( + icon: Assets.icons.addAlternative.svg(color: Colors.black), + variant: CpIconButtonVariant.dark, + size: CpIconButtonSize.large, + onPressed: () async { + final data = await context.ensureProfileData(RampType.onRamp); + if (context.mounted && data != null) { + context.launchOnRampFlow( + profile: data, + address: sl().wallet.publicKey.toBase58(), + ); + } + }, + ), + const SizedBox(height: 8), + Text( + context.l10n.ramp_btnAddCash, + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(fontWeight: FontWeight.w500), + ), + ], ); } @@ -104,33 +100,31 @@ class CashOutButton extends StatelessWidget { final CpButtonSize size; @override - Widget build(BuildContext context) => Flexible( - child: Column( - children: [ - CpIconButton( - icon: Assets.icons.withdrawn.svg(color: Colors.black), - variant: CpIconButtonVariant.dark, - size: CpIconButtonSize.large, - onPressed: () async { - final data = await context.ensureProfileData(RampType.offRamp); - if (context.mounted && data != null) { - context.launchOffRampFlow( - profile: data, - address: sl().wallet.publicKey.toBase58(), - ); - } - }, - ), - const SizedBox(height: 8), - Text( - context.l10n.ramp_btnCashOut, - style: Theme.of(context) - .textTheme - .bodyLarge - ?.copyWith(fontWeight: FontWeight.w500), - ), - ], - ), + Widget build(BuildContext context) => Column( + children: [ + CpIconButton( + icon: Assets.icons.withdrawn.svg(color: Colors.black), + variant: CpIconButtonVariant.dark, + size: CpIconButtonSize.large, + onPressed: () async { + final data = await context.ensureProfileData(RampType.offRamp); + if (context.mounted && data != null) { + context.launchOffRampFlow( + profile: data, + address: sl().wallet.publicKey.toBase58(), + ); + } + }, + ), + const SizedBox(height: 8), + Text( + context.l10n.ramp_btnCashOut, + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(fontWeight: FontWeight.w500), + ), + ], ); } diff --git a/packages/espressocash_app/test/golden/goldens/wallet_flow_screen.png b/packages/espressocash_app/test/golden/goldens/wallet_flow_screen.png index c34338762a..3a0e7b2e33 100644 Binary files a/packages/espressocash_app/test/golden/goldens/wallet_flow_screen.png and b/packages/espressocash_app/test/golden/goldens/wallet_flow_screen.png differ