2021-01-07 12:19:21 +00:00
|
|
|
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
|
|
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
2020-07-27 17:07:37 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
|
|
|
|
import 'package:cake_wallet/routes.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2020-12-17 20:50:26 +00:00
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
2021-01-07 12:19:21 +00:00
|
|
|
import 'package:keyboard_actions/keyboard_actions.dart';
|
2020-07-27 17:07:37 +00:00
|
|
|
|
|
|
|
class AddressPage extends StatelessWidget {
|
2021-01-07 12:19:21 +00:00
|
|
|
AddressPage({@required this.addressListViewModel})
|
|
|
|
: _cryptoAmountFocus = FocusNode();
|
2020-07-27 17:07:37 +00:00
|
|
|
|
|
|
|
final WalletAddressListViewModel addressListViewModel;
|
|
|
|
|
2021-01-07 12:19:21 +00:00
|
|
|
final FocusNode _cryptoAmountFocus;
|
|
|
|
|
2020-07-27 17:07:37 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-01-07 12:19:21 +00:00
|
|
|
return KeyboardActions(
|
2021-01-11 17:15:27 +00:00
|
|
|
autoScroll: false,
|
|
|
|
disableScroll: true,
|
|
|
|
tapOutsideToDismiss: true,
|
2021-01-07 12:19:21 +00:00
|
|
|
config: KeyboardActionsConfig(
|
|
|
|
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
|
|
|
keyboardBarColor:
|
|
|
|
Theme.of(context).accentTextTheme.body2.backgroundColor,
|
|
|
|
nextFocus: false,
|
|
|
|
actions: [
|
|
|
|
KeyboardActionsItem(
|
|
|
|
focusNode: _cryptoAmountFocus,
|
|
|
|
toolbarButtons: [(_) => KeyboardDoneButton()],
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
child: Container(
|
|
|
|
height: 1,
|
|
|
|
padding: EdgeInsets.fromLTRB(24, 24, 24, 32),
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
child: Center(
|
|
|
|
child: QRWidget(
|
|
|
|
addressListViewModel: addressListViewModel,
|
|
|
|
amountTextFieldFocusNode: _cryptoAmountFocus,
|
|
|
|
isAmountFieldShow: !addressListViewModel.hasAccounts),
|
|
|
|
)),
|
|
|
|
addressListViewModel.hasAddressList
|
|
|
|
? GestureDetector(
|
|
|
|
onTap: () =>
|
|
|
|
Navigator.of(context).pushNamed(Routes.receive),
|
|
|
|
child: Container(
|
|
|
|
height: 50,
|
|
|
|
padding: EdgeInsets.only(left: 24, right: 12),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(25)),
|
|
|
|
border: Border.all(
|
|
|
|
color:
|
|
|
|
Theme.of(context).textTheme.subhead.color,
|
|
|
|
width: 1),
|
|
|
|
color: Theme.of(context).buttonColor),
|
|
|
|
child: Row(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Observer(
|
|
|
|
builder: (_) => Text(
|
|
|
|
addressListViewModel.hasAccounts
|
|
|
|
? S.of(context).accounts_subaddresses
|
|
|
|
: S.of(context).addresses,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor),
|
|
|
|
)),
|
|
|
|
Icon(
|
|
|
|
Icons.arrow_forward_ios,
|
|
|
|
size: 14,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: PrimaryButton(
|
|
|
|
onPressed: () => addressListViewModel.nextAddress(),
|
|
|
|
text: 'Next address',
|
|
|
|
color: Theme.of(context).buttonColor,
|
|
|
|
textColor: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
2020-07-27 17:07:37 +00:00
|
|
|
}
|
2020-12-17 13:39:21 +00:00
|
|
|
}
|