Moved currency piker button to the left side
Serhii-Borodenko committed
Feb 7, 2022 at 00:02 UTC
ed0c43d864ddafed78a5c361614517e4ab6bf063
1 file changed
+195
-195
lib/src/screens/exchange/widgets/exchange_card.dart
+195
-195
@@ -158,91 +158,96 @@ class ExchangeCardState extends State<ExchangeCard> {
158
),
159
Padding(
160
padding: EdgeInsets.only(top: 20),
161
- child: Stack(
162
- children: <Widget>[
163
- BaseTextFormField(
164
- focusNode: widget.amountFocusNode,
165
- controller: amountController,
166
- enabled: _isAmountEditable,
167
- textAlign: TextAlign.left,
168
- keyboardType: TextInputType.numberWithOptions(
169
- signed: false, decimal: true),
170
- inputFormatters: [
171
- FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
172
- ],
173
- hintText: '0.0000',
174
- borderColor: widget.borderColor,
175
- textStyle: TextStyle(
176
- fontSize: 16,
177
- fontWeight: FontWeight.w600,
178
- color: Colors.white),
179
- placeholderTextStyle: TextStyle(
180
- fontSize: 16,
181
- fontWeight: FontWeight.w600,
182
- color: Theme.of(context)
183
- .accentTextTheme
184
- .display4
185
- .decorationColor),
186
- validator: _isAmountEditable
187
- ? widget.currencyValueValidator
188
- : null),
189
- Positioned(
190
- top: 8,
191
- right: 0,
192
- child: Container(
193
- height: 32,
194
- padding: EdgeInsets.only(left: 10),
195
- color: widget.currencyButtonColor,
196
- child: InkWell(
197
- onTap: () => _presentPicker(context),
198
- child: Row(
199
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
200
- mainAxisSize: MainAxisSize.min,
201
- children: <Widget>[
202
- Text(_selectedCurrency.toString(),
203
- style: TextStyle(
204
- fontWeight: FontWeight.w600,
205
- fontSize: 16,
206
- color: Colors.white)),
207
- Padding(
208
- padding: EdgeInsets.only(left: 5),
209
- child: widget.imageArrow,
210
- )
211
- ]),
212
- ),
161
+ child: Row(
162
+ children: [
163
+ Container(
164
+ padding: EdgeInsets.only(right: 8),
165
+ height: 32,
166
+ color: widget.currencyButtonColor,
167
+ child: InkWell(
168
+ onTap: () => _presentPicker(context),
169
+ child: Row(
170
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
171
+ mainAxisSize: MainAxisSize.min,
172
+ children: <Widget>[
173
+ Padding(
174
+ padding: EdgeInsets.only(right: 5),
175
+ child: widget.imageArrow,
176
+ ),
177
+ Text(_selectedCurrency.toString() + ':',
178
+ style: TextStyle(
179
+ fontWeight: FontWeight.w600,
180
+ fontSize: 16,
181
+ color: Colors.white))
182
+ ]),
183
),
184
),
215
- if (widget.hasAllAmount)
216
- Positioned(
217
- top: 5,
218
- right: 55,
219
- child: Container(
220
- height: 32,
221
- width: 32,
222
- margin: EdgeInsets.only(left: 14, top: 4, bottom: 10),
223
- decoration: BoxDecoration(
224
- color: Theme.of(context)
225
- .primaryTextTheme
226
- .display1
227
- .color,
228
- borderRadius: BorderRadius.all(Radius.circular(6))),
229
- child: InkWell(
230
- onTap: () => widget.allAmount?.call(),
231
- child: Center(
232
- child: Text(S.of(context).all,
233
- textAlign: TextAlign.center,
234
- style: TextStyle(
235
- fontSize: 12,
236
- fontWeight: FontWeight.bold,
237
- color: Theme.of(context)
238
- .primaryTextTheme
239
- .display1
240
- .decorationColor)),
185
+ Expanded(
186
+ child: Row(
187
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
188
+ children: [
189
+ Flexible(
190
+ child: BaseTextFormField(
191
+ focusNode: widget.amountFocusNode,
192
+ controller: amountController,
193
+ enabled: _isAmountEditable,
194
+ textAlign: TextAlign.left,
195
+ keyboardType: TextInputType.numberWithOptions(
196
+ signed: false, decimal: true),
197
+ inputFormatters: [
198
+ FilteringTextInputFormatter.deny(
199
+ RegExp('[\\-|\\ ]'))
200
+ ],
201
+ hintText: '0.0000',
202
+ borderColor: Colors.transparent,
203
+ //widget.borderColor,
204
+ textStyle: TextStyle(
205
+ fontSize: 16,
206
+ fontWeight: FontWeight.w600,
207
+ color: Colors.white),
208
+ placeholderTextStyle: TextStyle(
209
+ fontSize: 16,
210
+ fontWeight: FontWeight.w600,
211
+ color: Theme.of(context)
212
+ .accentTextTheme
213
+ .display4
214
+ .decorationColor),
215
+ validator: _isAmountEditable
216
+ ? widget.currencyValueValidator
217
+ : null),
218
+ ),
219
+ if (widget.hasAllAmount)
220
+ Container(
221
+ height: 32,
222
+ width: 32,
223
+ decoration: BoxDecoration(
224
+ color: Theme.of(context)
225
+ .primaryTextTheme
226
+ .display1
227
+ .color,
228
+ borderRadius:
229
+ BorderRadius.all(Radius.circular(6))),
230
+ child: InkWell(
231
+ onTap: () => widget.allAmount?.call(),
232
+ child: Center(
233
+ child: Text(S.of(context).all,
234
+ textAlign: TextAlign.center,
235
+ style: TextStyle(
236
+ fontSize: 12,
237
+ fontWeight: FontWeight.bold,
238
+ color: Theme.of(context)
239
+ .primaryTextTheme
240
+ .display1
241
+ .decorationColor)),
242
+ ),
243
),
242
- ),
243
- ))
244
+ )
245
+ ],
246
+ ),
247
+ ),
248
],
249
)),
250
+ Divider(height: 1),
251
Padding(
252
padding: EdgeInsets.only(top: 5),
253
child: Container(
@@ -298,126 +303,121 @@ class ExchangeCardState extends State<ExchangeCard> {
303
? Padding(
304
padding: EdgeInsets.only(top: 20),
305
child: AddressTextField(
301
- focusNode: widget.addressFocusNode,
302
- controller: addressController,
303
- placeholder: widget.hasRefundAddress
304
- ? S.of(context).refund_address
305
- : null,
306
- options: [
307
- AddressTextFieldOption.paste,
308
- AddressTextFieldOption.qrCode,
309
- AddressTextFieldOption.addressBook,
310
- ],
311
- isBorderExist: false,
312
- textStyle: TextStyle(
313
- fontSize: 16,
314
- fontWeight: FontWeight.w600,
315
- color: Colors.white),
316
- hintStyle: TextStyle(
317
- fontSize: 16,
318
- fontWeight: FontWeight.w600,
319
- color: Theme.of(context)
320
- .accentTextTheme
321
- .display4
322
- .decorationColor),
323
- buttonColor: widget.addressButtonsColor,
324
- validator: widget.addressTextFieldValidator,
325
- onPushPasteButton: widget.onPushPasteButton,
326
- onPushAddressBookButton: widget.onPushAddressBookButton
327
- ),
306
+ focusNode: widget.addressFocusNode,
307
+ controller: addressController,
308
+ placeholder: widget.hasRefundAddress
309
+ ? S.of(context).refund_address
310
+ : null,
311
+ options: [
312
+ AddressTextFieldOption.paste,
313
+ AddressTextFieldOption.qrCode,
314
+ AddressTextFieldOption.addressBook,
315
+ ],
316
+ isBorderExist: false,
317
+ textStyle: TextStyle(
318
+ fontSize: 16,
319
+ fontWeight: FontWeight.w600,
320
+ color: Colors.white),
321
+ hintStyle: TextStyle(
322
+ fontSize: 16,
323
+ fontWeight: FontWeight.w600,
324
+ color: Theme.of(context)
325
+ .accentTextTheme
326
+ .display4
327
+ .decorationColor),
328
+ buttonColor: widget.addressButtonsColor,
329
+ validator: widget.addressTextFieldValidator,
330
+ onPushPasteButton: widget.onPushPasteButton,
331
+ onPushAddressBookButton: widget.onPushAddressBookButton),
332
)
333
: Padding(
334
padding: EdgeInsets.only(top: 10),
335
child: Builder(
332
- builder: (context) => Stack(
333
- children: <Widget> [
334
- BaseTextFormField(
335
- controller: addressController,
336
- readOnly: true,
337
- borderColor: Colors.transparent,
338
- suffixIcon: SizedBox(
339
- width: _isMoneroWallet ? 80 : 36
340
- ),
341
- textStyle: TextStyle(
342
- fontSize: 16,
343
- fontWeight: FontWeight.w600,
344
- color: Colors.white),
345
- validator: widget.addressTextFieldValidator
346
- ),
347
- Positioned(
348
- top: 2,
349
- right: 0,
350
- child: SizedBox(
351
- width: _isMoneroWallet ? 80 : 36,
352
- child: Row(
353
- children: <Widget>[
354
- if (_isMoneroWallet) Padding(
355
- padding: EdgeInsets.only(left: 10),
356
- child: Container(
357
- width: 34,
358
- height: 34,
359
- padding: EdgeInsets.only(top: 0),
360
- child: InkWell(
361
- onTap: () async {
362
- final contact = await Navigator
363
- .of(context, rootNavigator: true)
364
- .pushNamed(
365
- Routes.pickerAddressBook);
336
+ builder: (context) => Stack(children: <Widget>[
337
+ BaseTextFormField(
338
+ controller: addressController,
339
+ readOnly: true,
340
+ borderColor: Colors.transparent,
341
+ suffixIcon:
342
+ SizedBox(width: _isMoneroWallet ? 80 : 36),
343
+ textStyle: TextStyle(
344
+ fontSize: 16,
345
+ fontWeight: FontWeight.w600,
346
+ color: Colors.white),
347
+ validator: widget.addressTextFieldValidator),
348
+ Positioned(
349
+ top: 2,
350
+ right: 0,
351
+ child: SizedBox(
352
+ width: _isMoneroWallet ? 80 : 36,
353
+ child: Row(children: <Widget>[
354
+ if (_isMoneroWallet)
355
+ Padding(
356
+ padding: EdgeInsets.only(left: 10),
357
+ child: Container(
358
+ width: 34,
359
+ height: 34,
360
+ padding: EdgeInsets.only(top: 0),
361
+ child: InkWell(
362
+ onTap: () async {
363
+ final contact =
364
+ await Navigator.of(context,
365
+ rootNavigator: true)
366
+ .pushNamed(Routes
367
+ .pickerAddressBook);
368
367
- if (contact is ContactBase &&
368
- contact.address != null) {
369
- setState(() =>
370
- addressController.text =
371
- contact.address);
372
- widget.onPushAddressBookButton
373
- ?.call(context);
374
- }
375
- },
376
- child: Container(
377
- padding: EdgeInsets.all(8),
378
- decoration: BoxDecoration(
379
- color: widget
380
- .addressButtonsColor,
381
- borderRadius: BorderRadius
382
- .all(Radius.circular(6))),
383
- child: Image.asset(
384
- 'assets/images/open_book.png',
385
- color: Theme.of(context)
386
- .primaryTextTheme
387
- .display1
388
- .decorationColor,
389
- )),
390
- )),
391
- ),
392
- Padding(
393
- padding: EdgeInsets.only(left: 2),
394
- child: Container(
395
- width: 34,
396
- height: 34,
397
- padding: EdgeInsets.only(top: 0),
398
- child: InkWell(
399
- onTap: () {
400
- Clipboard.setData(
401
- ClipboardData(
402
- text: addressController.text));
403
- showBar<void>(
404
- context, S.of(context)
405
- .copied_to_clipboard);
406
- },
407
- child: Container(
408
- padding: EdgeInsets
409
- .fromLTRB(8, 8, 0, 8),
410
- color: Colors.transparent,
411
- child: copyImage),
412
- ))
413
- )
414
- ]
415
- )
416
- )
417
- )
418
- ]
419
- )
420
- ),
369
+ if (contact is ContactBase &&
370
+ contact.address != null) {
371
+ setState(() =>
372
+ addressController.text =
373
+ contact.address);
374
+ widget.onPushAddressBookButton
375
+ ?.call(context);
376
+ }
377
+ },
378
+ child: Container(
379
+ padding: EdgeInsets.all(8),
380
+ decoration: BoxDecoration(
381
+ color: widget
382
+ .addressButtonsColor,
383
+ borderRadius:
384
+ BorderRadius.all(
385
+ Radius.circular(
386
+ 6))),
387
+ child: Image.asset(
388
+ 'assets/images/open_book.png',
389
+ color: Theme.of(context)
390
+ .primaryTextTheme
391
+ .display1
392
+ .decorationColor,
393
+ )),
394
+ )),
395
+ ),
396
+ Padding(
397
+ padding: EdgeInsets.only(left: 2),
398
+ child: Container(
399
+ width: 34,
400
+ height: 34,
401
+ padding: EdgeInsets.only(top: 0),
402
+ child: InkWell(
403
+ onTap: () {
404
+ Clipboard.setData(ClipboardData(
405
+ text: addressController
406
+ .text));
407
+ showBar<void>(
408
+ context,
409
+ S
410
+ .of(context)
411
+ .copied_to_clipboard);
412
+ },
413
+ child: Container(
414
+ padding: EdgeInsets.fromLTRB(
415
+ 8, 8, 0, 8),
416
+ color: Colors.transparent,
417
+ child: copyImage),
418
+ )))
419
+ ])))
420
+ ])),
421
),
422
]),
423
);