mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-29 04:49:51 +00:00
Merge pull request #2212 from cake-tech/CW-1015-Desktop-Issues
CW-1015: Desktop Issues
This commit is contained in:
commit
e4a89f4d1e
3 changed files with 53 additions and 12 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),
|
||||||
|
|
|
@ -38,6 +38,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
static const fourPinLength = 4;
|
static const fourPinLength = 4;
|
||||||
final _gridViewKey = GlobalKey();
|
final _gridViewKey = GlobalKey();
|
||||||
final _key = GlobalKey<ScaffoldState>();
|
final _key = GlobalKey<ScaffoldState>();
|
||||||
|
late final FocusNode _focusNode;
|
||||||
|
|
||||||
int pinLength;
|
int pinLength;
|
||||||
String pin;
|
String pin;
|
||||||
|
@ -54,7 +55,17 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
pin = '';
|
pin = '';
|
||||||
title = S.current.enter_your_pin;
|
title = S.current.enter_your_pin;
|
||||||
_aspectRatio = 0;
|
_aspectRatio = 0;
|
||||||
WidgetsBinding.instance.addPostFrameCallback(_afterLayout);
|
_focusNode = FocusNode();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_focusNode.requestFocus();
|
||||||
|
_afterLayout(_);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_focusNode.dispose();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTitle(String title) => setState(() => this.title = title);
|
void setTitle(String title) => setState(() => this.title = title);
|
||||||
|
@ -120,8 +131,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
);
|
);
|
||||||
|
|
||||||
return KeyboardListener(
|
return KeyboardListener(
|
||||||
focusNode: FocusNode(),
|
focusNode: _focusNode,
|
||||||
autofocus: true,
|
autofocus: false,
|
||||||
onKeyEvent: (keyEvent) {
|
onKeyEvent: (keyEvent) {
|
||||||
if (keyEvent is KeyDownEvent) {
|
if (keyEvent is KeyDownEvent) {
|
||||||
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
||||||
|
@ -144,8 +155,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color:
|
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
|
||||||
Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
|
|
||||||
Spacer(flex: 8),
|
Spacer(flex: 8),
|
||||||
Container(
|
Container(
|
||||||
width: 180,
|
width: 180,
|
||||||
|
@ -162,7 +172,9 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).extension<CakeTextTheme>()!.titleColor
|
? Theme.of(context).extension<CakeTextTheme>()!.titleColor
|
||||||
: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor
|
: Theme.of(context)
|
||||||
|
.extension<PinCodeTheme>()!
|
||||||
|
.indicatorsColor
|
||||||
.withOpacity(0.25),
|
.withOpacity(0.25),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
|
@ -225,7 +237,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _pop(),
|
onPressed: () => _pop(),
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.background,
|
||||||
shape: CircleBorder(),
|
shape: CircleBorder(),
|
||||||
),
|
),
|
||||||
child: deleteIconImage,
|
child: deleteIconImage,
|
||||||
|
@ -250,7 +263,9 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25.0,
|
fontSize: 25.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)),
|
color: Theme.of(context)
|
||||||
|
.extension<CakeTextTheme>()!
|
||||||
|
.titleColor)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue