Exchange screens access improvements (#409)
* move tag prop to the crypto currency * add currency icons
Serhii committed
Jul 11, 2022 at 18:20 UTC
52b8bafac9baa98c874f1b64c74963918564885c
10 files changed
+237
-265
assets/images/zaddr_icon.png
Binary files /dev/null and b/assets/images/zaddr_icon.png differ
assets/images/zec_icon.png
Binary files /dev/null and b/assets/images/zec_icon.png differ
cw_core/lib/crypto_currency.dart
+49
-32
@@ -5,9 +5,13 @@ part 'crypto_currency.g.dart';
5
6
@HiveType(typeId: 0)
7
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
8
- const CryptoCurrency({final String title, final int raw})
8
+ const CryptoCurrency({final String title, this.tag, this.name, this.iconPath, final int raw})
9
: super(title: title, raw: raw);
10
11
+ final String tag;
12
+ final String name;
13
+ final String iconPath;
14
+
15
static const all = [
16
CryptoCurrency.xmr,
17
CryptoCurrency.ada,
@@ -24,39 +28,44 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
28
CryptoCurrency.usdterc20,
29
CryptoCurrency.xlm,
30
CryptoCurrency.xrp,
27
- CryptoCurrency.xhv
31
+ CryptoCurrency.xhv,
32
+ CryptoCurrency.zaddr,
33
+ CryptoCurrency.zec
34
];
29
- static const xmr = CryptoCurrency(title: 'XMR', raw: 0);
30
- static const ada = CryptoCurrency(title: 'ADA', raw: 1);
31
- static const bch = CryptoCurrency(title: 'BCH', raw: 2);
32
- static const bnb = CryptoCurrency(title: 'BNB BEP2', raw: 3);
33
- static const btc = CryptoCurrency(title: 'BTC', raw: 4);
34
- static const dai = CryptoCurrency(title: 'DAI', raw: 5);
35
- static const dash = CryptoCurrency(title: 'DASH', raw: 6);
36
- static const eos = CryptoCurrency(title: 'EOS', raw: 7);
37
- static const eth = CryptoCurrency(title: 'ETH', raw: 8);
38
- static const ltc = CryptoCurrency(title: 'LTC', raw: 9);
35
+ static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
36
+ static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', name: 'Cardano', raw: 1);
37
+ static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',name: 'Bitcoin Cash', raw: 2);
38
+ static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', name: 'Binance Coin', raw: 3);
39
+ static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', name: 'Bitcoin', raw: 4);
40
+ static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', name: 'Dai', raw: 5);
41
+ static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', name: 'Dash', raw: 6);
42
+ static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', name: 'EOS', raw: 7);
43
+ static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', name: 'Ethereum', raw: 8);
44
+ static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin',raw: 9);
45
static const nano = CryptoCurrency(title: 'NANO', raw: 10);
40
- static const trx = CryptoCurrency(title: 'TRX', raw: 11);
41
- static const usdt = CryptoCurrency(title: 'USDT', raw: 12);
42
- static const usdterc20 = CryptoCurrency(title: 'USDTERC20', raw: 13);
43
- static const xlm = CryptoCurrency(title: 'XLM', raw: 14);
44
- static const xrp = CryptoCurrency(title: 'XRP', raw: 15);
45
- static const xhv = CryptoCurrency(title: 'XHV', raw: 16);
46
-
47
- static const xag = CryptoCurrency(title: 'XAG', raw: 17);
48
- static const xau = CryptoCurrency(title: 'XAU', raw: 18);
49
- static const xaud = CryptoCurrency(title: 'XAUD', raw: 19);
50
- static const xbtc = CryptoCurrency(title: 'XBTC', raw: 20);
51
- static const xcad = CryptoCurrency(title: 'XCAD', raw: 21);
52
- static const xchf = CryptoCurrency(title: 'XCHF', raw: 22);
53
- static const xcny = CryptoCurrency(title: 'XCNY', raw: 23);
54
- static const xeur = CryptoCurrency(title: 'XEUR', raw: 24);
55
- static const xgbp = CryptoCurrency(title: 'XGBP', raw: 25);
56
- static const xjpy = CryptoCurrency(title: 'XJPY', raw: 26);
57
- static const xnok = CryptoCurrency(title: 'XNOK', raw: 27);
58
- static const xnzd = CryptoCurrency(title: 'XNZD', raw: 28);
59
- static const xusd = CryptoCurrency(title: 'XUSD', raw: 29);
46
+ static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', name: 'TRON', raw: 11);
47
+ static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', name: 'USDT', raw: 12);
48
+ static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', name: 'USDT', raw: 13);
49
+ static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', name: 'Stellar', raw: 14);
50
+ static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', name: 'Ripple', raw: 15);
51
+ static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', name: 'Haven Protocol', raw: 16);
52
+
53
+ static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17);
54
+ static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18);
55
+ static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19);
56
+ static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20);
57
+ static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21);
58
+ static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22);
59
+ static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23);
60
+ static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24);
61
+ static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25);
62
+ static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26);
63
+ static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27);
64
+ static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28);
65
+ static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29);
66
+
67
+ static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 30);
68
+ static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 31);
69
70
static CryptoCurrency deserialize({int raw}) {
71
switch (raw) {
@@ -120,6 +129,10 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
129
return CryptoCurrency.xnzd;
130
case 29:
131
return CryptoCurrency.xusd;
132
+ case 30:
133
+ return CryptoCurrency.zaddr;
134
+ case 31:
135
+ return CryptoCurrency.zec;
136
default:
137
return null;
138
}
@@ -187,6 +200,10 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
200
return CryptoCurrency.xnzd;
201
case 'xusd':
202
return CryptoCurrency.xusd;
203
+ case 'zaddr':
204
+ return CryptoCurrency.zaddr;
205
+ case 'zec':
206
+ return CryptoCurrency.zec;
207
default:
208
return null;
209
}
lib/exchange/changenow/changenow_exchange_provider.dart
+8
-18
@@ -240,33 +240,23 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
240
}
241
242
String networkFor(CryptoCurrency currency) {
243
- const bnbTitle = 'bnb';
244
-
243
switch (currency) {
244
case CryptoCurrency.usdt:
245
return CryptoCurrency.btc.title.toLowerCase();
248
- case CryptoCurrency.usdterc20:
249
- return CryptoCurrency.eth.title.toLowerCase();
250
- case CryptoCurrency.bnb:
251
- return bnbTitle;
252
- case CryptoCurrency.dai:
253
- return CryptoCurrency.eth.title.toLowerCase();
246
default:
255
- return currency.title.toLowerCase();
247
+ return currency.tag != null
248
+ ? currency.tag.toLowerCase()
249
+ : currency.title.toLowerCase();
250
+ }
251
}
252
}
253
259
- static String normalizeCryptoCurrency(CryptoCurrency currency) {
260
- const bnbTitle = 'bnb';
261
-
262
- switch(currency) {
263
- case CryptoCurrency.bnb:
264
- return bnbTitle;
265
- case CryptoCurrency.usdterc20:
266
- return CryptoCurrency.usdt.title.toLowerCase();
254
+ String normalizeCryptoCurrency(CryptoCurrency currency) {
255
+ switch(currency) {
256
+ case CryptoCurrency.zec:
257
+ return 'zec';
258
default:
259
return currency.title.toLowerCase();
260
}
261
262
}
272
-}
lib/exchange/sideshift/sideshift_exchange_provider.dart
+6
-5
@@ -250,14 +250,15 @@ class SideShiftExchangeProvider extends ExchangeProvider {
250
String get title => 'SideShift';
251
252
static String normalizeCryptoCurrency(CryptoCurrency currency) {
253
- const bnbTitle = 'bsc';
254
- const usdterc20 = 'usdtErc20';
255
-
253
switch (currency) {
254
+ case CryptoCurrency.zaddr:
255
+ return 'zaddr';
256
+ case CryptoCurrency.zec:
257
+ return 'zec';
258
case CryptoCurrency.bnb:
258
- return bnbTitle;
259
+ return currency.tag.toLowerCase();
260
case CryptoCurrency.usdterc20:
260
- return usdterc20;
261
+ return 'usdtErc20';
262
default:
263
return currency.title.toLowerCase();
264
}
lib/src/screens/exchange/widgets/currency_picker.dart
+18
-31
@@ -1,6 +1,5 @@
1
import 'dart:ui';
2
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker_item_widget.dart';
3
-import 'package:cake_wallet/src/screens/exchange/widgets/currency_utils.dart';
3
import 'package:cake_wallet/src/screens/exchange/widgets/picker_item.dart';
4
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
5
import 'package:flutter/cupertino.dart';
@@ -35,45 +34,33 @@ class CurrencyPickerState extends State<CurrencyPicker> {
34
CurrencyPickerState(this.items)
35
: isSearchBarActive = false,
36
textFieldValue = '',
38
- subPickerItemsList = [],
37
+ subPickerItemsList = items,
38
appBarTextStyle =
40
- TextStyle(fontSize: 20, fontFamily: 'Lato', backgroundColor: Colors.transparent, color: Colors.white);
39
+ TextStyle(fontSize: 20, fontFamily: 'Lato', backgroundColor: Colors.transparent, color: Colors.white);
40
+
41
42
- @override
43
- void initState() {
44
- pickerItemsList = CryptoCurrency.all
45
- .map((CryptoCurrency cur) => PickerItem<CryptoCurrency>(cur,
46
- title: CurrencyUtils.titleForCurrency(cur),
47
- iconPath: CurrencyUtils.iconPathForCurrency(cur),
48
- tag: CurrencyUtils.tagForCurrency(cur),
49
- description: CurrencyUtils.descriptionForCurrency(cur)))
50
- .toList();
51
- cleanSubPickerItemsList();
52
- super.initState();
53
- }
42
43
List<PickerItem<CryptoCurrency>> pickerItemsList;
44
List<CryptoCurrency> items;
45
bool isSearchBarActive;
46
String textFieldValue;
59
- List<PickerItem<CryptoCurrency>> subPickerItemsList;
47
+ List<CryptoCurrency> subPickerItemsList;
48
TextStyle appBarTextStyle;
49
62
- void cleanSubPickerItemsList() {
63
- subPickerItemsList = pickerItemsList.where((element) => items.contains(element.original)).toList();
64
- }
50
+ void cleanSubPickerItemsList() => subPickerItemsList = items;
51
66
- void currencySearchBySubstring(String subString, List<PickerItem<CryptoCurrency>> list) {
52
+ void currencySearchBySubstring(String subString) {
53
setState(() {
54
if (subString.isNotEmpty) {
69
- subPickerItemsList = subPickerItemsList
55
+ subPickerItemsList = items
56
.where((element) =>
71
- element.title.contains(subString.toUpperCase()) ||
72
- element.description.contains(subString.toLowerCase()))
57
+ (element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) ||
58
+ (element.tag != null ? element.tag.toLowerCase().contains(subString.toLowerCase()) : false) ||
59
+ (element.name != null ? element.name.toLowerCase().contains(subString.toLowerCase()) : false))
60
.toList();
74
- } else {
75
- cleanSubPickerItemsList();
61
+ return;
62
}
63
+ cleanSubPickerItemsList();
64
});
65
}
66
@@ -140,7 +127,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
127
onChanged: (value) {
128
this.textFieldValue = value;
129
cleanSubPickerItemsList();
143
- currencySearchBySubstring(textFieldValue, subPickerItemsList);
130
+ currencySearchBySubstring(textFieldValue);
131
},
132
),
133
),
@@ -152,10 +139,10 @@ class CurrencyPickerState extends State<CurrencyPicker> {
139
AspectRatio(
140
aspectRatio: 6,
141
child: PickerItemWidget(
155
- title: pickerItemsList[widget.selectedAtIndex].title,
156
- iconPath: pickerItemsList[widget.selectedAtIndex].iconPath,
142
+ title: items[widget.selectedAtIndex].title,
143
+ iconPath: items[widget.selectedAtIndex].iconPath,
144
isSelected: true,
158
- tag: pickerItemsList[widget.selectedAtIndex].tag,
145
+ tag: items[widget.selectedAtIndex].tag,
146
),
147
),
148
Flexible(
@@ -167,10 +154,10 @@ class CurrencyPickerState extends State<CurrencyPicker> {
154
setState(() {
155
widget.selectedAtIndex = index;
156
});
170
- widget.onItemSelected(subPickerItemsList[index].original);
157
+ widget.onItemSelected(subPickerItemsList[index]);
158
if (widget.isConvertFrom &&
159
!widget.isMoneroWallet &&
173
- (subPickerItemsList[index].original == CryptoCurrency.xmr)) {
160
+ (subPickerItemsList[index] == CryptoCurrency.xmr)) {
161
} else {
162
Navigator.of(context).pop();
163
}
lib/src/screens/exchange/widgets/currency_picker_widget.dart
+1
-1
@@ -14,7 +14,7 @@ class CurrencyPickerWidget extends StatelessWidget {
14
final int crossAxisCount;
15
final int selectedAtIndex;
16
final Function pickListItem;
17
- final List<PickerItem<CryptoCurrency>> pickerItemsList;
17
+ final List<CryptoCurrency> pickerItemsList;
18
19
final ScrollController _scrollController = ScrollController();
20
lib/src/screens/exchange/widgets/currency_utils.dart
deleted
-101
@@ -1,101 +0,0 @@
1
-import 'package:cw_core/crypto_currency.dart';
2
-
3
-class CurrencyUtils {
4
- static String tagForCurrency(CryptoCurrency cur) {
5
- switch (cur) {
6
- case CryptoCurrency.bnb:
7
- return 'BEP2';
8
- case CryptoCurrency.dai:
9
- return 'ETH';
10
- case CryptoCurrency.usdt:
11
- return 'OMNI';
12
- case CryptoCurrency.usdterc20:
13
- return 'ETH';
14
- default:
15
- return null;
16
- }
17
- }
18
-
19
- static String iconPathForCurrency(CryptoCurrency cur) {
20
- switch (cur) {
21
- case CryptoCurrency.xmr:
22
- return 'assets/images/monero_icon.png';
23
- case CryptoCurrency.ada:
24
- return 'assets/images/ada_icon.png';
25
- case CryptoCurrency.bch:
26
- return 'assets/images/bch_icon.png';
27
- case CryptoCurrency.bnb:
28
- return 'assets/images/bnb_icon.png';
29
- case CryptoCurrency.btc:
30
- return 'assets/images/btc.png';
31
- case CryptoCurrency.dai:
32
- return 'assets/images/dai_icon.png';
33
- case CryptoCurrency.dash:
34
- return 'assets/images/dash_icon.png';
35
- case CryptoCurrency.eos:
36
- return 'assets/images/eos_icon.png';
37
- case CryptoCurrency.eth:
38
- return 'assets/images/eth_icon.png';
39
- case CryptoCurrency.ltc:
40
- return 'assets/images/litecoin-ltc_icon.png';
41
- case CryptoCurrency.trx:
42
- return 'assets/images/trx_icon.png';
43
- case CryptoCurrency.usdt:
44
- return 'assets/images/usdt_icon.png';
45
- case CryptoCurrency.usdterc20:
46
- return 'assets/images/usdterc20_icon.png';
47
- case CryptoCurrency.xlm:
48
- return 'assets/images/xlm_icon.png';
49
- case CryptoCurrency.xrp:
50
- return 'assets/images/xrp_icon.png';
51
- case CryptoCurrency.xhv:
52
- return 'assets/images/xhv_logo.png';
53
- default:
54
- return null;
55
- }
56
- }
57
-
58
- static String titleForCurrency(CryptoCurrency cur) {
59
- switch (cur) {
60
- case CryptoCurrency.bnb:
61
- return 'BNB';
62
- case CryptoCurrency.usdterc20:
63
- return 'USDT';
64
- default:
65
- return cur.title;
66
- }
67
- }
68
-
69
- static String descriptionForCurrency(CryptoCurrency cur) {
70
- switch (cur) {
71
- case CryptoCurrency.xmr:
72
- return 'monero';
73
- case CryptoCurrency.ada:
74
- return 'cardano';
75
- case CryptoCurrency.bch:
76
- return 'bitcoin cash';
77
- case CryptoCurrency.bnb:
78
- return 'binance bep2';
79
- case CryptoCurrency.btc:
80
- return 'bitcoin';
81
- case CryptoCurrency.dai:
82
- return 'dai eth';
83
- case CryptoCurrency.eth:
84
- return 'ethereum';
85
- case CryptoCurrency.ltc:
86
- return 'litecoin';
87
- case CryptoCurrency.trx:
88
- return 'tron';
89
- case CryptoCurrency.usdt:
90
- return 'usdt omni';
91
- case CryptoCurrency.usdterc20:
92
- return 'tether ERC20 eth';
93
- case CryptoCurrency.xlm:
94
- return 'lumens';
95
- case CryptoCurrency.xrp:
96
- return 'ripple';
97
- default:
98
- return cur.title;
99
- }
100
- }
101
-}
lib/src/screens/exchange/widgets/exchange_card.dart
+35
-1
@@ -176,7 +176,7 @@ class ExchangeCardState extends State<ExchangeCard> {
176
padding: EdgeInsets.only(right: 5),
177
child: widget.imageArrow,
178
),
179
- Text(_selectedCurrency.toString() + ':',
179
+ Text(_selectedCurrency.toString(),
180
style: TextStyle(
181
fontWeight: FontWeight.w600,
182
fontSize: 16,
@@ -184,6 +184,40 @@ class ExchangeCardState extends State<ExchangeCard> {
184
]),
185
),
186
),
187
+ _selectedCurrency.tag != null ? Padding(
188
+ padding: const EdgeInsets.only(right:3.0),
189
+ child: Container(
190
+ height: 32,
191
+ decoration: BoxDecoration(
192
+ color: widget.addressButtonsColor ?? Theme.of(context)
193
+ .primaryTextTheme
194
+ .display1
195
+ .color,
196
+ borderRadius:
197
+ BorderRadius.all(Radius.circular(6))),
198
+ child: Center(
199
+ child: Padding(
200
+ padding: const EdgeInsets.all(6.0),
201
+ child: Text(_selectedCurrency.tag,
202
+ style: TextStyle(
203
+ fontSize: 12,
204
+ fontWeight: FontWeight.bold,
205
+ color: Theme.of(context)
206
+ .primaryTextTheme
207
+ .display1
208
+ .decorationColor)),
209
+ ),
210
+ ),
211
+ ),
212
+ ) : Container(),
213
+ Padding(
214
+ padding: const EdgeInsets.only(right: 4.0),
215
+ child: Text(':',
216
+ style: TextStyle(
217
+ fontWeight: FontWeight.w600,
218
+ fontSize: 16,
219
+ color: Colors.white)),
220
+ ),
221
Expanded(
222
child: Row(
223
mainAxisAlignment: MainAxisAlignment.spaceBetween,
lib/src/screens/send/widgets/send_card.dart
+120
-76
@@ -173,85 +173,129 @@ class SendCardState extends State<SendCard>
173
Observer(
174
builder: (_) => Padding(
175
padding: const EdgeInsets.only(top: 20),
176
- child: Stack(
177
- children: [
178
- BaseTextFormField(
179
- focusNode: cryptoAmountFocus,
180
- controller: cryptoAmountController,
181
- keyboardType:
182
- TextInputType.numberWithOptions(
183
- signed: false, decimal: true),
184
- inputFormatters: [
185
- FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
186
- ],
187
- prefixIcon: Padding(
188
- padding: EdgeInsets.only(top: 9),
189
- child: Text(
190
- sendViewModel.selectedCryptoCurrency.title +
191
- ':',
176
+ child: Row(
177
+ children: [
178
+ Padding(
179
+ padding: const EdgeInsets.only(bottom: 8.0),
180
+ child: Row(
181
+ children: [
182
+ Text(
183
+ sendViewModel.selectedCryptoCurrency.title,
184
+ style: TextStyle(
185
+ fontSize: 16,
186
+ fontWeight: FontWeight.w600,
187
+ color: Colors.white,
188
+ )),
189
+ sendViewModel.selectedCryptoCurrency.tag != null ? Padding(
190
+ padding: const EdgeInsets.fromLTRB(3.0,0,3.0,0),
191
+ child: Container(
192
+ height: 32,
193
+ decoration: BoxDecoration(
194
+ color: Theme.of(context)
195
+ .primaryTextTheme
196
+ .display1
197
+ .color,
198
+ borderRadius:
199
+ BorderRadius.all(Radius.circular(6))),
200
+ child: Center(
201
+ child: Padding(
202
+ padding: const EdgeInsets.all(6.0),
203
+ child: Text( sendViewModel.selectedCryptoCurrency.tag,
204
+ style: TextStyle(
205
+ fontSize: 12,
206
+ fontWeight: FontWeight.bold,
207
+ color: Theme.of(context)
208
+ .primaryTextTheme
209
+ .display1
210
+ .decorationColor)),
211
+ ),
212
+ ),
213
+ ),
214
+ ) : Container(),
215
+ Padding(
216
+ padding: const EdgeInsets.only(right: 10.0),
217
+ child: Text(':',
218
style: TextStyle(
193
- fontSize: 16,
194
- fontWeight: FontWeight.w600,
195
- color: Colors.white,
196
- )),
197
- ),
198
- suffixIcon: SizedBox(
199
- width: prefixIconWidth,
219
+ fontWeight: FontWeight.w600,
220
+ fontSize: 16,
221
+ color: Colors.white)),
222
),
201
- hintText: '0.0000',
202
- borderColor: Theme.of(context)
203
- .primaryTextTheme
204
- .headline
205
- .color,
206
- textStyle: TextStyle(
207
- fontSize: 14,
208
- fontWeight: FontWeight.w500,
209
- color: Colors.white),
210
- placeholderTextStyle: TextStyle(
211
- color: Theme.of(context)
212
- .primaryTextTheme
213
- .headline
214
- .decorationColor,
215
- fontWeight: FontWeight.w500,
216
- fontSize: 14),
217
- validator: output.sendAll
218
- ? sendViewModel.allAmountValidator
219
- : sendViewModel
220
- .amountValidator),
221
- if (!sendViewModel.isBatchSending) Positioned(
222
- top: 2,
223
- right: 0,
224
- child: Container(
225
- width: prefixIconWidth,
226
- height: prefixIconHeight,
227
- child: InkWell(
228
- onTap: () async =>
229
- output.setSendAll(),
230
- child: Container(
231
- decoration: BoxDecoration(
232
- color: Theme.of(context)
233
- .primaryTextTheme
234
- .display1
235
- .color,
236
- borderRadius:
237
- BorderRadius.all(
238
- Radius.circular(6))),
239
- child: Center(
240
- child: Text(
241
- S.of(context).all,
242
- textAlign:
243
- TextAlign.center,
244
- style: TextStyle(
245
- fontSize: 12,
246
- fontWeight:
247
- FontWeight.bold,
248
- color:
249
- Theme.of(context)
250
- .primaryTextTheme
251
- .display1
252
- .decorationColor))),
253
- ))))])
223
+ ],
224
+ ),
225
+ ),
226
+ Expanded(
227
+ child: Stack(
228
+ children: [
229
+ BaseTextFormField(
230
+ focusNode: cryptoAmountFocus,
231
+ controller: cryptoAmountController,
232
+ keyboardType:
233
+ TextInputType.numberWithOptions(
234
+ signed: false, decimal: true),
235
+ inputFormatters: [
236
+ FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
237
+ ],
238
+ suffixIcon: SizedBox(
239
+ width: prefixIconWidth,
240
+ ),
241
+ hintText: '0.0000',
242
+ borderColor: Colors.transparent,
243
+ textStyle: TextStyle(
244
+ fontSize: 14,
245
+ fontWeight: FontWeight.w500,
246
+ color: Colors.white),
247
+ placeholderTextStyle: TextStyle(
248
+ color: Theme.of(context)
249
+ .primaryTextTheme
250
+ .headline
251
+ .decorationColor,
252
+ fontWeight: FontWeight.w500,
253
+ fontSize: 14),
254
+ validator: output.sendAll
255
+ ? sendViewModel.allAmountValidator
256
+ : sendViewModel
257
+ .amountValidator),
258
+ if (!sendViewModel.isBatchSending) Positioned(
259
+ top: 2,
260
+ right: 0,
261
+ child: Container(
262
+ width: prefixIconWidth,
263
+ height: prefixIconHeight,
264
+ child: InkWell(
265
+ onTap: () async =>
266
+ output.setSendAll(),
267
+ child: Container(
268
+ decoration: BoxDecoration(
269
+ color: Theme.of(context)
270
+ .primaryTextTheme
271
+ .display1
272
+ .color,
273
+ borderRadius:
274
+ BorderRadius.all(
275
+ Radius.circular(6))),
276
+ child: Center(
277
+ child: Text(
278
+ S.of(context).all,
279
+ textAlign:
280
+ TextAlign.center,
281
+ style: TextStyle(
282
+ fontSize: 12,
283
+ fontWeight:
284
+ FontWeight.bold,
285
+ color:
286
+ Theme.of(context)
287
+ .primaryTextTheme
288
+ .display1
289
+ .decorationColor))),
290
+ ))))]),
291
+ ),
292
+ ],
293
+ )
294
)),
295
+ Divider(height: 1,color: Theme.of(context)
296
+ .primaryTextTheme
297
+ .headline
298
+ .decorationColor),
299
Observer(
300
builder: (_) => Padding(
301
padding: EdgeInsets.only(top: 10),