mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
Add done button for amount text fields on exchange templates
This commit is contained in:
parent
70fb6e5ebf
commit
83c976d12d
1 changed files with 25 additions and 4 deletions
|
@ -3,9 +3,13 @@ import 'package:cake_wallet/exchange/exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/exchange_template.dart';
|
import 'package:cake_wallet/exchange/exchange_template.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||||
|
import 'package:keyboard_actions/keyboard_actions_config.dart';
|
||||||
|
import 'package:keyboard_actions/keyboard_actions_item.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cw_core/crypto_currency.dart';
|
import 'package:cw_core/crypto_currency.dart';
|
||||||
|
@ -28,6 +32,8 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
final depositKey = GlobalKey<ExchangeCardState>();
|
final depositKey = GlobalKey<ExchangeCardState>();
|
||||||
final receiveKey = GlobalKey<ExchangeCardState>();
|
final receiveKey = GlobalKey<ExchangeCardState>();
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
final _depositAmountFocus = FocusNode();
|
||||||
|
final _receiveAmountFocus = FocusNode();
|
||||||
var _isReactionsSet = false;
|
var _isReactionsSet = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -36,9 +42,6 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
@override
|
@override
|
||||||
Color get titleColor => Colors.white;
|
Color get titleColor => Colors.white;
|
||||||
|
|
||||||
@override
|
|
||||||
bool get resizeToAvoidBottomInset => false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get extendBodyBehindAppBar => true;
|
bool get extendBodyBehindAppBar => true;
|
||||||
|
|
||||||
|
@ -74,7 +77,22 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
WidgetsBinding.instance
|
WidgetsBinding.instance
|
||||||
.addPostFrameCallback((_) => _setReactions(context, exchangeViewModel));
|
.addPostFrameCallback((_) => _setReactions(context, exchangeViewModel));
|
||||||
|
|
||||||
return Container(
|
return KeyboardActions(
|
||||||
|
disableScroll: true,
|
||||||
|
config: KeyboardActionsConfig(
|
||||||
|
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||||
|
keyboardBarColor:
|
||||||
|
Theme.of(context).accentTextTheme.body2.backgroundColor,
|
||||||
|
nextFocus: false,
|
||||||
|
actions: [
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: _depositAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()]),
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: _receiveAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()])
|
||||||
|
]),
|
||||||
|
child: Container(
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
child: Form(
|
child: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
|
@ -121,6 +139,7 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
|
padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (_) => ExchangeCard(
|
builder: (_) => ExchangeCard(
|
||||||
|
amountFocusNode: _depositAmountFocus,
|
||||||
key: depositKey,
|
key: depositKey,
|
||||||
title: S.of(context).you_will_send,
|
title: S.of(context).you_will_send,
|
||||||
initialCurrency:
|
initialCurrency:
|
||||||
|
@ -160,6 +179,7 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (_) => ExchangeCard(
|
builder: (_) => ExchangeCard(
|
||||||
|
amountFocusNode: _receiveAmountFocus,
|
||||||
key: receiveKey,
|
key: receiveKey,
|
||||||
title: S.of(context).you_will_get,
|
title: S.of(context).you_will_get,
|
||||||
initialCurrency:
|
initialCurrency:
|
||||||
|
@ -244,6 +264,7 @@ class ExchangeTemplatePage extends BasePage {
|
||||||
textColor: Colors.white),
|
textColor: Colors.white),
|
||||||
]),
|
]),
|
||||||
))
|
))
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue