mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
fix(buy/sell-flow): add buy/sell toggle to DesktopExchangeCardsSection
The desktop exchange screen was only showing the buy flow with no way to switch to sell. This change adds the missing toggle to the DesktopExchangeCardsSection and links it up in the buy/sell page
This commit is contained in:
parent
d9c01a5d07
commit
fe435d4e3b
2 changed files with 30 additions and 4 deletions
|
@ -490,11 +490,19 @@ class BuySellPage extends BasePage {
|
||||||
return DesktopExchangeCardsSection(
|
return DesktopExchangeCardsSection(
|
||||||
firstExchangeCard: fiatExchangeCard,
|
firstExchangeCard: fiatExchangeCard,
|
||||||
secondExchangeCard: cryptoExchangeCard,
|
secondExchangeCard: cryptoExchangeCard,
|
||||||
|
onBuyTap: () => null,
|
||||||
|
onSellTap: () =>
|
||||||
|
buySellViewModel.isBuyAction ? buySellViewModel.changeBuySellAction() : null,
|
||||||
|
isBuySellOption: true,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return DesktopExchangeCardsSection(
|
return DesktopExchangeCardsSection(
|
||||||
firstExchangeCard: cryptoExchangeCard,
|
firstExchangeCard: cryptoExchangeCard,
|
||||||
secondExchangeCard: fiatExchangeCard,
|
secondExchangeCard: fiatExchangeCard,
|
||||||
|
onBuyTap: () =>
|
||||||
|
!buySellViewModel.isBuyAction ? buySellViewModel.changeBuySellAction() : null,
|
||||||
|
onSellTap: () => null,
|
||||||
|
isBuySellOption: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
|
import 'package:cake_wallet/src/screens/exchange/widgets/mobile_exchange_cards_section.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DesktopExchangeCardsSection extends StatelessWidget {
|
class DesktopExchangeCardsSection extends StatelessWidget {
|
||||||
final Widget firstExchangeCard;
|
|
||||||
final Widget secondExchangeCard;
|
|
||||||
|
|
||||||
const DesktopExchangeCardsSection({
|
const DesktopExchangeCardsSection({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.firstExchangeCard,
|
required this.firstExchangeCard,
|
||||||
required this.secondExchangeCard,
|
required this.secondExchangeCard,
|
||||||
|
this.isBuySellOption = false,
|
||||||
|
this.onBuyTap,
|
||||||
|
this.onSellTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final Widget firstExchangeCard;
|
||||||
|
final Widget secondExchangeCard;
|
||||||
|
final bool isBuySellOption;
|
||||||
|
final VoidCallback? onBuyTap;
|
||||||
|
final VoidCallback? onSellTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return FocusTraversalGroup(
|
return FocusTraversalGroup(
|
||||||
|
@ -18,7 +25,18 @@ class DesktopExchangeCardsSection extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 55, left: 24, right: 24),
|
padding: EdgeInsets.only(top: 55, left: 24, right: 24),
|
||||||
child: firstExchangeCard,
|
child: Column(
|
||||||
|
children: [
|
||||||
|
if (isBuySellOption)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
BuySellOptionButtons(onBuyTap: onBuyTap, onSellTap: onSellTap),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
firstExchangeCard,
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue