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,9 +158,36 @@ class ExchangeCardState extends State<ExchangeCard> {
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Stack( 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: <Widget>[ children: <Widget>[
BaseTextFormField( Padding(
padding: EdgeInsets.only(right: 5),
child: widget.imageArrow,
),
Text(_selectedCurrency.toString() + ':',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Colors.white))
]),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: BaseTextFormField(
focusNode: widget.amountFocusNode, focusNode: widget.amountFocusNode,
controller: amountController, controller: amountController,
enabled: _isAmountEditable, enabled: _isAmountEditable,
@ -168,10 +195,12 @@ class ExchangeCardState extends State<ExchangeCard> {
keyboardType: TextInputType.numberWithOptions( keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true), signed: false, decimal: true),
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]')) FilteringTextInputFormatter.deny(
RegExp('[\\-|\\ ]'))
], ],
hintText: '0.0000', hintText: '0.0000',
borderColor: widget.borderColor, borderColor: Colors.transparent,
//widget.borderColor,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -186,46 +215,18 @@ class ExchangeCardState extends State<ExchangeCard> {
validator: _isAmountEditable validator: _isAmountEditable
? widget.currencyValueValidator ? widget.currencyValueValidator
: null), : 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) if (widget.hasAllAmount)
Positioned( Container(
top: 5,
right: 55,
child: Container(
height: 32, height: 32,
width: 32, width: 32,
margin: EdgeInsets.only(left: 14, top: 4, bottom: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.display1 .display1
.color, .color,
borderRadius: BorderRadius.all(Radius.circular(6))), borderRadius:
BorderRadius.all(Radius.circular(6))),
child: InkWell( child: InkWell(
onTap: () => widget.allAmount?.call(), onTap: () => widget.allAmount?.call(),
child: Center( child: Center(
@ -240,9 +241,13 @@ class ExchangeCardState extends State<ExchangeCard> {
.decorationColor)), .decorationColor)),
), ),
), ),
)) )
],
),
),
], ],
)), )),
Divider(height: 1),
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: Container( child: Container(
@ -323,35 +328,31 @@ class ExchangeCardState extends State<ExchangeCard> {
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: SizedBox( suffixIcon:
width: _isMoneroWallet ? 80 : 36 SizedBox(width: _isMoneroWallet ? 80 : 36),
),
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white), color: Colors.white),
validator: widget.addressTextFieldValidator validator: widget.addressTextFieldValidator),
),
Positioned( Positioned(
top: 2, top: 2,
right: 0, right: 0,
child: SizedBox( child: SizedBox(
width: _isMoneroWallet ? 80 : 36, width: _isMoneroWallet ? 80 : 36,
child: Row( child: Row(children: <Widget>[
children: <Widget>[ if (_isMoneroWallet)
if (_isMoneroWallet) Padding( Padding(
padding: EdgeInsets.only(left: 10), padding: EdgeInsets.only(left: 10),
child: Container( child: Container(
width: 34, width: 34,
@ -359,10 +360,11 @@ class ExchangeCardState extends State<ExchangeCard> {
padding: EdgeInsets.only(top: 0), padding: EdgeInsets.only(top: 0),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
final contact = await Navigator final contact =
.of(context, rootNavigator: true) await Navigator.of(context,
.pushNamed( rootNavigator: true)
Routes.pickerAddressBook); .pushNamed(Routes
.pickerAddressBook);
if (contact is ContactBase && if (contact is ContactBase &&
contact.address != null) { contact.address != null) {
@ -378,8 +380,10 @@ class ExchangeCardState extends State<ExchangeCard> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget color: widget
.addressButtonsColor, .addressButtonsColor,
borderRadius: BorderRadius borderRadius:
.all(Radius.circular(6))), BorderRadius.all(
Radius.circular(
6))),
child: Image.asset( child: Image.asset(
'assets/images/open_book.png', 'assets/images/open_book.png',
color: Theme.of(context) color: Theme.of(context)
@ -397,27 +401,23 @@ class ExchangeCardState extends State<ExchangeCard> {
padding: EdgeInsets.only(top: 0), padding: EdgeInsets.only(top: 0),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Clipboard.setData( Clipboard.setData(ClipboardData(
ClipboardData( text: addressController
text: addressController.text)); .text));
showBar<void>( showBar<void>(
context, S.of(context) context,
S
.of(context)
.copied_to_clipboard); .copied_to_clipboard);
}, },
child: Container( child: Container(
padding: EdgeInsets padding: EdgeInsets.fromLTRB(
.fromLTRB(8, 8, 0, 8), 8, 8, 0, 8),
color: Colors.transparent, color: Colors.transparent,
child: copyImage), child: copyImage),
)) )))
) ])))
] ])),
)
)
)
]
)
),
), ),
]), ]),
); );