CAKE-53 | added dai to cryptocurrencies list; added dai to currency picker; added dai logo to contact list page; added address validator for dai

This commit is contained in:
OleksandrSobol 2020-09-24 21:58:07 +03:00
parent 9eb74f7155
commit 360e04cc4c
7 changed files with 43 additions and 44 deletions

BIN
assets/images/dai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View file

@ -22,6 +22,8 @@ class AddressValidator extends TextValidator {
return '[0-9a-zA-Z]';
case CryptoCurrency.btc:
return '[0-9a-zA-Z]';
case CryptoCurrency.dai:
return '[0-9a-zA-Z]';
case CryptoCurrency.dash:
return '[0-9a-zA-Z]';
case CryptoCurrency.eos:
@ -57,6 +59,8 @@ class AddressValidator extends TextValidator {
return [42];
case CryptoCurrency.btc:
return [34, 42];
case CryptoCurrency.dai:
return [42];
case CryptoCurrency.dash:
return [34];
case CryptoCurrency.eos:

View file

@ -14,6 +14,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
CryptoCurrency.bch,
CryptoCurrency.bnb,
CryptoCurrency.btc,
CryptoCurrency.dai,
CryptoCurrency.dash,
CryptoCurrency.eos,
CryptoCurrency.eth,
@ -29,15 +30,16 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
static const bch = CryptoCurrency(title: 'BCH', raw: 2);
static const bnb = CryptoCurrency(title: 'BNB', raw: 3);
static const btc = CryptoCurrency(title: 'BTC', raw: 4);
static const dash = CryptoCurrency(title: 'DASH', raw: 5);
static const eos = CryptoCurrency(title: 'EOS', raw: 6);
static const eth = CryptoCurrency(title: 'ETH', raw: 7);
static const ltc = CryptoCurrency(title: 'LTC', raw: 8);
static const nano = CryptoCurrency(title: 'NANO', raw: 9);
static const trx = CryptoCurrency(title: 'TRX', raw: 10);
static const usdt = CryptoCurrency(title: 'USDT', raw: 11);
static const xlm = CryptoCurrency(title: 'XLM', raw: 12);
static const xrp = CryptoCurrency(title: 'XRP', raw: 13);
static const dai = CryptoCurrency(title: 'DAI', raw: 5);
static const dash = CryptoCurrency(title: 'DASH', raw: 6);
static const eos = CryptoCurrency(title: 'EOS', raw: 7);
static const eth = CryptoCurrency(title: 'ETH', raw: 8);
static const ltc = CryptoCurrency(title: 'LTC', raw: 9);
static const nano = CryptoCurrency(title: 'NANO', raw: 10);
static const trx = CryptoCurrency(title: 'TRX', raw: 11);
static const usdt = CryptoCurrency(title: 'USDT', raw: 12);
static const xlm = CryptoCurrency(title: 'XLM', raw: 13);
static const xrp = CryptoCurrency(title: 'XRP', raw: 14);
static CryptoCurrency deserialize({int raw}) {
switch (raw) {
@ -52,22 +54,24 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
case 4:
return CryptoCurrency.btc;
case 5:
return CryptoCurrency.dash;
return CryptoCurrency.dai;
case 6:
return CryptoCurrency.eos;
return CryptoCurrency.dash;
case 7:
return CryptoCurrency.eth;
return CryptoCurrency.eos;
case 8:
return CryptoCurrency.ltc;
return CryptoCurrency.eth;
case 9:
return CryptoCurrency.nano;
return CryptoCurrency.ltc;
case 10:
return CryptoCurrency.trx;
return CryptoCurrency.nano;
case 11:
return CryptoCurrency.usdt;
return CryptoCurrency.trx;
case 12:
return CryptoCurrency.xlm;
return CryptoCurrency.usdt;
case 13:
return CryptoCurrency.xlm;
case 14:
return CryptoCurrency.xrp;
default:
return null;
@ -86,6 +90,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
return CryptoCurrency.bnb;
case 'btc':
return CryptoCurrency.btc;
case 'dai':
return CryptoCurrency.dai;
case 'dash':
return CryptoCurrency.dash;
case 'eos':

View file

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:cake_wallet/core/amount_converter.dart';
import 'package:cake_wallet/monero/monero_amount_format.dart';
import 'package:hive/hive.dart';
import 'package:cake_wallet/exchange/trade_not_found_exeption.dart';
import 'package:flutter/foundation.dart';

View file

@ -211,6 +211,9 @@ class ContactListPage extends BasePage {
case CryptoCurrency.btc:
image = Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
break;
case CryptoCurrency.dai:
image = Image.asset('assets/images/dai.png', height: 24, width: 24);
break;
case CryptoCurrency.dash:
image = Image.asset('assets/images/dash.png', height: 24, width: 24);
break;

View file

@ -62,13 +62,7 @@ class CurrencyPicker extends StatelessWidget {
physics: const NeverScrollableScrollPhysics(),
crossAxisSpacing: 1,
mainAxisSpacing: 1,
children: List.generate(15, (index) {
if (index == 14) {
return Container(
color: Theme.of(context).accentTextTheme.title.color,
);
}
children: List.generate(items.length, (index) {
final item = items[index];
final isItemSelected = index == selectedAtIndex;

View file

@ -42,7 +42,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.4.1"
auto_size_text:
dependency: "direct main"
description:
@ -210,7 +210,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.14.12"
connectivity:
dependency: "direct main"
description:
@ -252,7 +252,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
version: "2.1.4"
csslib:
dependency: transitive
description:
@ -330,13 +330,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
ffi:
dependency: transitive
description:
@ -505,7 +498,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.17"
version: "2.1.12"
intl:
dependency: "direct main"
description:
@ -554,7 +547,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.6"
meta:
dependency: transitive
description:
@ -624,7 +617,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.6.4"
path_drawing:
dependency: transitive
description:
@ -687,7 +680,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
version: "2.4.0"
platform:
dependency: transitive
description:
@ -874,7 +867,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.9.3"
stream_channel:
dependency: transitive
description:
@ -909,7 +902,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.15"
time:
dependency: transitive
description:
@ -930,7 +923,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.1.6"
url_launcher:
dependency: "direct main"
description:
@ -1021,7 +1014,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.1"
version: "3.6.1"
yaml:
dependency: "direct main"
description:
@ -1030,5 +1023,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"