mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 09:29:48 +00:00
Exchange screens access improvements (#409)
* move tag prop to the crypto currency * add currency icons
This commit is contained in:
parent
1f8cf9b229
commit
52b8bafac9
10 changed files with 237 additions and 265 deletions
BIN
assets/images/zaddr_icon.png
Normal file
BIN
assets/images/zaddr_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
assets/images/zec_icon.png
Normal file
BIN
assets/images/zec_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -5,9 +5,13 @@ part 'crypto_currency.g.dart';
|
||||||
|
|
||||||
@HiveType(typeId: 0)
|
@HiveType(typeId: 0)
|
||||||
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
const CryptoCurrency({final String title, final int raw})
|
const CryptoCurrency({final String title, this.tag, this.name, this.iconPath, final int raw})
|
||||||
: super(title: title, raw: raw);
|
: super(title: title, raw: raw);
|
||||||
|
|
||||||
|
final String tag;
|
||||||
|
final String name;
|
||||||
|
final String iconPath;
|
||||||
|
|
||||||
static const all = [
|
static const all = [
|
||||||
CryptoCurrency.xmr,
|
CryptoCurrency.xmr,
|
||||||
CryptoCurrency.ada,
|
CryptoCurrency.ada,
|
||||||
|
@ -24,39 +28,44 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
CryptoCurrency.usdterc20,
|
CryptoCurrency.usdterc20,
|
||||||
CryptoCurrency.xlm,
|
CryptoCurrency.xlm,
|
||||||
CryptoCurrency.xrp,
|
CryptoCurrency.xrp,
|
||||||
CryptoCurrency.xhv
|
CryptoCurrency.xhv,
|
||||||
|
CryptoCurrency.zaddr,
|
||||||
|
CryptoCurrency.zec
|
||||||
];
|
];
|
||||||
static const xmr = CryptoCurrency(title: 'XMR', raw: 0);
|
static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
|
||||||
static const ada = CryptoCurrency(title: 'ADA', raw: 1);
|
static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', name: 'Cardano', raw: 1);
|
||||||
static const bch = CryptoCurrency(title: 'BCH', raw: 2);
|
static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',name: 'Bitcoin Cash', raw: 2);
|
||||||
static const bnb = CryptoCurrency(title: 'BNB BEP2', raw: 3);
|
static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', name: 'Binance Coin', raw: 3);
|
||||||
static const btc = CryptoCurrency(title: 'BTC', raw: 4);
|
static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', name: 'Bitcoin', raw: 4);
|
||||||
static const dai = CryptoCurrency(title: 'DAI', raw: 5);
|
static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', name: 'Dai', raw: 5);
|
||||||
static const dash = CryptoCurrency(title: 'DASH', raw: 6);
|
static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', name: 'Dash', raw: 6);
|
||||||
static const eos = CryptoCurrency(title: 'EOS', raw: 7);
|
static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', name: 'EOS', raw: 7);
|
||||||
static const eth = CryptoCurrency(title: 'ETH', raw: 8);
|
static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', name: 'Ethereum', raw: 8);
|
||||||
static const ltc = CryptoCurrency(title: 'LTC', raw: 9);
|
static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin',raw: 9);
|
||||||
static const nano = CryptoCurrency(title: 'NANO', raw: 10);
|
static const nano = CryptoCurrency(title: 'NANO', raw: 10);
|
||||||
static const trx = CryptoCurrency(title: 'TRX', raw: 11);
|
static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', name: 'TRON', raw: 11);
|
||||||
static const usdt = CryptoCurrency(title: 'USDT', raw: 12);
|
static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', name: 'USDT', raw: 12);
|
||||||
static const usdterc20 = CryptoCurrency(title: 'USDTERC20', raw: 13);
|
static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', name: 'USDT', raw: 13);
|
||||||
static const xlm = CryptoCurrency(title: 'XLM', raw: 14);
|
static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', name: 'Stellar', raw: 14);
|
||||||
static const xrp = CryptoCurrency(title: 'XRP', raw: 15);
|
static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', name: 'Ripple', raw: 15);
|
||||||
static const xhv = CryptoCurrency(title: 'XHV', raw: 16);
|
static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', name: 'Haven Protocol', raw: 16);
|
||||||
|
|
||||||
static const xag = CryptoCurrency(title: 'XAG', raw: 17);
|
static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17);
|
||||||
static const xau = CryptoCurrency(title: 'XAU', raw: 18);
|
static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18);
|
||||||
static const xaud = CryptoCurrency(title: 'XAUD', raw: 19);
|
static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19);
|
||||||
static const xbtc = CryptoCurrency(title: 'XBTC', raw: 20);
|
static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20);
|
||||||
static const xcad = CryptoCurrency(title: 'XCAD', raw: 21);
|
static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21);
|
||||||
static const xchf = CryptoCurrency(title: 'XCHF', raw: 22);
|
static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22);
|
||||||
static const xcny = CryptoCurrency(title: 'XCNY', raw: 23);
|
static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23);
|
||||||
static const xeur = CryptoCurrency(title: 'XEUR', raw: 24);
|
static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24);
|
||||||
static const xgbp = CryptoCurrency(title: 'XGBP', raw: 25);
|
static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25);
|
||||||
static const xjpy = CryptoCurrency(title: 'XJPY', raw: 26);
|
static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26);
|
||||||
static const xnok = CryptoCurrency(title: 'XNOK', raw: 27);
|
static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27);
|
||||||
static const xnzd = CryptoCurrency(title: 'XNZD', raw: 28);
|
static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28);
|
||||||
static const xusd = CryptoCurrency(title: 'XUSD', raw: 29);
|
static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29);
|
||||||
|
|
||||||
|
static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 30);
|
||||||
|
static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 31);
|
||||||
|
|
||||||
static CryptoCurrency deserialize({int raw}) {
|
static CryptoCurrency deserialize({int raw}) {
|
||||||
switch (raw) {
|
switch (raw) {
|
||||||
|
@ -120,6 +129,10 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
return CryptoCurrency.xnzd;
|
return CryptoCurrency.xnzd;
|
||||||
case 29:
|
case 29:
|
||||||
return CryptoCurrency.xusd;
|
return CryptoCurrency.xusd;
|
||||||
|
case 30:
|
||||||
|
return CryptoCurrency.zaddr;
|
||||||
|
case 31:
|
||||||
|
return CryptoCurrency.zec;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +200,10 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
return CryptoCurrency.xnzd;
|
return CryptoCurrency.xnzd;
|
||||||
case 'xusd':
|
case 'xusd':
|
||||||
return CryptoCurrency.xusd;
|
return CryptoCurrency.xusd;
|
||||||
|
case 'zaddr':
|
||||||
|
return CryptoCurrency.zaddr;
|
||||||
|
case 'zec':
|
||||||
|
return CryptoCurrency.zec;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,33 +240,23 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
String networkFor(CryptoCurrency currency) {
|
String networkFor(CryptoCurrency currency) {
|
||||||
const bnbTitle = 'bnb';
|
|
||||||
|
|
||||||
switch (currency) {
|
switch (currency) {
|
||||||
case CryptoCurrency.usdt:
|
case CryptoCurrency.usdt:
|
||||||
return CryptoCurrency.btc.title.toLowerCase();
|
return CryptoCurrency.btc.title.toLowerCase();
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return CryptoCurrency.eth.title.toLowerCase();
|
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return bnbTitle;
|
|
||||||
case CryptoCurrency.dai:
|
|
||||||
return CryptoCurrency.eth.title.toLowerCase();
|
|
||||||
default:
|
default:
|
||||||
return currency.title.toLowerCase();
|
return currency.tag != null
|
||||||
|
? currency.tag.toLowerCase()
|
||||||
|
: currency.title.toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String normalizeCryptoCurrency(CryptoCurrency currency) {
|
String normalizeCryptoCurrency(CryptoCurrency currency) {
|
||||||
const bnbTitle = 'bnb';
|
switch(currency) {
|
||||||
|
case CryptoCurrency.zec:
|
||||||
switch(currency) {
|
return 'zec';
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return bnbTitle;
|
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return CryptoCurrency.usdt.title.toLowerCase();
|
|
||||||
default:
|
default:
|
||||||
return currency.title.toLowerCase();
|
return currency.title.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -250,14 +250,15 @@ class SideShiftExchangeProvider extends ExchangeProvider {
|
||||||
String get title => 'SideShift';
|
String get title => 'SideShift';
|
||||||
|
|
||||||
static String normalizeCryptoCurrency(CryptoCurrency currency) {
|
static String normalizeCryptoCurrency(CryptoCurrency currency) {
|
||||||
const bnbTitle = 'bsc';
|
|
||||||
const usdterc20 = 'usdtErc20';
|
|
||||||
|
|
||||||
switch (currency) {
|
switch (currency) {
|
||||||
|
case CryptoCurrency.zaddr:
|
||||||
|
return 'zaddr';
|
||||||
|
case CryptoCurrency.zec:
|
||||||
|
return 'zec';
|
||||||
case CryptoCurrency.bnb:
|
case CryptoCurrency.bnb:
|
||||||
return bnbTitle;
|
return currency.tag.toLowerCase();
|
||||||
case CryptoCurrency.usdterc20:
|
case CryptoCurrency.usdterc20:
|
||||||
return usdterc20;
|
return 'usdtErc20';
|
||||||
default:
|
default:
|
||||||
return currency.title.toLowerCase();
|
return currency.title.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker_item_widget.dart';
|
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker_item_widget.dart';
|
||||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_utils.dart';
|
|
||||||
import 'package:cake_wallet/src/screens/exchange/widgets/picker_item.dart';
|
import 'package:cake_wallet/src/screens/exchange/widgets/picker_item.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -35,45 +34,33 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
CurrencyPickerState(this.items)
|
CurrencyPickerState(this.items)
|
||||||
: isSearchBarActive = false,
|
: isSearchBarActive = false,
|
||||||
textFieldValue = '',
|
textFieldValue = '',
|
||||||
subPickerItemsList = [],
|
subPickerItemsList = items,
|
||||||
appBarTextStyle =
|
appBarTextStyle =
|
||||||
TextStyle(fontSize: 20, fontFamily: 'Lato', backgroundColor: Colors.transparent, color: Colors.white);
|
TextStyle(fontSize: 20, fontFamily: 'Lato', backgroundColor: Colors.transparent, color: Colors.white);
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
pickerItemsList = CryptoCurrency.all
|
|
||||||
.map((CryptoCurrency cur) => PickerItem<CryptoCurrency>(cur,
|
|
||||||
title: CurrencyUtils.titleForCurrency(cur),
|
|
||||||
iconPath: CurrencyUtils.iconPathForCurrency(cur),
|
|
||||||
tag: CurrencyUtils.tagForCurrency(cur),
|
|
||||||
description: CurrencyUtils.descriptionForCurrency(cur)))
|
|
||||||
.toList();
|
|
||||||
cleanSubPickerItemsList();
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PickerItem<CryptoCurrency>> pickerItemsList;
|
List<PickerItem<CryptoCurrency>> pickerItemsList;
|
||||||
List<CryptoCurrency> items;
|
List<CryptoCurrency> items;
|
||||||
bool isSearchBarActive;
|
bool isSearchBarActive;
|
||||||
String textFieldValue;
|
String textFieldValue;
|
||||||
List<PickerItem<CryptoCurrency>> subPickerItemsList;
|
List<CryptoCurrency> subPickerItemsList;
|
||||||
TextStyle appBarTextStyle;
|
TextStyle appBarTextStyle;
|
||||||
|
|
||||||
void cleanSubPickerItemsList() {
|
void cleanSubPickerItemsList() => subPickerItemsList = items;
|
||||||
subPickerItemsList = pickerItemsList.where((element) => items.contains(element.original)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void currencySearchBySubstring(String subString, List<PickerItem<CryptoCurrency>> list) {
|
void currencySearchBySubstring(String subString) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (subString.isNotEmpty) {
|
if (subString.isNotEmpty) {
|
||||||
subPickerItemsList = subPickerItemsList
|
subPickerItemsList = items
|
||||||
.where((element) =>
|
.where((element) =>
|
||||||
element.title.contains(subString.toUpperCase()) ||
|
(element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
||||||
element.description.contains(subString.toLowerCase()))
|
(element.tag != null ? element.tag.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
||||||
|
(element.name != null ? element.name.toLowerCase().contains(subString.toLowerCase()) : false))
|
||||||
.toList();
|
.toList();
|
||||||
} else {
|
return;
|
||||||
cleanSubPickerItemsList();
|
|
||||||
}
|
}
|
||||||
|
cleanSubPickerItemsList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +127,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
this.textFieldValue = value;
|
this.textFieldValue = value;
|
||||||
cleanSubPickerItemsList();
|
cleanSubPickerItemsList();
|
||||||
currencySearchBySubstring(textFieldValue, subPickerItemsList);
|
currencySearchBySubstring(textFieldValue);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -152,10 +139,10 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: 6,
|
aspectRatio: 6,
|
||||||
child: PickerItemWidget(
|
child: PickerItemWidget(
|
||||||
title: pickerItemsList[widget.selectedAtIndex].title,
|
title: items[widget.selectedAtIndex].title,
|
||||||
iconPath: pickerItemsList[widget.selectedAtIndex].iconPath,
|
iconPath: items[widget.selectedAtIndex].iconPath,
|
||||||
isSelected: true,
|
isSelected: true,
|
||||||
tag: pickerItemsList[widget.selectedAtIndex].tag,
|
tag: items[widget.selectedAtIndex].tag,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
|
@ -167,10 +154,10 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.selectedAtIndex = index;
|
widget.selectedAtIndex = index;
|
||||||
});
|
});
|
||||||
widget.onItemSelected(subPickerItemsList[index].original);
|
widget.onItemSelected(subPickerItemsList[index]);
|
||||||
if (widget.isConvertFrom &&
|
if (widget.isConvertFrom &&
|
||||||
!widget.isMoneroWallet &&
|
!widget.isMoneroWallet &&
|
||||||
(subPickerItemsList[index].original == CryptoCurrency.xmr)) {
|
(subPickerItemsList[index] == CryptoCurrency.xmr)) {
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CurrencyPickerWidget extends StatelessWidget {
|
||||||
final int crossAxisCount;
|
final int crossAxisCount;
|
||||||
final int selectedAtIndex;
|
final int selectedAtIndex;
|
||||||
final Function pickListItem;
|
final Function pickListItem;
|
||||||
final List<PickerItem<CryptoCurrency>> pickerItemsList;
|
final List<CryptoCurrency> pickerItemsList;
|
||||||
|
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
import 'package:cw_core/crypto_currency.dart';
|
|
||||||
|
|
||||||
class CurrencyUtils {
|
|
||||||
static String tagForCurrency(CryptoCurrency cur) {
|
|
||||||
switch (cur) {
|
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return 'BEP2';
|
|
||||||
case CryptoCurrency.dai:
|
|
||||||
return 'ETH';
|
|
||||||
case CryptoCurrency.usdt:
|
|
||||||
return 'OMNI';
|
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return 'ETH';
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static String iconPathForCurrency(CryptoCurrency cur) {
|
|
||||||
switch (cur) {
|
|
||||||
case CryptoCurrency.xmr:
|
|
||||||
return 'assets/images/monero_icon.png';
|
|
||||||
case CryptoCurrency.ada:
|
|
||||||
return 'assets/images/ada_icon.png';
|
|
||||||
case CryptoCurrency.bch:
|
|
||||||
return 'assets/images/bch_icon.png';
|
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return 'assets/images/bnb_icon.png';
|
|
||||||
case CryptoCurrency.btc:
|
|
||||||
return 'assets/images/btc.png';
|
|
||||||
case CryptoCurrency.dai:
|
|
||||||
return 'assets/images/dai_icon.png';
|
|
||||||
case CryptoCurrency.dash:
|
|
||||||
return 'assets/images/dash_icon.png';
|
|
||||||
case CryptoCurrency.eos:
|
|
||||||
return 'assets/images/eos_icon.png';
|
|
||||||
case CryptoCurrency.eth:
|
|
||||||
return 'assets/images/eth_icon.png';
|
|
||||||
case CryptoCurrency.ltc:
|
|
||||||
return 'assets/images/litecoin-ltc_icon.png';
|
|
||||||
case CryptoCurrency.trx:
|
|
||||||
return 'assets/images/trx_icon.png';
|
|
||||||
case CryptoCurrency.usdt:
|
|
||||||
return 'assets/images/usdt_icon.png';
|
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return 'assets/images/usdterc20_icon.png';
|
|
||||||
case CryptoCurrency.xlm:
|
|
||||||
return 'assets/images/xlm_icon.png';
|
|
||||||
case CryptoCurrency.xrp:
|
|
||||||
return 'assets/images/xrp_icon.png';
|
|
||||||
case CryptoCurrency.xhv:
|
|
||||||
return 'assets/images/xhv_logo.png';
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static String titleForCurrency(CryptoCurrency cur) {
|
|
||||||
switch (cur) {
|
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return 'BNB';
|
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return 'USDT';
|
|
||||||
default:
|
|
||||||
return cur.title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static String descriptionForCurrency(CryptoCurrency cur) {
|
|
||||||
switch (cur) {
|
|
||||||
case CryptoCurrency.xmr:
|
|
||||||
return 'monero';
|
|
||||||
case CryptoCurrency.ada:
|
|
||||||
return 'cardano';
|
|
||||||
case CryptoCurrency.bch:
|
|
||||||
return 'bitcoin cash';
|
|
||||||
case CryptoCurrency.bnb:
|
|
||||||
return 'binance bep2';
|
|
||||||
case CryptoCurrency.btc:
|
|
||||||
return 'bitcoin';
|
|
||||||
case CryptoCurrency.dai:
|
|
||||||
return 'dai eth';
|
|
||||||
case CryptoCurrency.eth:
|
|
||||||
return 'ethereum';
|
|
||||||
case CryptoCurrency.ltc:
|
|
||||||
return 'litecoin';
|
|
||||||
case CryptoCurrency.trx:
|
|
||||||
return 'tron';
|
|
||||||
case CryptoCurrency.usdt:
|
|
||||||
return 'usdt omni';
|
|
||||||
case CryptoCurrency.usdterc20:
|
|
||||||
return 'tether ERC20 eth';
|
|
||||||
case CryptoCurrency.xlm:
|
|
||||||
return 'lumens';
|
|
||||||
case CryptoCurrency.xrp:
|
|
||||||
return 'ripple';
|
|
||||||
default:
|
|
||||||
return cur.title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -176,7 +176,7 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||||
padding: EdgeInsets.only(right: 5),
|
padding: EdgeInsets.only(right: 5),
|
||||||
child: widget.imageArrow,
|
child: widget.imageArrow,
|
||||||
),
|
),
|
||||||
Text(_selectedCurrency.toString() + ':',
|
Text(_selectedCurrency.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
|
@ -184,6 +184,40 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
_selectedCurrency.tag != null ? Padding(
|
||||||
|
padding: const EdgeInsets.only(right:3.0),
|
||||||
|
child: Container(
|
||||||
|
height: 32,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: widget.addressButtonsColor ?? Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.color,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6))),
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(6.0),
|
||||||
|
child: Text(_selectedCurrency.tag,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.decorationColor)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) : Container(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 4.0),
|
||||||
|
child: Text(':',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white)),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|
|
@ -173,85 +173,129 @@ class SendCardState extends State<SendCard>
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) => Padding(
|
builder: (_) => Padding(
|
||||||
padding: const EdgeInsets.only(top: 20),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
child: Stack(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
BaseTextFormField(
|
Padding(
|
||||||
focusNode: cryptoAmountFocus,
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
controller: cryptoAmountController,
|
child: Row(
|
||||||
keyboardType:
|
children: [
|
||||||
TextInputType.numberWithOptions(
|
Text(
|
||||||
signed: false, decimal: true),
|
sendViewModel.selectedCryptoCurrency.title,
|
||||||
inputFormatters: [
|
style: TextStyle(
|
||||||
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
fontSize: 16,
|
||||||
],
|
fontWeight: FontWeight.w600,
|
||||||
prefixIcon: Padding(
|
color: Colors.white,
|
||||||
padding: EdgeInsets.only(top: 9),
|
)),
|
||||||
child: Text(
|
sendViewModel.selectedCryptoCurrency.tag != null ? Padding(
|
||||||
sendViewModel.selectedCryptoCurrency.title +
|
padding: const EdgeInsets.fromLTRB(3.0,0,3.0,0),
|
||||||
':',
|
child: Container(
|
||||||
|
height: 32,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.color,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6))),
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(6.0),
|
||||||
|
child: Text( sendViewModel.selectedCryptoCurrency.tag,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.decorationColor)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) : Container(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10.0),
|
||||||
|
child: Text(':',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontWeight: FontWeight.w600,
|
||||||
fontWeight: FontWeight.w600,
|
fontSize: 16,
|
||||||
color: Colors.white,
|
color: Colors.white)),
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
suffixIcon: SizedBox(
|
],
|
||||||
width: prefixIconWidth,
|
),
|
||||||
),
|
),
|
||||||
hintText: '0.0000',
|
Expanded(
|
||||||
borderColor: Theme.of(context)
|
child: Stack(
|
||||||
.primaryTextTheme
|
children: [
|
||||||
.headline
|
BaseTextFormField(
|
||||||
.color,
|
focusNode: cryptoAmountFocus,
|
||||||
textStyle: TextStyle(
|
controller: cryptoAmountController,
|
||||||
fontSize: 14,
|
keyboardType:
|
||||||
fontWeight: FontWeight.w500,
|
TextInputType.numberWithOptions(
|
||||||
color: Colors.white),
|
signed: false, decimal: true),
|
||||||
placeholderTextStyle: TextStyle(
|
inputFormatters: [
|
||||||
color: Theme.of(context)
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
.primaryTextTheme
|
],
|
||||||
.headline
|
suffixIcon: SizedBox(
|
||||||
.decorationColor,
|
width: prefixIconWidth,
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
fontSize: 14),
|
hintText: '0.0000',
|
||||||
validator: output.sendAll
|
borderColor: Colors.transparent,
|
||||||
? sendViewModel.allAmountValidator
|
textStyle: TextStyle(
|
||||||
: sendViewModel
|
fontSize: 14,
|
||||||
.amountValidator),
|
fontWeight: FontWeight.w500,
|
||||||
if (!sendViewModel.isBatchSending) Positioned(
|
color: Colors.white),
|
||||||
top: 2,
|
placeholderTextStyle: TextStyle(
|
||||||
right: 0,
|
color: Theme.of(context)
|
||||||
child: Container(
|
.primaryTextTheme
|
||||||
width: prefixIconWidth,
|
.headline
|
||||||
height: prefixIconHeight,
|
.decorationColor,
|
||||||
child: InkWell(
|
fontWeight: FontWeight.w500,
|
||||||
onTap: () async =>
|
fontSize: 14),
|
||||||
output.setSendAll(),
|
validator: output.sendAll
|
||||||
child: Container(
|
? sendViewModel.allAmountValidator
|
||||||
decoration: BoxDecoration(
|
: sendViewModel
|
||||||
color: Theme.of(context)
|
.amountValidator),
|
||||||
.primaryTextTheme
|
if (!sendViewModel.isBatchSending) Positioned(
|
||||||
.display1
|
top: 2,
|
||||||
.color,
|
right: 0,
|
||||||
borderRadius:
|
child: Container(
|
||||||
BorderRadius.all(
|
width: prefixIconWidth,
|
||||||
Radius.circular(6))),
|
height: prefixIconHeight,
|
||||||
child: Center(
|
child: InkWell(
|
||||||
child: Text(
|
onTap: () async =>
|
||||||
S.of(context).all,
|
output.setSendAll(),
|
||||||
textAlign:
|
child: Container(
|
||||||
TextAlign.center,
|
decoration: BoxDecoration(
|
||||||
style: TextStyle(
|
color: Theme.of(context)
|
||||||
fontSize: 12,
|
.primaryTextTheme
|
||||||
fontWeight:
|
.display1
|
||||||
FontWeight.bold,
|
.color,
|
||||||
color:
|
borderRadius:
|
||||||
Theme.of(context)
|
BorderRadius.all(
|
||||||
.primaryTextTheme
|
Radius.circular(6))),
|
||||||
.display1
|
child: Center(
|
||||||
.decorationColor))),
|
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,color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor),
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) => Padding(
|
builder: (_) => Padding(
|
||||||
padding: EdgeInsets.only(top: 10),
|
padding: EdgeInsets.only(top: 10),
|
||||||
|
|
Loading…
Reference in a new issue