From ed0c43d864ddafed78a5c361614517e4ab6bf063 Mon Sep 17 00:00:00 2001 From: Serhii-Borodenko Date: Mon, 7 Feb 2022 00:02:13 +0200 Subject: [PATCH] Moved currency piker button to the left side --- .../exchange/widgets/exchange_card.dart | 390 +++++++++--------- 1 file changed, 195 insertions(+), 195 deletions(-) diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 0a5580625..c597694cc 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -158,91 +158,96 @@ class ExchangeCardState extends State { ), Padding( padding: EdgeInsets.only(top: 20), - child: Stack( - children: [ - BaseTextFormField( - focusNode: widget.amountFocusNode, - controller: amountController, - enabled: _isAmountEditable, - textAlign: TextAlign.left, - keyboardType: TextInputType.numberWithOptions( - signed: false, decimal: true), - inputFormatters: [ - FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]')) - ], - hintText: '0.0000', - borderColor: widget.borderColor, - textStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Colors.white), - placeholderTextStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Theme.of(context) - .accentTextTheme - .display4 - .decorationColor), - validator: _isAmountEditable - ? widget.currencyValueValidator - : null), - Positioned( - top: 8, - right: 0, - child: Container( - height: 32, - padding: EdgeInsets.only(left: 10), - color: widget.currencyButtonColor, - child: InkWell( - onTap: () => _presentPicker(context), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.min, - children: [ - Text(_selectedCurrency.toString(), - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16, - color: Colors.white)), - Padding( - padding: EdgeInsets.only(left: 5), - child: widget.imageArrow, - ) - ]), - ), + child: Row( + children: [ + Container( + padding: EdgeInsets.only(right: 8), + height: 32, + color: widget.currencyButtonColor, + child: InkWell( + onTap: () => _presentPicker(context), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.only(right: 5), + child: widget.imageArrow, + ), + Text(_selectedCurrency.toString() + ':', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + color: Colors.white)) + ]), ), ), - if (widget.hasAllAmount) - Positioned( - top: 5, - right: 55, - child: Container( - height: 32, - width: 32, - margin: EdgeInsets.only(left: 14, top: 4, bottom: 10), - decoration: BoxDecoration( - color: Theme.of(context) - .primaryTextTheme - .display1 - .color, - borderRadius: BorderRadius.all(Radius.circular(6))), - child: InkWell( - onTap: () => widget.allAmount?.call(), - child: Center( - child: Text(S.of(context).all, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context) - .primaryTextTheme - .display1 - .decorationColor)), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: BaseTextFormField( + focusNode: widget.amountFocusNode, + controller: amountController, + enabled: _isAmountEditable, + textAlign: TextAlign.left, + keyboardType: TextInputType.numberWithOptions( + signed: false, decimal: true), + inputFormatters: [ + FilteringTextInputFormatter.deny( + RegExp('[\\-|\\ ]')) + ], + hintText: '0.0000', + borderColor: Colors.transparent, + //widget.borderColor, + textStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Colors.white), + placeholderTextStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Theme.of(context) + .accentTextTheme + .display4 + .decorationColor), + validator: _isAmountEditable + ? widget.currencyValueValidator + : null), + ), + if (widget.hasAllAmount) + Container( + height: 32, + width: 32, + decoration: BoxDecoration( + color: Theme.of(context) + .primaryTextTheme + .display1 + .color, + borderRadius: + BorderRadius.all(Radius.circular(6))), + child: InkWell( + onTap: () => widget.allAmount?.call(), + child: Center( + child: Text(S.of(context).all, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor)), + ), ), - ), - )) + ) + ], + ), + ), ], )), + Divider(height: 1), Padding( padding: EdgeInsets.only(top: 5), child: Container( @@ -298,126 +303,121 @@ class ExchangeCardState extends State { ? Padding( padding: EdgeInsets.only(top: 20), child: AddressTextField( - focusNode: widget.addressFocusNode, - controller: addressController, - placeholder: widget.hasRefundAddress - ? S.of(context).refund_address - : null, - options: [ - AddressTextFieldOption.paste, - AddressTextFieldOption.qrCode, - AddressTextFieldOption.addressBook, - ], - isBorderExist: false, - textStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Colors.white), - hintStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Theme.of(context) - .accentTextTheme - .display4 - .decorationColor), - buttonColor: widget.addressButtonsColor, - validator: widget.addressTextFieldValidator, - onPushPasteButton: widget.onPushPasteButton, - onPushAddressBookButton: widget.onPushAddressBookButton - ), + focusNode: widget.addressFocusNode, + controller: addressController, + placeholder: widget.hasRefundAddress + ? S.of(context).refund_address + : null, + options: [ + AddressTextFieldOption.paste, + AddressTextFieldOption.qrCode, + AddressTextFieldOption.addressBook, + ], + isBorderExist: false, + textStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Colors.white), + hintStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Theme.of(context) + .accentTextTheme + .display4 + .decorationColor), + buttonColor: widget.addressButtonsColor, + validator: widget.addressTextFieldValidator, + onPushPasteButton: widget.onPushPasteButton, + onPushAddressBookButton: widget.onPushAddressBookButton), ) : Padding( padding: EdgeInsets.only(top: 10), child: Builder( - builder: (context) => Stack( - children: [ - BaseTextFormField( - controller: addressController, - readOnly: true, - borderColor: Colors.transparent, - suffixIcon: SizedBox( - width: _isMoneroWallet ? 80 : 36 - ), - textStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Colors.white), - validator: widget.addressTextFieldValidator - ), - Positioned( - top: 2, - right: 0, - child: SizedBox( - width: _isMoneroWallet ? 80 : 36, - child: Row( - children: [ - if (_isMoneroWallet) Padding( - padding: EdgeInsets.only(left: 10), - child: Container( - width: 34, - height: 34, - padding: EdgeInsets.only(top: 0), - child: InkWell( - onTap: () async { - final contact = await Navigator - .of(context, rootNavigator: true) - .pushNamed( - Routes.pickerAddressBook); + builder: (context) => Stack(children: [ + BaseTextFormField( + controller: addressController, + readOnly: true, + borderColor: Colors.transparent, + suffixIcon: + SizedBox(width: _isMoneroWallet ? 80 : 36), + textStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Colors.white), + validator: widget.addressTextFieldValidator), + Positioned( + top: 2, + right: 0, + child: SizedBox( + width: _isMoneroWallet ? 80 : 36, + child: Row(children: [ + if (_isMoneroWallet) + Padding( + padding: EdgeInsets.only(left: 10), + child: Container( + width: 34, + height: 34, + padding: EdgeInsets.only(top: 0), + child: InkWell( + onTap: () async { + final contact = + await Navigator.of(context, + rootNavigator: true) + .pushNamed(Routes + .pickerAddressBook); - if (contact is ContactBase && - contact.address != null) { - setState(() => - addressController.text = - contact.address); - widget.onPushAddressBookButton - ?.call(context); - } - }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - color: widget - .addressButtonsColor, - borderRadius: BorderRadius - .all(Radius.circular(6))), - child: Image.asset( - 'assets/images/open_book.png', - color: Theme.of(context) - .primaryTextTheme - .display1 - .decorationColor, - )), - )), - ), - Padding( - padding: EdgeInsets.only(left: 2), - child: Container( - width: 34, - height: 34, - padding: EdgeInsets.only(top: 0), - child: InkWell( - onTap: () { - Clipboard.setData( - ClipboardData( - text: addressController.text)); - showBar( - context, S.of(context) - .copied_to_clipboard); - }, - child: Container( - padding: EdgeInsets - .fromLTRB(8, 8, 0, 8), - color: Colors.transparent, - child: copyImage), - )) - ) - ] - ) - ) - ) - ] - ) - ), + if (contact is ContactBase && + contact.address != null) { + setState(() => + addressController.text = + contact.address); + widget.onPushAddressBookButton + ?.call(context); + } + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: widget + .addressButtonsColor, + borderRadius: + BorderRadius.all( + Radius.circular( + 6))), + child: Image.asset( + 'assets/images/open_book.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor, + )), + )), + ), + Padding( + padding: EdgeInsets.only(left: 2), + child: Container( + width: 34, + height: 34, + padding: EdgeInsets.only(top: 0), + child: InkWell( + onTap: () { + Clipboard.setData(ClipboardData( + text: addressController + .text)); + showBar( + context, + S + .of(context) + .copied_to_clipboard); + }, + child: Container( + padding: EdgeInsets.fromLTRB( + 8, 8, 0, 8), + color: Colors.transparent, + child: copyImage), + ))) + ]))) + ])), ), ]), );