Moved currency piker button to the left side

This commit is contained in:
Serhii-Borodenko 2022-02-07 00:02:13 +02:00
parent d049579af0
commit ed0c43d864

View file

@ -158,91 +158,96 @@ class ExchangeCardState extends State<ExchangeCard> {
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Stack( child: Row(
children: <Widget>[ children: [
BaseTextFormField( Container(
focusNode: widget.amountFocusNode, padding: EdgeInsets.only(right: 8),
controller: amountController, height: 32,
enabled: _isAmountEditable, color: widget.currencyButtonColor,
textAlign: TextAlign.left, child: InkWell(
keyboardType: TextInputType.numberWithOptions( onTap: () => _presentPicker(context),
signed: false, decimal: true), child: Row(
inputFormatters: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]')) mainAxisSize: MainAxisSize.min,
], children: <Widget>[
hintText: '0.0000', Padding(
borderColor: widget.borderColor, padding: EdgeInsets.only(right: 5),
textStyle: TextStyle( child: widget.imageArrow,
fontSize: 16, ),
fontWeight: FontWeight.w600, Text(_selectedCurrency.toString() + ':',
color: Colors.white), style: TextStyle(
placeholderTextStyle: TextStyle( fontWeight: FontWeight.w600,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, color: Colors.white))
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: <Widget>[
Text(_selectedCurrency.toString(),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Colors.white)),
Padding(
padding: EdgeInsets.only(left: 5),
child: widget.imageArrow,
)
]),
),
), ),
), ),
if (widget.hasAllAmount) Expanded(
Positioned( child: Row(
top: 5, mainAxisAlignment: MainAxisAlignment.spaceBetween,
right: 55, children: [
child: Container( Flexible(
height: 32, child: BaseTextFormField(
width: 32, focusNode: widget.amountFocusNode,
margin: EdgeInsets.only(left: 14, top: 4, bottom: 10), controller: amountController,
decoration: BoxDecoration( enabled: _isAmountEditable,
color: Theme.of(context) textAlign: TextAlign.left,
.primaryTextTheme keyboardType: TextInputType.numberWithOptions(
.display1 signed: false, decimal: true),
.color, inputFormatters: [
borderRadius: BorderRadius.all(Radius.circular(6))), FilteringTextInputFormatter.deny(
child: InkWell( RegExp('[\\-|\\ ]'))
onTap: () => widget.allAmount?.call(), ],
child: Center( hintText: '0.0000',
child: Text(S.of(context).all, borderColor: Colors.transparent,
textAlign: TextAlign.center, //widget.borderColor,
style: TextStyle( textStyle: TextStyle(
fontSize: 12, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w600,
color: Theme.of(context) color: Colors.white),
.primaryTextTheme placeholderTextStyle: TextStyle(
.display1 fontSize: 16,
.decorationColor)), 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(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: Container( child: Container(
@ -298,126 +303,121 @@ class ExchangeCardState extends State<ExchangeCard> {
? Padding( ? Padding(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: AddressTextField( child: AddressTextField(
focusNode: widget.addressFocusNode, focusNode: widget.addressFocusNode,
controller: addressController, controller: addressController,
placeholder: widget.hasRefundAddress placeholder: widget.hasRefundAddress
? S.of(context).refund_address ? S.of(context).refund_address
: null, : null,
options: [ options: [
AddressTextFieldOption.paste, AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode, AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook, AddressTextFieldOption.addressBook,
], ],
isBorderExist: false, isBorderExist: false,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white), color: Colors.white),
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context) color: Theme.of(context)
.accentTextTheme .accentTextTheme
.display4 .display4
.decorationColor), .decorationColor),
buttonColor: widget.addressButtonsColor, buttonColor: widget.addressButtonsColor,
validator: widget.addressTextFieldValidator, validator: widget.addressTextFieldValidator,
onPushPasteButton: widget.onPushPasteButton, onPushPasteButton: widget.onPushPasteButton,
onPushAddressBookButton: widget.onPushAddressBookButton onPushAddressBookButton: widget.onPushAddressBookButton),
),
) )
: Padding( : Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: Builder( child: Builder(
builder: (context) => Stack( builder: (context) => Stack(children: <Widget>[
children: <Widget> [ BaseTextFormField(
BaseTextFormField( controller: addressController,
controller: addressController, readOnly: true,
readOnly: true, borderColor: Colors.transparent,
borderColor: Colors.transparent, suffixIcon:
suffixIcon: SizedBox( SizedBox(width: _isMoneroWallet ? 80 : 36),
width: _isMoneroWallet ? 80 : 36 textStyle: TextStyle(
), fontSize: 16,
textStyle: TextStyle( fontWeight: FontWeight.w600,
fontSize: 16, color: Colors.white),
fontWeight: FontWeight.w600, validator: widget.addressTextFieldValidator),
color: Colors.white), Positioned(
validator: widget.addressTextFieldValidator top: 2,
), right: 0,
Positioned( child: SizedBox(
top: 2, width: _isMoneroWallet ? 80 : 36,
right: 0, child: Row(children: <Widget>[
child: SizedBox( if (_isMoneroWallet)
width: _isMoneroWallet ? 80 : 36, Padding(
child: Row( padding: EdgeInsets.only(left: 10),
children: <Widget>[ child: Container(
if (_isMoneroWallet) Padding( width: 34,
padding: EdgeInsets.only(left: 10), height: 34,
child: Container( padding: EdgeInsets.only(top: 0),
width: 34, child: InkWell(
height: 34, onTap: () async {
padding: EdgeInsets.only(top: 0), final contact =
child: InkWell( await Navigator.of(context,
onTap: () async { rootNavigator: true)
final contact = await Navigator .pushNamed(Routes
.of(context, rootNavigator: true) .pickerAddressBook);
.pushNamed(
Routes.pickerAddressBook);
if (contact is ContactBase && if (contact is ContactBase &&
contact.address != null) { contact.address != null) {
setState(() => setState(() =>
addressController.text = addressController.text =
contact.address); contact.address);
widget.onPushAddressBookButton widget.onPushAddressBookButton
?.call(context); ?.call(context);
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget color: widget
.addressButtonsColor, .addressButtonsColor,
borderRadius: BorderRadius borderRadius:
.all(Radius.circular(6))), BorderRadius.all(
child: Image.asset( Radius.circular(
'assets/images/open_book.png', 6))),
color: Theme.of(context) child: Image.asset(
.primaryTextTheme 'assets/images/open_book.png',
.display1 color: Theme.of(context)
.decorationColor, .primaryTextTheme
)), .display1
)), .decorationColor,
), )),
Padding( )),
padding: EdgeInsets.only(left: 2), ),
child: Container( Padding(
width: 34, padding: EdgeInsets.only(left: 2),
height: 34, child: Container(
padding: EdgeInsets.only(top: 0), width: 34,
child: InkWell( height: 34,
onTap: () { padding: EdgeInsets.only(top: 0),
Clipboard.setData( child: InkWell(
ClipboardData( onTap: () {
text: addressController.text)); Clipboard.setData(ClipboardData(
showBar<void>( text: addressController
context, S.of(context) .text));
.copied_to_clipboard); showBar<void>(
}, context,
child: Container( S
padding: EdgeInsets .of(context)
.fromLTRB(8, 8, 0, 8), .copied_to_clipboard);
color: Colors.transparent, },
child: copyImage), child: Container(
)) padding: EdgeInsets.fromLTRB(
) 8, 8, 0, 8),
] color: Colors.transparent,
) child: copyImage),
) )))
) ])))
] ])),
)
),
), ),
]), ]),
); );