Merge branch 'new-world' into CAKE-54-usdterc20-for-changenow

This commit is contained in:
OleksandrSobol 2020-09-28 21:42:38 +03:00
commit 69b58d827b
71 changed files with 1379 additions and 1704 deletions

View file

@ -1,38 +0,0 @@
import 'package:hive/hive.dart';
import 'package:cake_wallet/store/contact_list_store.dart';
import 'package:cake_wallet/entities/contact.dart';
class ContactService {
ContactService(this.contactSource, this.contactListStore) {
_forceUpdateContactListStore();
}
final Box<Contact> contactSource;
final ContactListStore contactListStore;
Future add(Contact contact) async {
await contactSource.add(contact);
// contactListStore.contacts.add(contact);
}
Future update(Contact contact) async {
await contact.save();
final index = contactListStore.contacts.indexOf(contact) ?? -1;
if (index >= 0) {
_forceUpdateContactListStore();
} else {
contactListStore.contacts.add(contact);
}
}
Future delete(Contact contact) async {
await contact.delete();
contactListStore.contacts.remove(contact);
}
void _forceUpdateContactListStore() {
contactListStore.contacts.clear();
contactListStore.contacts.addAll(contactSource.values);
}
}

View file

@ -1,28 +1,28 @@
import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart'; import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
import 'package:cake_wallet/core/contact_service.dart';
import 'package:cake_wallet/core/wallet_service.dart'; import 'package:cake_wallet/core/wallet_service.dart';
import 'package:cake_wallet/entities/biometric_auth.dart'; import 'package:cake_wallet/entities/biometric_auth.dart';
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/monero/monero_wallet_service.dart'; import 'package:cake_wallet/monero/monero_wallet_service.dart';
import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/exchange/trade.dart'; import 'package:cake_wallet/exchange/trade.dart';
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart'; import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
import 'package:cake_wallet/src/screens/contact/contact_page.dart'; import 'package:cake_wallet/src/screens/contact/contact_page.dart';
import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dart';
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart';
import 'package:cake_wallet/src/screens/faq/faq_page.dart';
import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart'; import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart';
import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart'; import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart'; import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart'; import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/send/send_template_page.dart';
import 'package:cake_wallet/src/screens/settings/change_language.dart';
import 'package:cake_wallet/src/screens/settings/settings.dart'; import 'package:cake_wallet/src/screens/settings/settings.dart';
import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart';
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart';
import 'package:cake_wallet/store/contact_list_store.dart';
import 'package:cake_wallet/store/node_list_store.dart'; import 'package:cake_wallet/store/node_list_store.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/core/auth_service.dart'; import 'package:cake_wallet/core/auth_service.dart';
@ -37,10 +37,7 @@ import 'package:cake_wallet/src/screens/receive/receive_page.dart';
import 'package:cake_wallet/src/screens/send/send_page.dart'; import 'package:cake_wallet/src/screens/send/send_page.dart';
import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart'; import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart';
import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart'; import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart';
import 'package:cake_wallet/store/theme_changer_store.dart';
import 'package:cake_wallet/store/wallet_list_store.dart'; import 'package:cake_wallet/store/wallet_list_store.dart';
import 'package:cake_wallet/utils/mobx.dart';
import 'package:cake_wallet/theme_changer.dart';
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart'; import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
import 'package:cake_wallet/view_model/contact_list/contact_view_model.dart'; import 'package:cake_wallet/view_model/contact_list/contact_view_model.dart';
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart'; import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
@ -61,11 +58,9 @@ import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart'; import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart'; import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart'; import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
@ -103,17 +98,13 @@ Future setup(
getIt.registerSingleton<FlutterSecureStorage>(FlutterSecureStorage()); getIt.registerSingleton<FlutterSecureStorage>(FlutterSecureStorage());
getIt.registerSingleton(AuthenticationStore()); getIt.registerSingleton(AuthenticationStore());
getIt.registerSingleton<WalletListStore>(WalletListStore()); getIt.registerSingleton<WalletListStore>(WalletListStore());
getIt.registerSingleton(ContactListStore());
getIt.registerSingleton(NodeListStoreBase.instance); getIt.registerSingleton(NodeListStoreBase.instance);
getIt.registerSingleton<SettingsStore>(settingsStore); getIt.registerSingleton<SettingsStore>(settingsStore);
getIt.registerSingleton<AppStore>(AppStore( getIt.registerSingleton<AppStore>(AppStore(
authenticationStore: getIt.get<AuthenticationStore>(), authenticationStore: getIt.get<AuthenticationStore>(),
walletList: getIt.get<WalletListStore>(), walletList: getIt.get<WalletListStore>(),
settingsStore: getIt.get<SettingsStore>(), settingsStore: getIt.get<SettingsStore>(),
contactListStore: getIt.get<ContactListStore>(),
nodeListStore: getIt.get<NodeListStore>())); nodeListStore: getIt.get<NodeListStore>()));
getIt.registerSingleton<ContactService>(
ContactService(contactSource, getIt.get<AppStore>().contactListStore));
getIt.registerSingleton<TradesStore>(TradesStore( getIt.registerSingleton<TradesStore>(TradesStore(
tradesSource: tradesSource, settingsStore: getIt.get<SettingsStore>())); tradesSource: tradesSource, settingsStore: getIt.get<SettingsStore>()));
getIt.registerSingleton<TradeFilterStore>(TradeFilterStore()); getIt.registerSingleton<TradeFilterStore>(TradeFilterStore());
@ -195,9 +186,10 @@ Future setup(
instanceName: 'login'); instanceName: 'login');
getIt getIt
.registerFactoryParam<AuthPage, void Function(bool, AuthPageState), void>( .registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
(onAuthFinished, _) => AuthPage(getIt.get<AuthViewModel>(), (onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
onAuthenticationFinished: onAuthFinished, closable: false)); onAuthenticationFinished: onAuthFinished,
closable: closable ?? false));
getIt.registerFactory<DashboardPage>(() => DashboardPage( getIt.registerFactory<DashboardPage>(() => DashboardPage(
walletViewModel: getIt.get<DashboardViewModel>(), walletViewModel: getIt.get<DashboardViewModel>(),
@ -282,27 +274,24 @@ Future setup(
getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>())); getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>()));
getIt.registerFactoryParam<ContactViewModel, Contact, void>( getIt.registerFactoryParam<ContactViewModel, ContactRecord, void>(
(Contact contact, _) => ContactViewModel( (ContactRecord contact, _) =>
contactSource, getIt.get<AppStore>().wallet, ContactViewModel(contactSource, contact: contact));
contact: contact));
getIt.registerFactory(() => ContactListViewModel( getIt.registerFactory(() => ContactListViewModel(contactSource));
getIt.get<AppStore>().contactListStore,
getIt.get<ContactService>(),
contactSource));
getIt.registerFactoryParam<ContactListPage, bool, void>( getIt.registerFactoryParam<ContactListPage, bool, void>(
(bool isEditable, _) => ContactListPage(getIt.get<ContactListViewModel>(), (bool isEditable, _) => ContactListPage(getIt.get<ContactListViewModel>(),
isEditable: isEditable)); isEditable: isEditable));
getIt.registerFactoryParam<ContactPage, Contact, void>((Contact contact, _) => getIt.registerFactoryParam<ContactPage, ContactRecord, void>(
ContactPage(getIt.get<ContactViewModel>(param1: contact))); (ContactRecord contact, _) =>
ContactPage(getIt.get<ContactViewModel>(param1: contact)));
getIt.registerFactory(() { getIt.registerFactory(() {
final appStore = getIt.get<AppStore>(); final appStore = getIt.get<AppStore>();
return NodeListViewModel(appStore.nodeListStore, nodeSource, return NodeListViewModel(
appStore.wallet, appStore.settingsStore); nodeSource, appStore.wallet, appStore.settingsStore);
}); });
getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>())); getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>()));
@ -363,9 +352,8 @@ Future setup(
getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet)); getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet));
getIt.registerFactory(() => RescanPage(getIt.get<RescanViewModel>())); getIt.registerFactory(() => RescanPage(getIt.get<RescanViewModel>()));
}
void setupThemeChangerStore(ThemeChanger themeChanger) { getIt.registerFactory(() => FaqPage(getIt.get<SettingsStore>()));
getIt.registerSingleton<ThemeChangerStore>(
ThemeChangerStore(themeChanger: themeChanger)); getIt.registerFactory(() => LanguageListPage(getIt.get<SettingsStore>()));
} }

View file

@ -0,0 +1,40 @@
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/crypto_currency.dart';
import 'package:cake_wallet/entities/record.dart';
part 'contact_record.g.dart';
class ContactRecord = ContactRecordBase with _$ContactRecord;
abstract class ContactRecordBase extends Record<Contact> with Store {
ContactRecordBase(Box<Contact> source, Contact original)
: super(source, original);
@observable
String name;
@observable
String address;
@observable
CryptoCurrency type;
@override
void toBind(Contact original) {
reaction((_) => name, (String name) => original.name = name);
reaction((_) => address, (String address) => original.address = address);
reaction(
(_) => type,
(CryptoCurrency currency) =>
original.updateCryptoCurrency(currency: currency));
}
@override
void fromBind(Contact original) {
name = original.name;
address = original.address;
type = original.type;
}
}

View file

@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
import 'package:devicelocale/devicelocale.dart';
import 'package:intl/intl.dart';
const Map<String, String> languages = {
'en': 'English',
'de': 'Deutsch (German)',
'es': 'Español (Spanish)',
'hi': 'हिंदी (Hindi)',
'ja': '日本 (Japanese)',
'ko': '한국어 (Korean)',
'nl': 'Nederlands (Dutch)',
'pl': 'Polski (Polish)',
'pt': 'Português (Portuguese)',
'ru': 'Русский (Russian)',
'uk': 'Українська (Ukrainian)',
'zh': '中文 (Chinese)'
};
class Language with ChangeNotifier {
Language(this._currentLanguage);
String _currentLanguage;
String getCurrentLanguage() => _currentLanguage;
void setCurrentLanguage(String language) {
_currentLanguage = language;
notifyListeners();
}
static Future<String> localeDetection() async {
var locale = await Devicelocale.currentLocale;
locale = Intl.shortLocale(locale);
return languages.keys.contains(locale) ? locale : 'en';
}
}

View file

@ -0,0 +1,26 @@
import 'package:devicelocale/devicelocale.dart';
import 'package:intl/intl.dart';
class LanguageService {
static const Map<String, String> list = {
'en': 'English',
'de': 'Deutsch (German)',
'es': 'Español (Spanish)',
'hi': 'हिंदी (Hindi)',
'ja': '日本 (Japanese)',
'ko': '한국어 (Korean)',
'nl': 'Nederlands (Dutch)',
'pl': 'Polski (Polish)',
'pt': 'Português (Portuguese)',
'ru': 'Русский (Russian)',
'uk': 'Українська (Ukrainian)',
'zh': '中文 (Chinese)'
};
static Future<String> localeDetection() async {
var locale = await Devicelocale.currentLocale;
locale = Intl.shortLocale(locale);
return list.keys.contains(locale) ? locale : 'en';
}
}

View file

@ -38,6 +38,9 @@ class Node extends HiveObject with Keyable {
@HiveField(3) @HiveField(3)
int typeRaw; int typeRaw;
@override
dynamic get keyIndex => key;
WalletType get type => deserializeFromInt(typeRaw); WalletType get type => deserializeFromInt(typeRaw);
set type(WalletType type) => typeRaw = serializeToInt(type); set type(WalletType type) => typeRaw = serializeToInt(type);
@ -58,24 +61,28 @@ class Node extends HiveObject with Keyable {
} }
Future<bool> requestMoneroNode() async { Future<bool> requestMoneroNode() async {
Map<String, dynamic> resBody; try {
Map<String, dynamic> resBody;
if (login != null && password != null) { if (login != null && password != null) {
final digestRequest = DigestRequest(); final digestRequest = DigestRequest();
final response = await digestRequest.request( final response = await digestRequest.request(
uri: uri, login: login, password: password); uri: uri, login: login, password: password);
resBody = response.data as Map<String, dynamic>; resBody = response.data as Map<String, dynamic>;
} else { } else {
final url = Uri.http(uri, '/json_rpc'); final url = Uri.http(uri, '/json_rpc');
final headers = {'Content-type': 'application/json'}; final headers = {'Content-type': 'application/json'};
final body = final body =
json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'}); json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'});
final response = final response =
await http.post(url.toString(), headers: headers, body: body); await http.post(url.toString(), headers: headers, body: body);
resBody = json.decode(response.body) as Map<String, dynamic>; resBody = json.decode(response.body) as Map<String, dynamic>;
}
return !(resBody['result']['offline'] as bool);
} catch (_) {
return false;
} }
return !(resBody['result']['offline'] as bool);
} }
Future<bool> requestBitcoinElectrumServer() async { Future<bool> requestBitcoinElectrumServer() async {

36
lib/entities/record.dart Normal file
View file

@ -0,0 +1,36 @@
import 'dart:async';
import 'package:cake_wallet/utils/mobx.dart';
import 'package:hive/hive.dart';
abstract class Record<T extends HiveObject> with Keyable {
Record(this._source, this.original) {
key = original.key;
_listener?.cancel();
_listener = _source.watch(key: original.key).listen((event) {
if (!event.deleted) {
fromBind(event.value as T);
}
});
fromBind(original);
toBind(original);
}
dynamic key;
@override
dynamic get keyIndex => key;
final T original;
final Box<T> _source;
StreamSubscription<BoxEvent> _listener;
void fromBind(T original);
void toBind(T original);
Future<void> save() => original.save();
}

View file

@ -1,66 +1,30 @@
import 'package:cake_wallet/entities/fs_migration.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/reactions/bootstrap.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/store/authentication_store.dart';
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
import 'package:cake_wallet/monero/monero_wallet_service.dart';
import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get_it/get_it.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:cake_wallet/di.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cw_monero/wallet.dart' as monero_wallet; import 'package:cw_monero/wallet.dart' as monero_wallet;
import 'package:cake_wallet/router.dart'; import 'package:cake_wallet/router.dart';
import 'theme_changer.dart'; import 'package:cake_wallet/routes.dart';
import 'themes.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/reactions/bootstrap.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/store/authentication_store.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/entities/get_encryption_key.dart'; import 'package:cake_wallet/entities/get_encryption_key.dart';
import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/entities/wallet_info.dart'; import 'package:cake_wallet/entities/wallet_info.dart';
import 'package:cake_wallet/exchange/trade.dart';
// import 'package:cake_wallet/monero/transaction_description.dart';
import 'package:cake_wallet/src/reactions/set_reactions.dart';
// import 'package:cake_wallet/src/stores/login/login_store.dart';
// import 'package:cake_wallet/src/stores/balance/balance_store.dart';
// import 'package:cake_wallet/src/stores/sync/sync_store.dart';
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
// import 'package:cake_wallet/src/stores/send_template/send_template_store.dart';
// import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
import 'package:cake_wallet/src/screens/root/root.dart';
//import 'package:cake_wallet/src/stores/authentication/authentication_store.dart';
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
// import 'package:cake_wallet/src/stores/price/price_store.dart';
// import 'package:cake_wallet/src/domain/services/user_service.dart';
// import 'package:cake_wallet/src/domain/services/wallet_list_service.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/default_settings_migration.dart'; import 'package:cake_wallet/entities/default_settings_migration.dart';
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/transaction_priority.dart';
import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/entities/template.dart'; import 'package:cake_wallet/entities/template.dart';
import 'package:cake_wallet/exchange/trade.dart';
import 'package:cake_wallet/exchange/exchange_template.dart'; import 'package:cake_wallet/exchange/exchange_template.dart';
import 'package:cake_wallet/src/screens/root/root.dart';
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
// import 'package:cake_wallet/src/domain/services/fiat_convertation_service.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/entities/language.dart';
// import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
bool isThemeChangerRegistered = false;
final navigatorKey = GlobalKey<NavigatorState>(); final navigatorKey = GlobalKey<NavigatorState>();
@ -94,41 +58,6 @@ void main() async {
final templates = await Hive.openBox<Template>(Template.boxName); final templates = await Hive.openBox<Template>(Template.boxName);
final exchangeTemplates = final exchangeTemplates =
await Hive.openBox<ExchangeTemplate>(ExchangeTemplate.boxName); await Hive.openBox<ExchangeTemplate>(ExchangeTemplate.boxName);
// final sharedPreferences = await SharedPreferences.getInstance();
// final walletService = WalletService();
// final fiatConvertationService = FiatConvertationService();
// final walletListService = WalletListService(
// secureStorage: secureStorage,
// walletInfoSource: walletInfoSource,
// walletService: walletService,
// sharedPreferences: sharedPreferences);
// final userService = UserService(
// sharedPreferences: sharedPreferences, secureStorage: secureStorage);
// final settingsStore = await SettingsStoreBase.load(
// nodes: nodes,
// sharedPreferences: sharedPreferences,
// initialFiatCurrency: FiatCurrency.usd,
// initialTransactionPriority: TransactionPriority.slow,
// initialBalanceDisplayMode: BalanceDisplayMode.availableBalance);
// final priceStore = PriceStore();
// final walletStore =
// WalletStore(walletService: walletService, settingsStore: settingsStore);
// final syncStore = SyncStore(walletService: walletService);
// final balanceStore = BalanceStore(
// walletService: walletService,
// settingsStore: settingsStore,
// priceStore: priceStore);
// final loginStore = LoginStore(
// sharedPreferences: sharedPreferences, walletsService: walletListService);
// final seedLanguageStore = SeedLanguageStore();
// final sendTemplateStore = SendTemplateStore(templateSource: templates);
// final exchangeTemplateStore =
// ExchangeTemplateStore(templateSource: exchangeTemplates);
// final walletCreationService = WalletCreationService();
// final authService = AuthService();
await initialSetup( await initialSetup(
sharedPreferences: await SharedPreferences.getInstance(), sharedPreferences: await SharedPreferences.getInstance(),
nodes: nodes, nodes: nodes,
@ -139,15 +68,7 @@ void main() async {
templates: templates, templates: templates,
exchangeTemplates: exchangeTemplates, exchangeTemplates: exchangeTemplates,
initialMigrationVersion: 4); initialMigrationVersion: 4);
// setReactions( runApp(App());
// settingsStore: settingsStore,
// priceStore: priceStore,
// syncStore: syncStore,
// walletStore: walletStore,
// walletService: walletService,
// // authenticationStore: authenticationStore,
// loginStore: loginStore);
runApp(CakeWalletApp());
} }
Future<void> initialSetup( Future<void> initialSetup(
@ -178,63 +99,25 @@ Future<void> initialSetup(
monero_wallet.onStartup(); monero_wallet.onStartup();
} }
class CakeWalletApp extends StatelessWidget { class App extends StatelessWidget {
CakeWalletApp() { App() {
SystemChrome.setPreferredOrientations( SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
//final settingsStore = Provider.of<SettingsStore>(context);
final settingsStore = getIt.get<AppStore>().settingsStore; final settingsStore = getIt.get<AppStore>().settingsStore;
return ChangeNotifierProvider<ThemeChanger>( if (settingsStore.theme == null) {
create: (_) => ThemeChanger( settingsStore.isDarkTheme = false;
settingsStore.isDarkTheme ? Themes.darkTheme : Themes.lightTheme),
child: ChangeNotifierProvider<Language>(
create: (_) => Language(settingsStore.languageCode),
child: MaterialAppWithTheme()));
}
}
class MaterialAppWithTheme extends StatelessWidget {
MaterialAppWithTheme();
@override
Widget build(BuildContext context) {
// final sharedPreferences = Provider.of<SharedPreferences>(context);
// final walletService = Provider.of<WalletService>(context);
// final walletListService = Provider.of<WalletListService>(context);
// final userService = Provider.of<UserService>(context);
// final settingsStore = Provider.of<SettingsStore>(context);
// final priceStore = Provider.of<PriceStore>(context);
// final walletStore = Provider.of<WalletStore>(context);
// final syncStore = Provider.of<SyncStore>(context);
// final balanceStore = Provider.of<BalanceStore>(context);
final theme = Provider.of<ThemeChanger>(context);
final currentLanguage = Provider.of<Language>(context);
// final contacts = Provider.of<Box<Contact>>(context);
// final nodes = Provider.of<Box<Node>>(context);
// final trades = Provider.of<Box<Trade>>(context);
// final transactionDescriptions =
// Provider.of<Box<TransactionDescription>>(context);
if (!isThemeChangerRegistered) {
setupThemeChangerStore(theme);
isThemeChangerRegistered = true;
} }
/*final statusBarColor =
settingsStore.isDarkTheme ? Colors.black : Colors.white;*/
final _settingsStore = getIt.get<AppStore>().settingsStore;
final statusBarColor = Colors.transparent; final statusBarColor = Colors.transparent;
final statusBarBrightness = final statusBarBrightness =
_settingsStore.isDarkTheme ? Brightness.light : Brightness.dark; settingsStore.isDarkTheme ? Brightness.light : Brightness.dark;
final statusBarIconBrightness = final statusBarIconBrightness =
_settingsStore.isDarkTheme ? Brightness.light : Brightness.dark; settingsStore.isDarkTheme ? Brightness.light : Brightness.dark;
final authenticationStore = getIt.get<AuthenticationStore>(); final authenticationStore = getIt.get<AuthenticationStore>();
final initialRoute = authenticationStore.state == AuthenticationState.denied final initialRoute = authenticationStore.state == AuthenticationState.denied
? Routes.welcome ? Routes.welcome
@ -245,22 +128,24 @@ class MaterialAppWithTheme extends StatelessWidget {
statusBarBrightness: statusBarBrightness, statusBarBrightness: statusBarBrightness,
statusBarIconBrightness: statusBarIconBrightness)); statusBarIconBrightness: statusBarIconBrightness));
return Root( return Observer(builder: (BuildContext context) {
authenticationStore: authenticationStore, return Root(
child: MaterialApp( authenticationStore: authenticationStore,
navigatorKey: navigatorKey, child: MaterialApp(
debugShowCheckedModeBanner: false, navigatorKey: navigatorKey,
theme: theme.getTheme(), debugShowCheckedModeBanner: false,
localizationsDelegates: [ theme: settingsStore.theme,
S.delegate, localizationsDelegates: [
GlobalCupertinoLocalizations.delegate, S.delegate,
GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, GlobalMaterialLocalizations.delegate,
], GlobalWidgetsLocalizations.delegate,
supportedLocales: S.delegate.supportedLocales, ],
locale: Locale(currentLanguage.getCurrentLanguage()), supportedLocales: S.delegate.supportedLocales,
onGenerateRoute: (settings) => Router.generateRoute(settings), locale: Locale(settingsStore.languageCode),
initialRoute: initialRoute, onGenerateRoute: (settings) => Router.generateRoute(settings),
)); initialRoute: initialRoute,
));
});
} }
} }

View file

@ -191,7 +191,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
@override @override
Future<void> rescan({int height}) async { Future<void> rescan({int height}) async {
// FIXME: Unimplemented monero_wallet.rescanBlockchainAsync();
} }
void _setListeners() { void _setListeners() {

View file

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:cake_wallet/reactions/on_current_node_change.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -31,4 +32,5 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
startCurrentWalletChangeReaction( startCurrentWalletChangeReaction(
appStore, settingsStore, fiatConversionStore); appStore, settingsStore, fiatConversionStore);
startCurrentFiatChangeReaction(appStore, settingsStore); startCurrentFiatChangeReaction(appStore, settingsStore);
startOnCurrentNodeChangeReaction(appStore);
} }

View file

@ -0,0 +1,17 @@
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/store/app_store.dart';
ReactionDisposer _onCurrentNodeChangeReaction;
void startOnCurrentNodeChangeReaction(AppStore appStore) {
_onCurrentNodeChangeReaction?.reaction?.dispose();
_onCurrentNodeChangeReaction =
reaction((_) => appStore.settingsStore.currentNode, (Node node) async {
try {
await appStore.wallet.connectToNode(node: node);
} catch (e) {
print(e.toString());
}
});
}

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
@ -67,7 +68,7 @@ class Router {
.pushNamed(Routes.newWallet, arguments: type))); .pushNamed(Routes.newWallet, arguments: type)));
case Routes.newWallet: case Routes.newWallet:
final type = settings.arguments as WalletType; final type = WalletType.monero; // settings.arguments as WalletType;
final walletNewVM = getIt.get<WalletNewVM>(param1: type); final walletNewVM = getIt.get<WalletNewVM>(param1: type);
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
@ -97,7 +98,7 @@ class Router {
builder: (_) => RestoreOptionsPage(type: type)); builder: (_) => RestoreOptionsPage(type: type));
case Routes.restoreWalletOptions: case Routes.restoreWalletOptions:
final type = settings.arguments as WalletType; final type = WalletType.monero; //settings.arguments as WalletType;
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => RestoreWalletOptionsPage( builder: (_) => RestoreWalletOptionsPage(
@ -215,13 +216,15 @@ class Router {
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<AuthPage>( builder: (_) => getIt.get<AuthPage>(
param1: settings.arguments as OnAuthenticationFinished)); param1: settings.arguments as OnAuthenticationFinished,
param2: true));
case Routes.unlock: case Routes.unlock:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<AuthPage>( builder: (_) => getIt.get<AuthPage>(
param1: settings.arguments as OnAuthenticationFinished)); param1: settings.arguments as OnAuthenticationFinished,
param2: false));
case Routes.nodeList: case Routes.nodeList:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
@ -249,8 +252,8 @@ class Router {
case Routes.addressBookAddContact: case Routes.addressBookAddContact:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => builder: (_) => getIt.get<ContactPage>(
getIt.get<ContactPage>(param1: settings.arguments as Contact)); param1: settings.arguments as ContactRecord));
case Routes.showKeys: case Routes.showKeys:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
@ -294,10 +297,11 @@ class Router {
return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>()); return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>());
case Routes.faq: case Routes.faq:
return MaterialPageRoute<void>(builder: (_) => FaqPage()); return MaterialPageRoute<void>(builder: (_) => getIt.get<FaqPage>());
case Routes.changeLanguage: case Routes.changeLanguage:
return MaterialPageRoute<void>(builder: (_) => ChangeLanguage()); return MaterialPageRoute<void>(
builder: (_) => getIt.get<LanguageListPage>());
default: default:
return MaterialPageRoute<void>( return MaterialPageRoute<void>(

View file

@ -1,98 +0,0 @@
// import 'dart:async';
// import 'package:flutter/foundation.dart';
// import 'package:mobx/mobx.dart';
// import 'package:cake_wallet/entities/node.dart';
// import 'package:cake_wallet/entities/sync_status.dart';
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
// import 'package:cake_wallet/src/start_updating_price.dart';
// import 'package:cake_wallet/src/stores/sync/sync_store.dart';
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
// import 'package:cake_wallet/src/stores/price/price_store.dart';
// import 'package:cake_wallet/src/stores/authentication/authentication_store.dart';
// import 'package:cake_wallet/src/stores/login/login_store.dart';
//
// Timer _reconnectionTimer;
// ReactionDisposer _connectToNodeDisposer;
// ReactionDisposer _onSyncStatusChangeDisposer;
// ReactionDisposer _onCurrentWalletChangeDisposer;
//
// void setReactions(
// {@required SettingsStore settingsStore,
// @required PriceStore priceStore,
// @required SyncStore syncStore,
// @required WalletStore walletStore,
// @required WalletService walletService,
// // @required AuthenticationStore authenticationStore,
// @required LoginStore loginStore}) {
// connectToNode(settingsStore: settingsStore, walletStore: walletStore);
// onSyncStatusChange(
// syncStore: syncStore,
// walletStore: walletStore,
// settingsStore: settingsStore);
// onCurrentWalletChange(
// walletStore: walletStore,
// settingsStore: settingsStore,
// priceStore: priceStore);
// autorun((_) async {
// // if (authenticationStore.state == AuthenticationState.allowed) {
// // await loginStore.loadCurrentWallet();
// // authenticationStore.state = AuthenticationState.readyToLogin;
// // }
// });
// }
//
// void connectToNode({SettingsStore settingsStore, WalletStore walletStore}) {
// _connectToNodeDisposer?.call();
//
// _connectToNodeDisposer = reaction((_) => settingsStore.node,
// (Node node) async => await walletStore.connectToNode(node: node));
// }
//
// void onCurrentWalletChange(
// {WalletStore walletStore,
// SettingsStore settingsStore,
// PriceStore priceStore}) {
// _onCurrentWalletChangeDisposer?.call();
//
// reaction((_) => walletStore.name, (String _) {
// walletStore.connectToNode(node: settingsStore.node);
// startUpdatingPrice(settingsStore: settingsStore, priceStore: priceStore);
// });
// }
//
// void onSyncStatusChange(
// {SyncStore syncStore,
// WalletStore walletStore,
// SettingsStore settingsStore}) {
// // _onSyncStatusChangeDisposer?.call();
//
// // reaction((_) => syncStore.status, (SyncStatus status) async {
// // if (status is ConnectedSyncStatus) {
// // await walletStore.startSync();
// // }
//
// // // Reconnect to the node if the app is not started sync after 30 seconds
// // if (status is StartingSyncStatus) {
// // startReconnectionObserver(syncStore: syncStore, walletStore: walletStore);
// // }
// // });
// }
//
// void startReconnectionObserver({SyncStore syncStore, WalletStore walletStore}) {
// if (_reconnectionTimer != null) {
// _reconnectionTimer.cancel();
// }
//
// _reconnectionTimer = Timer.periodic(Duration(minutes: 1), (_) async {
// try {
// final isConnected = await walletStore.isConnected();
//
// if (!isConnected) {
// await walletStore.reconnect();
// }
// } catch (e) {
// print(e);
// }
// });
// }

View file

@ -27,7 +27,7 @@ class AuthPageState extends State<AuthPage> {
final _key = GlobalKey<ScaffoldState>(); final _key = GlobalKey<ScaffoldState>();
final _pinCodeKey = GlobalKey<PinCodeState>(); final _pinCodeKey = GlobalKey<PinCodeState>();
final _backArrowImageDarkTheme = final _backArrowImageDarkTheme =
Image.asset('assets/images/back_arrow_dark_theme.png'); Image.asset('assets/images/close_button.png');
ReactionDisposer _reaction; ReactionDisposer _reaction;
@override @override
@ -122,9 +122,11 @@ class AuthPageState extends State<AuthPage> {
key: _key, key: _key,
appBar: CupertinoNavigationBar( appBar: CupertinoNavigationBar(
leading: widget.closable leading: widget.closable
? SizedBox( ? Container(
padding: EdgeInsets.only(top: 10),
child: SizedBox(
height: 37, height: 37,
width: 20, width: 37,
child: ButtonTheme( child: ButtonTheme(
minWidth: double.minPositive, minWidth: double.minPositive,
child: FlatButton( child: FlatButton(
@ -134,7 +136,7 @@ class AuthPageState extends State<AuthPage> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: _backArrowImageDarkTheme), child: _backArrowImageDarkTheme),
), ),
) ))
: Container(), : Container(),
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).backgroundColor,
border: null), border: null),

View file

@ -1,14 +1,22 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/nav_bar.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/themes.dart';
import 'package:cake_wallet/theme_changer.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/src/widgets/nav_bar.dart';
enum AppBarStyle { regular, withShadow, transparent } enum AppBarStyle { regular, withShadow, transparent }
abstract class BasePage extends StatelessWidget { abstract class BasePage extends StatelessWidget {
BasePage()
: _scaffoldKey = GlobalKey<ScaffoldState>(),
_closeButtonImage = Image.asset('assets/images/close_button.png'),
_closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
final GlobalKey<ScaffoldState> _scaffoldKey;
final Image _closeButtonImage;
final Image _closeButtonImageDarkTheme;
String get title => null; String get title => null;
bool get isModalBackButton => false; bool get isModalBackButton => false;
@ -29,11 +37,7 @@ abstract class BasePage extends StatelessWidget {
Widget Function(BuildContext, Widget) get rootWrapper => null; Widget Function(BuildContext, Widget) get rootWrapper => null;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); bool get _isDarkTheme => getIt.get<SettingsStore>().isDarkTheme;
final _closeButtonImage = Image.asset('assets/images/close_button.png');
final _closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer(); void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer();
@ -45,12 +49,9 @@ abstract class BasePage extends StatelessWidget {
} }
final _backButton = Image.asset('assets/images/back_arrow.png', final _backButton = Image.asset('assets/images/back_arrow.png',
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color); color: titleColor ?? Theme.of(context).primaryTextTheme.title.color);
final _closeButton =
final _themeChanger = Provider.of<ThemeChanger>(context); _isDarkTheme ? _closeButtonImageDarkTheme : _closeButtonImage;
final _closeButton = _themeChanger.getTheme() == Themes.darkTheme
? _closeButtonImageDarkTheme
: _closeButtonImage;
return SizedBox( return SizedBox(
height: 37, height: 37,
@ -77,7 +78,7 @@ abstract class BasePage extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: titleColor ?? color: titleColor ??
Theme.of(context).primaryTextTheme.title.color), Theme.of(context).primaryTextTheme.title.color),
); );
} }
@ -86,10 +87,8 @@ abstract class BasePage extends StatelessWidget {
Widget floatingActionButton(BuildContext context) => null; Widget floatingActionButton(BuildContext context) => null;
ObstructingPreferredSizeWidget appBar(BuildContext context) { ObstructingPreferredSizeWidget appBar(BuildContext context) {
final _themeChanger = Provider.of<ThemeChanger>(context); final appBarColor =
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme; _isDarkTheme ? backgroundDarkColor : backgroundLightColor;
final appBarColor = _isDarkTheme
? backgroundDarkColor : backgroundLightColor;
switch (appBarStyle) { switch (appBarStyle) {
case AppBarStyle.regular: case AppBarStyle.regular:
@ -131,9 +130,6 @@ abstract class BasePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _themeChanger = Provider.of<ThemeChanger>(context);
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
final root = Scaffold( final root = Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
backgroundColor: backgroundColor:
@ -142,7 +138,7 @@ abstract class BasePage extends StatelessWidget {
extendBodyBehindAppBar: extendBodyBehindAppBar, extendBodyBehindAppBar: extendBodyBehindAppBar,
endDrawer: endDrawer, endDrawer: endDrawer,
appBar: appBar(context), appBar: appBar(context),
body: body(context), //SafeArea(child: ), body: body(context),
floatingActionButton: floatingActionButton(context)); floatingActionButton: floatingActionButton(context));
return rootWrapper?.call(context, root) ?? root; return rootWrapper?.call(context, root) ?? root;

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -172,8 +173,8 @@ class ContactListPage extends BasePage {
], ],
dismissal: SlidableDismissal( dismissal: SlidableDismissal(
child: SlidableDrawerDismissal(), child: SlidableDrawerDismissal(),
onDismissed: (actionType) async => onDismissed: (actionType) async => null,
await contactListViewModel.delete(contact), // await contactListViewModel.delete(contact),
onWillDismiss: (actionType) async => onWillDismiss: (actionType) async =>
showAlertDialog(context), showAlertDialog(context),
), ),
@ -252,7 +253,7 @@ class ContactListPage extends BasePage {
} }
Future<bool> showAlertDialog(BuildContext context) async { Future<bool> showAlertDialog(BuildContext context) async {
return await showDialog( return await showPopUp(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
@ -267,7 +268,7 @@ class ContactListPage extends BasePage {
Future<bool> showNameAndAddressDialog( Future<bool> showNameAndAddressDialog(
BuildContext context, String name, String address) async { BuildContext context, String name, String address) async {
return await showDialog( return await showPopUp(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -138,7 +139,7 @@ class ContactPage extends BasePage {
} }
void _presentCurrencyPicker(BuildContext context) { void _presentCurrencyPicker(BuildContext context) {
showDialog<void>( showPopUp<void>(
builder: (_) => CurrencyPicker( builder: (_) => CurrencyPicker(
selectedAtIndex: selectedAtIndex:
contactViewModel.currencies.indexOf(contactViewModel.currency), contactViewModel.currencies.indexOf(contactViewModel.currency),
@ -150,7 +151,7 @@ class ContactPage extends BasePage {
} }
void _onContactSavingFailure(BuildContext context, String error) { void _onContactSavingFailure(BuildContext context, String error) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -1,33 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/exchange/trade.dart';
// import 'package:cake_wallet/monero/transaction_description.dart';
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
// import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
// import 'package:cake_wallet/src/stores/action_list/action_list_store.dart';
// import 'package:cake_wallet/src/stores/action_list/trade_filter_store.dart';
// import 'package:cake_wallet/src/stores/action_list/transaction_filter_store.dart';
// import 'package:cake_wallet/src/stores/price/price_store.dart';
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
// FIXME: Remove me.
// Widget createDashboardPage(
// {@required WalletService walletService,
// @required PriceStore priceStore,
// @required Box<TransactionDescription> transactionDescriptions,
// @required SettingsStore settingsStore,
// @required Box<Trade> trades,
// @required WalletStore walletStore}) =>
// Provider(
// create: (_) => ActionListStore(
// walletService: walletService,
// settingsStore: settingsStore,
// priceStore: priceStore,
// tradesSource: trades,
// transactionFilterStore: TransactionFilterStore(),
// tradeFilterStore: TradeFilterStore(walletStore: walletStore),
// transactionDescriptions: transactionDescriptions),
// child: DashboardPage());

View file

@ -103,29 +103,18 @@ class DashboardPage extends BasePage {
activeDotColor: Colors.white), activeDotColor: Colors.white),
)), )),
Container( Container(
width: double.infinity, padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
padding: EdgeInsets.only(
left: 45,
right: 45,
bottom: 24
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
Flexible( ActionButton(
child: ActionButton(
image: sendImage, image: sendImage,
title: S.of(context).send, title: S.of(context).send,
route: Routes.send, route: Routes.send),
alignment: Alignment.centerLeft, ActionButton(
), image: exchangeImage,
), title: S.of(context).exchange,
Flexible( route: Routes.exchange),
child: ActionButton(
image: exchangeImage,
title: S.of(context).exchange,
route: Routes.exchange
),
),
], ],
), ),
) )

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -72,7 +73,7 @@ class WalletMenu {
} }
Future<void> _presentReconnectAlert(BuildContext context) async { Future<void> _presentReconnectAlert(BuildContext context) async {
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(

View file

@ -15,8 +15,6 @@ class ActionButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity,
height: 93,
alignment: alignment, alignment: alignment,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -38,6 +36,7 @@ class ActionButton extends StatelessWidget {
child: image, child: image,
), ),
), ),
SizedBox(height: 15),
Text( Text(
title, title,
style: TextStyle(fontSize: 14, color: Colors.white), style: TextStyle(fontSize: 14, color: Colors.white),

View file

@ -11,57 +11,42 @@ class BalancePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: Center( child: Column(
child: Container( mainAxisAlignment: MainAxisAlignment.center,
height: 160, crossAxisAlignment: CrossAxisAlignment.center,
child: Column( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, Observer(builder: (_) {
crossAxisAlignment: CrossAxisAlignment.center, return Text(
children: <Widget>[ dashboardViewModel.balanceViewModel.currency.toString(),
Observer( style: TextStyle(
builder: (_) { fontSize: 40,
return Text( fontWeight: FontWeight.bold,
dashboardViewModel.wallet.currency.toString(), color: Theme.of(context).indicatorColor,
style: TextStyle( height: 1),
fontSize: 40, );
fontWeight: FontWeight.bold, }),
color: Theme.of(context).indicatorColor, SizedBox(height: 10),
height: 1 Observer(builder: (_) {
), return Text(dashboardViewModel.balanceViewModel.cryptoBalance,
); style: TextStyle(
} fontSize: 54,
), fontWeight: FontWeight.bold,
Observer( color: Colors.white,
builder: (_) { height: 1),
return Text( textAlign: TextAlign.center);
dashboardViewModel.balanceViewModel.cryptoBalance, }),
style: TextStyle( SizedBox(height: 10),
fontSize: 54, Observer(builder: (_) {
fontWeight: FontWeight.bold, return Text(dashboardViewModel.balanceViewModel.fiatBalance,
color: Colors.white, style: TextStyle(
height: 1 fontSize: 18,
), fontWeight: FontWeight.w500,
); color: Theme.of(context).indicatorColor,
} height: 1),
), textAlign: TextAlign.center);
Observer( }),
builder: (_) { ],
return Text(
dashboardViewModel.balanceViewModel.fiatBalance,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).indicatorColor,
height: 1
),
);
}
),
],
),
),
), ),
); );
} }
} }

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@ -31,7 +32,7 @@ class HeaderRow extends StatelessWidget {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel) builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel)
); );

View file

@ -3,13 +3,13 @@ import 'package:cake_wallet/entities/transaction_direction.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
class TransactionRow extends StatelessWidget { class TransactionRow extends StatelessWidget {
TransactionRow({ TransactionRow(
this.direction, {this.direction,
this.formattedDate, this.formattedDate,
this.formattedAmount, this.formattedAmount,
this.formattedFiatAmount, this.formattedFiatAmount,
this.isPending, this.isPending,
@required this.onTap}); @required this.onTap});
final VoidCallback onTap; final VoidCallback onTap;
final TransactionDirection direction; final TransactionDirection direction;
@ -23,75 +23,73 @@ class TransactionRow extends StatelessWidget {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
child: Container( child: Container(
height: 52, height: 62,
color: Colors.transparent, color: Colors.transparent,
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 24, right: 24),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme.overline.decorationColor
),
child: Image.asset(
direction == TransactionDirection.incoming
? 'assets/images/down_arrow.png'
: 'assets/images/up_arrow.png'),
),
Expanded( Expanded(
child: Padding( child: Container(
padding: const EdgeInsets.only(left: 12), height: 56,
child: Container( child: Column(
height: 46, mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column( mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
mainAxisSize: MainAxisSize.max, Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Row( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, Text(
children: <Widget>[ (direction == TransactionDirection.incoming
Text(
(direction == TransactionDirection.incoming
? S.of(context).received ? S.of(context).received
: S.of(context).sent) + : S.of(context).sent) +
(isPending ? S.of(context).pending : ''), (isPending ? S.of(context).pending : ''),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white)),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(10)),
color: (direction ==
TransactionDirection.incoming
? Colors.green.withOpacity(0.8)
: Theme.of(context)
.accentTextTheme
.body2
.decorationColor
.withOpacity(0.8))),
padding: EdgeInsets.only(
top: 3, bottom: 3, left: 10, right: 10),
child: Text(formattedAmount,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.white color: Colors.white)))
)), ]),
Text(direction == TransactionDirection.incoming Row(
? formattedAmount mainAxisAlignment: MainAxisAlignment.spaceBetween,
: '- ' + formattedAmount, children: <Widget>[
style: TextStyle( Text(formattedDate,
fontSize: 16, style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 14,
color: Colors.white color: Theme.of(context)
)) .textTheme
]), .overline
Row( .backgroundColor)),
mainAxisAlignment: MainAxisAlignment.spaceBetween, Text(formattedFiatAmount,
children: <Widget>[ style: TextStyle(
Text(formattedDate, fontSize: 14,
style: TextStyle( color: Theme.of(context)
fontSize: 14, .textTheme
color: Theme.of(context).textTheme .overline
.overline.backgroundColor)), .backgroundColor))
Text(direction == TransactionDirection.incoming ]),
? formattedFiatAmount ],
: '- ' + formattedFiatAmount, ),
style: TextStyle( ),
fontSize: 14, )
color: Theme.of(context).textTheme
.overline.backgroundColor))
]),
],
),
),
))
]), ]),
)); ));
} }

View file

@ -1,5 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -51,7 +52,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
} }
Future<void> _showAlertDialog(BuildContext context) async { Future<void> _showAlertDialog(BuildContext context) async {
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart'; import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:cake_wallet/src/widgets/trail_button.dart'; import 'package:cake_wallet/src/widgets/trail_button.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -293,7 +294,7 @@ class ExchangePage extends BasePage {
exchangeViewModel, template); exchangeViewModel, template);
}, },
onRemove: () { onRemove: () {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (dialogContext) { builder: (dialogContext) {
return AlertWithTwoActions( return AlertWithTwoActions(
@ -492,7 +493,7 @@ class ExchangePage extends BasePage {
// reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) { // reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) {
// if (state is TradeIsCreatedFailure) { // if (state is TradeIsCreatedFailure) {
// WidgetsBinding.instance.addPostFrameCallback((_) { // WidgetsBinding.instance.addPostFrameCallback((_) {
// showDialog<void>( // showPopUp<void>(
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertWithOneAction( // return AlertWithOneAction(

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -145,11 +146,11 @@ class ExchangeCardState extends State<ExchangeCard> {
textAlign: TextAlign.left, textAlign: TextAlign.left,
keyboardType: TextInputType.numberWithOptions( keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true), signed: false, decimal: true),
inputFormatters: [ // inputFormatters: [
LengthLimitingTextInputFormatter(15), // LengthLimitingTextInputFormatter(15),
BlacklistingTextInputFormatter( // BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]')) // RegExp('[\\-|\\ |\\,]'))
], // ],
hintText: '0.0000', hintText: '0.0000',
borderColor: widget.borderColor, borderColor: widget.borderColor,
textStyle: TextStyle( textStyle: TextStyle(
@ -303,7 +304,7 @@ class ExchangeCardState extends State<ExchangeCard> {
} }
void _presentPicker(BuildContext context) { void _presentPicker(BuildContext context) {
showDialog<void>( showPopUp<void>(
builder: (_) => CurrencyPicker( builder: (_) => CurrencyPicker(
selectedAtIndex: widget.currencies.indexOf(_selectedCurrency), selectedAtIndex: widget.currencies.indexOf(_selectedCurrency),
items: widget.currencies, items: widget.currencies,

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/exchange/exchange_provider.dart'; import 'package:cake_wallet/exchange/exchange_provider.dart';
@ -72,7 +73,7 @@ class PresentProviderPicker extends StatelessWidget {
} }
} }
showDialog<void>( showPopUp<void>(
builder: (_) => Picker( builder: (_) => Picker(
items: items, items: items,
images: images, images: images,

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart'; import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -37,7 +38,7 @@ void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext
: S.current.exchange_result_description( : S.current.exchange_result_description(
trade.amount ?? fetchingLabel, trade.from.toString()); trade.amount ?? fetchingLabel, trade.from.toString());
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (_) => InformationPage(information: information) builder: (_) => InformationPage(information: information)
); );
@ -255,7 +256,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
reaction((_) => sendStore.state, (SendingState state) { reaction((_) => sendStore.state, (SendingState state) {
if (state is SendingFailed) { if (state is SendingFailed) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(
@ -270,7 +271,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
if (state is TransactionCreatedSuccessfully) { if (state is TransactionCreatedSuccessfully) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
@ -292,7 +293,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
if (state is TransactionCommitted) { if (state is TransactionCommitted) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class FAQItem extends StatefulWidget {
FAQItem(this.title, this.text);
final String title;
final String text;
@override
State<StatefulWidget> createState() => FAQItemState();
}
class FAQItemState extends State<FAQItem> {
bool isActive;
@override
void initState() {
isActive = false;
super.initState();
}
@override
Widget build(BuildContext context) {
final addIcon =
Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
final icon = isActive ? removeIcon : addIcon;
final color = isActive
? Palette.blueCraiola
: Theme.of(context).primaryTextTheme.title.color;
return ListTileTheme(
contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
child: ExpansionTile(
title: Text(widget.title,
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500, color: color)),
trailing: icon,
onExpansionChanged: (value) => setState(() => isActive = value),
children: <Widget>[
Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.only(
right: 24.0,
),
child: Text(
widget.text,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).primaryTextTheme.title.color),
),
))
])
],
),
);
}
}

View file

@ -1,46 +1,30 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/src/screens/faq/faq_item.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/store/settings_store.dart';
class FaqPage extends BasePage { class FaqPage extends BasePage {
FaqPage(this.settingsStore);
final SettingsStore settingsStore;
@override @override
String get title => S.current.faq; String get title => S.current.faq;
@override String get path => 'assets/faq/faq_' + settingsStore.languageCode + '.json';
Widget body(BuildContext context) => FaqForm();
}
class FaqForm extends StatefulWidget {
@override
FaqFormState createState() => FaqFormState();
}
class FaqFormState extends State<FaqForm> {
List<Icon> icons;
List<Color> colors;
bool isLoaded = false;
@override @override
Widget build(BuildContext context) { Widget body(BuildContext context) {
final addIcon = Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
return Container( return Container(
padding: EdgeInsets.only(top: 12, left: 24), padding: EdgeInsets.only(top: 12, left: 24),
child: FutureBuilder( child: FutureBuilder(
builder: (context, snapshot) { builder: (context, snapshot) {
final faqItems = jsonDecode(snapshot.data.toString()) as List; final faqItems = jsonDecode(snapshot.data.toString()) as List;
if (snapshot.hasData) {
setIconsAndColors(context, faqItems.length, addIcon);
}
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -49,112 +33,20 @@ class FaqFormState extends State<FaqForm> {
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final itemTitle = faqItems[index]["question"].toString(); final title = faqItems[index]["question"].toString();
final itemChild = faqItems[index]["answer"].toString(); final text = faqItems[index]["answer"].toString();
return ListTileTheme( return FAQItem(title, text);
contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
child: ExpansionTile(
title: Text(
itemTitle,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: colors[index]
),
),
trailing: icons[index],
onExpansionChanged: (value) {
setState(() {
if (value) {
icons[index] = removeIcon;
colors[index] = Palette.blueCraiola;
} else {
icons[index] = addIcon;
colors[index] = Theme.of(context).primaryTextTheme.title.color;
}
});
},
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.only(
right: 24.0,
),
child: Text(
itemChild,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).primaryTextTheme.title.color
),
),
))
],
)
],
),
);
}, },
separatorBuilder: (_, __) => separatorBuilder: (_, __) => StandardListSeparator(),
StandardListSeparator(), itemCount: faqItems?.length ?? 0,
itemCount: faqItems == null ? 0 : faqItems.length,
) )
], ],
), ),
); );
}, },
future: rootBundle.loadString(getFaqPath(context)), future: rootBundle.loadString(path),
), ),
); );
} }
}
void setIconsAndColors(BuildContext context, int index, Icon icon) {
if (isLoaded) {
return;
}
icons = List.generate(index, (int i) => icon);
colors = List.generate(index, (int i) => Theme.of(context).primaryTextTheme.title.color);
isLoaded = true;
}
String getFaqPath(BuildContext context) {
// FIXME: FIXME
// final settingsStore = Provider.of<SettingsStore>(context);
//
// switch (settingsStore.languageCode) {
// case 'en':
// return 'assets/faq/faq_en.json';
// case 'uk':
// return 'assets/faq/faq_uk.json';
// case 'ru':
// return 'assets/faq/faq_ru.json';
// case 'es':
// return 'assets/faq/faq_es.json';
// case 'ja':
// return 'assets/faq/faq_ja.json';
// case 'ko':
// return 'assets/faq/faq_ko.json';
// case 'hi':
// return 'assets/faq/faq_hi.json';
// case 'de':
// return 'assets/faq/faq_de.json';
// case 'zh':
// return 'assets/faq/faq_zh.json';
// case 'pt':
// return 'assets/faq/faq_pt.json';
// case 'pl':
// return 'assets/faq/faq_pl.json';
// case 'nl':
// return 'assets/faq/faq_nl.json';
// default:
// return 'assets/faq/faq_en.json';
// }
return '';
}
}

View file

@ -31,7 +31,7 @@ class AccountTile extends StatelessWidget {
accountName, accountName,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: textColor, color: textColor,
decoration: TextDecoration.none, decoration: TextDecoration.none,

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -60,7 +61,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
if (state is FailureState) { if (state is FailureState) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (_) { builder: (_) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -29,7 +30,7 @@ class NodeListPage extends BasePage {
minWidth: double.minPositive, minWidth: double.minPositive,
child: FlatButton( child: FlatButton(
onPressed: () async { onPressed: () async {
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
@ -66,87 +67,86 @@ class NodeListPage extends BasePage {
sectionCount: 2, sectionCount: 2,
context: context, context: context,
itemBuilder: (_, sectionIndex, index) { itemBuilder: (_, sectionIndex, index) {
if (sectionIndex == 0) { return Observer(builder: (_) {
return NodeHeaderListRow( if (sectionIndex == 0) {
title: S.of(context).add_new_node, return NodeHeaderListRow(
onTap: (_) async => title: S.of(context).add_new_node,
await Navigator.of(context).pushNamed(Routes.newNode)); onTap: (_) async => await Navigator.of(context)
} .pushNamed(Routes.newNode));
}
final node = nodeListViewModel.nodes[index]; final node = nodeListViewModel.nodes[index];
final nodeListRow = NodeListRow( final isSelected = node.keyIndex ==
title: node.value.uri, nodeListViewModel.settingsStore.currentNode.keyIndex;
isSelected: node.isSelected, final nodeListRow = NodeListRow(
isAlive: node.value.requestNode(), title: node.uri,
onTap: (_) async { isSelected: isSelected,
if (node.isSelected) { isAlive: node.requestNode(),
return; onTap: (_) async {
} if (isSelected) {
return;
}
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( // FIXME: Add translation.
content: Text( return AlertWithTwoActions(
S.of(context).change_current_node(node.value.uri), alertTitle: 'Change current node',
textAlign: TextAlign.center, alertContent:
S.of(context).change_current_node(node.uri),
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).change,
actionLeftButton: () =>
Navigator.of(context).pop(),
actionRightButton: () async {
await nodeListViewModel.setAsCurrent(node);
Navigator.of(context).pop();
});
});
});
final dismissibleRow = Dismissible(
key: Key('${node.keyIndex}'),
confirmDismiss: (direction) async {
return await showPopUp(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
alertTitle: S.of(context).remove_node,
alertContent: S.of(context).remove_node_message,
rightButtonText: S.of(context).remove,
leftButtonText: S.of(context).cancel,
actionRightButton: () =>
Navigator.pop(context, true),
actionLeftButton: () =>
Navigator.pop(context, false));
});
},
onDismissed: (direction) async =>
nodeListViewModel.delete(node),
direction: DismissDirection.endToStart,
background: Container(
padding: EdgeInsets.only(right: 10.0),
alignment: AlignmentDirectional.centerEnd,
color: Palette.red,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Icon(
CupertinoIcons.delete,
color: Colors.white,
), ),
actions: <Widget>[ Text(
FlatButton( S.of(context).delete,
onPressed: () => Navigator.pop(context), style: TextStyle(color: Colors.white),
child: Text(S.of(context).cancel)), )
FlatButton( ],
onPressed: () async { )),
Navigator.of(context).pop(); child: nodeListRow);
await nodeListViewModel
.setAsCurrent(node.value);
},
child: Text(S.of(context).change)),
],
);
});
});
final dismissibleRow = Dismissible( return isSelected ? nodeListRow : dismissibleRow;
key: Key('${node.keyIndex}'), });
confirmDismiss: (direction) async {
return await showDialog(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
alertTitle: S.of(context).remove_node,
alertContent: S.of(context).remove_node_message,
rightButtonText: S.of(context).remove,
leftButtonText: S.of(context).cancel,
actionRightButton: () =>
Navigator.pop(context, true),
actionLeftButton: () =>
Navigator.pop(context, false));
});
},
onDismissed: (direction) async =>
nodeListViewModel.delete(node.value),
direction: DismissDirection.endToStart,
background: Container(
padding: EdgeInsets.only(right: 10.0),
alignment: AlignmentDirectional.centerEnd,
color: Palette.red,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Icon(
CupertinoIcons.delete,
color: Colors.white,
),
Text(
S.of(context).delete,
style: TextStyle(color: Colors.white),
)
],
)),
child: nodeListRow);
return node.isSelected ? nodeListRow : dismissibleRow;
}, },
itemCounter: (int sectionIndex) { itemCounter: (int sectionIndex) {
if (sectionIndex == 0) { if (sectionIndex == 0) {

View file

@ -266,7 +266,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
return; return;
} }
pin.substring(0, pin.length - 1); setState(() => pin = pin.substring(0, pin.length - 1));
} }
String _changePinLengthText() { String _changePinLengthText() {

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -34,21 +35,19 @@ class ReceivePage extends BasePage {
@override @override
Widget Function(BuildContext, Widget) get rootWrapper => Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container( (BuildContext context, Widget scaffold) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient(colors: [ gradient: LinearGradient(colors: [
Theme.of(context).accentColor, Theme.of(context).accentColor,
Theme.of(context).scaffoldBackgroundColor, Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor, Theme.of(context).primaryColor,
], ], begin: Alignment.topRight, end: Alignment.bottomLeft)),
begin: Alignment.topRight,
end: Alignment.bottomLeft)),
child: scaffold); child: scaffold);
@override @override
Widget trailing(BuildContext context) { Widget trailing(BuildContext context) {
final shareImage = Image.asset('assets/images/share.png', final shareImage =
color: Colors.white); Image.asset('assets/images/share.png', color: Colors.white);
return SizedBox( return SizedBox(
height: 20.0, height: 20.0,
@ -56,12 +55,12 @@ class ReceivePage extends BasePage {
child: ButtonTheme( child: ButtonTheme(
minWidth: double.minPositive, minWidth: double.minPositive,
child: FlatButton( child: FlatButton(
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
splashColor: Colors.transparent, splashColor: Colors.transparent,
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
onPressed: () => Share.text(S.current.share_address, onPressed: () => Share.text(S.current.share_address,
addressListViewModel.address.address, 'text/plain'), addressListViewModel.address.address, 'text/plain'),
child: shareImage), child: shareImage),
), ),
); );
} }
@ -80,10 +79,9 @@ class ReceivePage extends BasePage {
), ),
Observer( Observer(
builder: (_) => ListView.separated( builder: (_) => ListView.separated(
separatorBuilder: (context, _) => padding: EdgeInsets.all(0),
Container( separatorBuilder: (context, _) => Container(
height: 1, height: 1, color: Theme.of(context).dividerColor),
color: Theme.of(context).dividerColor),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length, itemCount: addressListViewModel.items.length,
@ -93,9 +91,10 @@ class ReceivePage extends BasePage {
if (item is WalletAccountListHeader) { if (item is WalletAccountListHeader) {
cell = HeaderTile( cell = HeaderTile(
onTap: () async => await showDialog<void>( onTap: () async => await showPopUp<void>(
context: context, context: context,
builder: (_) => getIt.get<MoneroAccountListPage>()), builder: (_) =>
getIt.get<MoneroAccountListPage>()),
title: addressListViewModel.accountLabel, title: addressListViewModel.accountLabel,
icon: Icon( icon: Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
@ -117,27 +116,31 @@ class ReceivePage extends BasePage {
} }
if (item is WalletAddressListItem) { if (item is WalletAddressListItem) {
cell = Observer( cell = Observer(builder: (_) {
builder: (_) { final isCurrent = item.address ==
final isCurrent = item.address == addressListViewModel.address.address;
addressListViewModel.address.address; final backgroundColor = isCurrent
final backgroundColor = isCurrent ? Theme.of(context)
? Theme.of(context).textTheme.display3.decorationColor .textTheme
: Theme.of(context).textTheme.display2.decorationColor; .display3
final textColor = isCurrent .decorationColor
? Theme.of(context).textTheme.display3.color : Theme.of(context)
: Theme.of(context).textTheme.display2.color; .textTheme
.display2
.decorationColor;
final textColor = isCurrent
? Theme.of(context).textTheme.display3.color
: Theme.of(context).textTheme.display2.color;
return AddressCell.fromItem(item, return AddressCell.fromItem(item,
isCurrent: isCurrent, isCurrent: isCurrent,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
textColor: textColor, textColor: textColor,
onTap: (_) => addressListViewModel.address = item, onTap: (_) => addressListViewModel.address = item,
onEdit: () => Navigator.of(context).pushNamed( onEdit: () => Navigator.of(context).pushNamed(
Routes.newSubaddress, Routes.newSubaddress,
arguments: item)); arguments: item));
} });
);
} }
return index != 0 return index != 0

View file

@ -80,7 +80,7 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
if (state is WalletRestorationFailure) { if (state is WalletRestorationFailure) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -53,7 +54,7 @@ class _RestoreFromSeedDetailsFormState
if (state is FailureState) { if (state is FailureState) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -1,6 +1,8 @@
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -24,9 +26,28 @@ class WalletSeedPage extends BasePage {
final WalletSeedViewModel walletSeedViewModel; final WalletSeedViewModel walletSeedViewModel;
@override @override
void onClose(BuildContext context) => isNewWalletCreated void onClose(BuildContext context) async {
? Navigator.of(context).popUntil((route) => route.isFirst) if (isNewWalletCreated) {
: Navigator.of(context).pop(); final confirmed = await showPopUp<bool>(context: context, builder: (BuildContext context) {
// FIXME: add translations
return AlertWithTwoActions(
alertTitle: 'Attention',
alertContent: 'The seed is the only way to recover your wallet. Have you written it down?',
leftButtonText: 'Go back',
rightButtonText: 'Yes, I have',
actionLeftButton: () => Navigator.of(context).pop(false),
actionRightButton: () => Navigator.of(context).pop(true));
}) ?? false;
if (confirmed) {
Navigator.of(context).popUntil((route) => route.isFirst);
}
return;
}
Navigator.of(context).pop();
}
@override @override
Widget leading(BuildContext context) => Widget leading(BuildContext context) =>
@ -36,31 +57,39 @@ class WalletSeedPage extends BasePage {
Widget trailing(BuildContext context) { Widget trailing(BuildContext context) {
return isNewWalletCreated return isNewWalletCreated
? GestureDetector( ? GestureDetector(
onTap: () => onClose(context), onTap: () => onClose(context),
child: Container( child: Container(
width: 100, width: 100,
height: 32, height: 32,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16)), borderRadius: BorderRadius.all(Radius.circular(16)),
color: Theme.of(context).accentTextTheme.caption.color), color: Theme
child: Text( .of(context)
S.of(context).seed_language_next, .accentTextTheme
style: TextStyle( .caption
fontSize: 14, .color),
fontWeight: FontWeight.w600, child: Text(
color: Palette.blueCraiola), S
), .of(context)
), .seed_language_next,
) style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Palette.blueCraiola),
),
),
)
: Offstage(); : Offstage();
} }
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final image = final image =
getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight; getIt
.get<SettingsStore>()
.isDarkTheme ? imageDark : imageLight;
return Container( return Container(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
@ -87,21 +116,23 @@ class WalletSeedPage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context) color: Theme
.of(context)
.primaryTextTheme .primaryTextTheme
.title .title
.color), .color),
), ),
Padding( Padding(
padding: padding:
EdgeInsets.only(top: 20, left: 16, right: 16), EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text( child: Text(
walletSeedViewModel.seed, walletSeedViewModel.seed,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context) color: Theme
.of(context)
.primaryTextTheme .primaryTextTheme
.caption .caption
.color), .color),
@ -115,62 +146,78 @@ class WalletSeedPage extends BasePage {
children: <Widget>[ children: <Widget>[
isNewWalletCreated isNewWalletCreated
? Padding( ? Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: 52, left: 43, right: 43), bottom: 52, left: 43, right: 43),
child: Text( child: Text(
S.of(context).seed_reminder, S
textAlign: TextAlign.center, .of(context)
style: TextStyle( .seed_reminder,
fontSize: 12, textAlign: TextAlign.center,
fontWeight: FontWeight.normal, style: TextStyle(
color: Theme.of(context) fontSize: 12,
.primaryTextTheme fontWeight: FontWeight.normal,
.overline color: Theme
.color), .of(context)
), .primaryTextTheme
) .overline
.color),
),
)
: Offstage(), : Offstage(),
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(right: 8.0), padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton( child: PrimaryButton(
onPressed: () => Share.text( onPressed: () =>
S.of(context).seed_share, Share.text(
walletSeedViewModel.seed, S
'text/plain'), .of(context)
text: S.of(context).save, .seed_share,
color: Colors.green, walletSeedViewModel.seed,
textColor: Colors.white), 'text/plain'),
)), text: S
.of(context)
.save,
color: Colors.green,
textColor: Colors.white),
)),
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(left: 8.0), padding: EdgeInsets.only(left: 8.0),
child: Builder( child: Builder(
builder: (context) => PrimaryButton( builder: (context) =>
onPressed: () { PrimaryButton(
Clipboard.setData(ClipboardData( onPressed: () {
text: walletSeedViewModel.seed)); Clipboard.setData(ClipboardData(
Scaffold.of(context).showSnackBar( text: walletSeedViewModel
SnackBar( .seed));
content: Text(S Scaffold.of(context)
.of(context) .showSnackBar(
.copied_to_clipboard), SnackBar(
backgroundColor: Colors.green, content: Text(S
duration: .of(context)
Duration(milliseconds: 1500), .copied_to_clipboard),
), backgroundColor: Colors
); .green,
}, duration:
text: S.of(context).copy, Duration(
color: Theme.of(context) milliseconds: 1500),
.accentTextTheme ),
.body2 );
.color, },
textColor: Colors.white)), text: S
)) .of(context)
.copy,
color: Theme
.of(context)
.accentTextTheme
.body2
.color,
textColor: Colors.white)),
))
], ],
) )
], ],

View file

@ -1,4 +1,5 @@
import 'dart:ui'; import 'dart:ui';
// import 'package:cake_wallet/src/domain/common/transaction_priority.dart'; // import 'package:cake_wallet/src/domain/common/transaction_priority.dart';
import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
@ -6,6 +7,7 @@ import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/widgets/trail_button.dart'; import 'package:cake_wallet/src/widgets/trail_button.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/send/send_view_model_state.dart'; import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -19,6 +21,7 @@ import 'package:dotted_border/dotted_border.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart'; import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
// import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart'; // import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart'; import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
@ -69,8 +72,7 @@ class SendPage extends BasePage {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24), bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24) bottomRight: Radius.circular(24)),
),
gradient: LinearGradient(colors: [ gradient: LinearGradient(colors: [
Theme.of(context).primaryTextTheme.subhead.color, Theme.of(context).primaryTextTheme.subhead.color,
Theme.of(context).primaryTextTheme.subhead.decorationColor, Theme.of(context).primaryTextTheme.subhead.decorationColor,
@ -105,10 +107,14 @@ class SendPage extends BasePage {
AddressTextFieldOption.qrCode, AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook AddressTextFieldOption.addressBook
], ],
buttonColor: buttonColor: Theme.of(context)
Theme.of(context).primaryTextTheme.display1.color, .primaryTextTheme
borderColor: .display1
Theme.of(context).primaryTextTheme.headline.color, .color,
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -122,83 +128,76 @@ class SendPage extends BasePage {
.decorationColor), .decorationColor),
validator: sendViewModel.addressValidator, validator: sendViewModel.addressValidator,
), ),
Observer(builder: (_) { Padding(
return Padding( padding: const EdgeInsets.only(top: 20),
padding: const EdgeInsets.only(top: 20), child: BaseTextFormField(
child: BaseTextFormField( controller: _cryptoAmountController,
controller: _cryptoAmountController, keyboardType: TextInputType.numberWithOptions(
keyboardType: TextInputType.numberWithOptions( signed: false, decimal: true),
signed: false, decimal: true), prefixIcon: Padding(
inputFormatters: [ padding: EdgeInsets.only(top: 9),
BlacklistingTextInputFormatter( child:
RegExp('[\\-|\\ |\\,]')) Text(sendViewModel.currency.title + ':',
], style: TextStyle(
prefixIcon: Padding( fontSize: 16,
padding: EdgeInsets.only(top: 9), fontWeight: FontWeight.w600,
child: color: Colors.white,
Text(sendViewModel.currency.title + ':', )),
style: TextStyle( ),
fontSize: 16, suffixIcon: Container(
fontWeight: FontWeight.w600, height: 32,
color: Colors.white, width: 32,
)), margin: EdgeInsets.only(
), left: 14, top: 4, bottom: 10),
suffixIcon: Container( decoration: BoxDecoration(
height: 32,
width: 32,
margin: EdgeInsets.only(
left: 14, top: 4, bottom: 10),
decoration: BoxDecoration(
color: Theme.of(context)
.primaryTextTheme
.display1
.color,
borderRadius: BorderRadius.all(
Radius.circular(6))),
child: InkWell(
onTap: () =>
sendViewModel.setSendAll(),
child: Center(
child: Text(S.of(context).all,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.primaryTextTheme
.display1
.decorationColor)),
),
),
),
hintText: '0.0000',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .display1
.decorationColor, .color,
fontWeight: FontWeight.w500, borderRadius: BorderRadius.all(
fontSize: 14), Radius.circular(6))),
validator: sendViewModel.amountValidator)); child: InkWell(
}), onTap: () => sendViewModel.setSendAll(),
child: Center(
child: Text(S.of(context).all,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.primaryTextTheme
.display1
.decorationColor)),
),
),
),
hintText: '0.0000',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
validator: sendViewModel.amountValidator)),
Observer( Observer(
builder: (_) => Padding( builder: (_) => Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
S.of(context).available_balance + ':', S.of(context).available_balance + ':',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@ -208,29 +207,25 @@ class SendPage extends BasePage {
.headline .headline
.decorationColor), .decorationColor),
)), )),
Text( Text(
sendViewModel.balance, sendViewModel.balance,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.decorationColor), .decorationColor),
) )
], ],
), ),
)), )),
Padding( Padding(
padding: const EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
child: BaseTextFormField( child: BaseTextFormField(
controller: _fiatAmountController, controller: _fiatAmountController,
keyboardType: TextInputType.numberWithOptions( keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true), signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
prefixIcon: Padding( prefixIcon: Padding(
padding: EdgeInsets.only(top: 9), padding: EdgeInsets.only(top: 9),
child: Text(sendViewModel.fiat.title + ':', child: Text(sendViewModel.fiat.title + ':',
@ -259,51 +254,51 @@ class SendPage extends BasePage {
)), )),
Observer( Observer(
builder: (_) => GestureDetector( builder: (_) => GestureDetector(
onTap: () => onTap: () =>
_setTransactionPriority(context), _setTransactionPriority(context),
child: Container( child: Container(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Text(S.of(context).send_estimated_fee, Text(S.of(context).send_estimated_fee,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
//color: Theme.of(context).primaryTextTheme.display2.color, //color: Theme.of(context).primaryTextTheme.display2.color,
color: Colors.white)), color: Colors.white)),
Container( Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
sendViewModel.estimatedFee sendViewModel.estimatedFee
.toString() + .toString() +
' ' + ' ' +
sendViewModel sendViewModel
.currency.title, .currency.title,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
//color: Theme.of(context).primaryTextTheme.display2.color, //color: Theme.of(context).primaryTextTheme.display2.color,
color: Colors.white)), color: Colors.white)),
Padding( Padding(
padding: padding:
EdgeInsets.only(left: 5), EdgeInsets.only(left: 5),
child: Icon( child: Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
), ),
) )
], ],
), ),
) )
], ],
), ),
), ),
)) ))
], ],
), ),
) )
@ -357,7 +352,7 @@ class SendPage extends BasePage {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(20)), BorderRadius.all(Radius.circular(20)),
color: Colors.transparent, color: Colors.transparent,
), ),
child: Text( child: Text(
@ -397,7 +392,7 @@ class SendPage extends BasePage {
// getOpenaliasRecord(context); // getOpenaliasRecord(context);
// }, // },
// onRemove: () { // onRemove: () {
// showDialog<void>( // showPopUp<void>(
// context: context, // context: context,
// builder: (dialogContext) { // builder: (dialogContext) {
// return AlertWithTwoActions( // return AlertWithTwoActions(
@ -426,13 +421,12 @@ class SendPage extends BasePage {
) )
], ],
), ),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24), bottomSectionPadding:
EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: Observer(builder: (_) { bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton( return LoadingPrimaryButton(
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {}
}
}, },
text: S.of(context).send, text: S.of(context).send,
color: Theme.of(context).accentTextTheme.body2.color, color: Theme.of(context).accentTextTheme.body2.color,
@ -440,10 +434,9 @@ class SendPage extends BasePage {
isLoading: sendViewModel.state is IsExecutingState || isLoading: sendViewModel.state is IsExecutingState ||
sendViewModel.state is TransactionCommitting, sendViewModel.state is TransactionCommitting,
isDisabled: isDisabled:
false // FIXME !(syncStore.status is SyncedSyncStatus), false // FIXME !(syncStore.status is SyncedSyncStatus),
); );
}) })),
),
); );
} }
@ -492,7 +485,7 @@ class SendPage extends BasePage {
reaction((_) => sendViewModel.state, (ExecutionState state) { reaction((_) => sendViewModel.state, (ExecutionState state) {
if (state is FailureState) { if (state is FailureState) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(
@ -506,14 +499,14 @@ class SendPage extends BasePage {
if (state is ExecutedSuccessfullyState) { if (state is ExecutedSuccessfullyState) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ConfirmSendingAlert( return ConfirmSendingAlert(
alertTitle: S.of(context).confirm_sending, alertTitle: S.of(context).confirm_sending,
amount: S.of(context).send_amount, amount: S.of(context).send_amount,
amountValue: amountValue:
sendViewModel.pendingTransaction.amountFormatted, sendViewModel.pendingTransaction.amountFormatted,
fee: S.of(context).send_fee, fee: S.of(context).send_fee,
feeValue: sendViewModel.pendingTransaction.feeFormatted, feeValue: sendViewModel.pendingTransaction.feeFormatted,
leftButtonText: S.of(context).ok, leftButtonText: S.of(context).ok,
@ -521,7 +514,7 @@ class SendPage extends BasePage {
actionLeftButton: () { actionLeftButton: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
sendViewModel.commitTransaction(); sendViewModel.commitTransaction();
showDialog<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Observer(builder: (_) { return Observer(builder: (_) {
@ -564,7 +557,10 @@ class SendPage extends BasePage {
onPressed: () => onPressed: () =>
Navigator.of(context).pop(), Navigator.of(context).pop(),
text: S.of(context).send_got_it, text: S.of(context).send_got_it,
color: Theme.of(context).accentTextTheme.body2.color, color: Theme.of(context)
.accentTextTheme
.body2
.color,
textColor: Colors.white)) textColor: Colors.white))
], ],
); );
@ -635,7 +631,7 @@ class SendPage extends BasePage {
// if (isOpenalias) { // if (isOpenalias) {
// _addressController.text = sendViewModel.recordAddress; // _addressController.text = sendViewModel.recordAddress;
// await showDialog<void>( // await showPopUp<void>(
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertWithOneAction( // return AlertWithOneAction(
@ -653,7 +649,7 @@ class SendPage extends BasePage {
// final items = TransactionPriority.all; // final items = TransactionPriority.all;
// final selectedItem = items.indexOf(sendViewModel.transactionPriority); // final selectedItem = items.indexOf(sendViewModel.transactionPriority);
// //
// await showDialog<void>( // await showPopUp<void>(
// builder: (_) => Picker( // builder: (_) => Picker(
// items: items, // items: items,
// selectedAtIndex: selectedItem, // selectedAtIndex: selectedItem,

View file

@ -1,67 +1,67 @@
import 'package:cake_wallet/src/screens/settings/widgets/language_row.dart'; import 'package:cake_wallet/src/screens/settings/widgets/language_row.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/entities/language.dart'; import 'package:cake_wallet/entities/language_service.dart';
// import 'package:cake_wallet/src/stores/settings/settings_store.dart'; // import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
// FIXME: FIXME class LanguageListPage extends BasePage {
LanguageListPage(this.settingsStore);
final SettingsStore settingsStore;
class ChangeLanguage extends BasePage {
@override @override
String get title => S.current.settings_change_language; String get title => S.current.settings_change_language;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
// final settingsStore = Provider.of<SettingsStore>(context); return Container(
// final currentLanguage = Provider.of<Language>(context); padding: EdgeInsets.only(top: 10.0),
// child: SectionStandardList(
// return Container( sectionCount: 1,
// padding: EdgeInsets.only(top: 10.0), context: context,
// child: SectionStandardList( itemCounter: (int sectionIndex) => LanguageService.list.values.length,
// sectionCount: 1, itemBuilder: (_, sectionIndex, index) {
// context: context, return Observer(builder: (BuildContext context) {
// itemCounter: (int sectionIndex) => languages.values.length, final item = LanguageService.list.values.elementAt(index);
// itemBuilder: (_, sectionIndex, index) { final code = LanguageService.list.keys.elementAt(index);
// final item = languages.values.elementAt(index); final isCurrent = code == settingsStore.languageCode ?? false;
// final code = languages.keys.elementAt(index);
// return LanguageRow(
// final isCurrent = settingsStore.languageCode == null title: item,
// ? false isSelected: isCurrent,
// : code == settingsStore.languageCode; handler: (context) async {
// if (!isCurrent) {
// return LanguageRow( await showPopUp<void>(
// title: item, context: context,
// isSelected: isCurrent, builder: (BuildContext context) {
// handler: (context) async { return AlertWithTwoActions(
// if (!isCurrent) { alertTitle: S.of(context).change_language,
// await showDialog<void>( alertContent:
// context: context, S.of(context).change_language_to(item),
// builder: (BuildContext context) { rightButtonText: S.of(context).change,
// return AlertWithTwoActions( leftButtonText: S.of(context).cancel,
// alertTitle: S.of(context).change_language, actionRightButton: () {
// alertContent: S.of(context).change_language_to(item), settingsStore.languageCode = code;
// rightButtonText: S.of(context).change, Navigator.of(context).pop();
// leftButtonText: S.of(context).cancel, },
// actionRightButton: () { actionLeftButton: () =>
// settingsStore.saveLanguageCode( Navigator.of(context).pop());
// languageCode: code); });
// currentLanguage.setCurrentLanguage(code); }
// Navigator.of(context).pop(); },
// }, );
// actionLeftButton: () => Navigator.of(context).pop() });
// ); },
// }); ));
// }
// },
// );
// },
// )
// );
return null; return null;
} }

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/src/widgets/standard_list.dart';
@ -16,7 +17,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
onTap: (BuildContext context) async { onTap: (BuildContext context) async {
final selectedAtIndex = items.indexOf(selectedItem); final selectedAtIndex = items.indexOf(selectedItem);
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (_) => Picker( builder: (_) => Picker(
items: items, items: items,

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -26,7 +27,7 @@ class SetupPinCodePage extends BasePage {
} }
if (!pinCodeViewModel.isPinCodeCorrect) { if (!pinCodeViewModel.isPinCodeCorrect) {
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(
@ -43,7 +44,7 @@ class SetupPinCodePage extends BasePage {
try { try {
await pinCodeViewModel.setupPinCode(); await pinCodeViewModel.setupPinCode();
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(
@ -60,7 +61,7 @@ class SetupPinCodePage extends BasePage {
}); });
} catch (e) { } catch (e) {
// FIXME: Add translation for alert content text. // FIXME: Add translation for alert content text.
await showDialog<void>( await showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithOneAction( return AlertWithOneAction(

View file

@ -1,8 +1,9 @@
import 'package:cake_wallet/src/screens/wallet_list/widgets/wallet_menu_alert.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
@ -10,7 +11,6 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart'; import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart';
import 'package:cake_wallet/src/screens/wallet_list/widgets/wallet_tile.dart';
class WalletListPage extends BasePage { class WalletListPage extends BasePage {
WalletListPage({this.walletListViewModel}); WalletListPage({this.walletListViewModel});
@ -65,95 +65,66 @@ class WalletListBodyState extends State<WalletListBody> {
itemCount: widget.walletListViewModel.wallets.length, itemCount: widget.walletListViewModel.wallets.length,
itemBuilder: (__, index) { itemBuilder: (__, index) {
final wallet = widget.walletListViewModel.wallets[index]; final wallet = widget.walletListViewModel.wallets[index];
final screenWidth = MediaQuery.of(context).size.width;
final walletMenu = WalletMenu(context, widget.walletListViewModel); final walletMenu = WalletMenu(context, widget.walletListViewModel);
final items = final items =
walletMenu.generateItemsForWalletMenu(wallet.isCurrent); walletMenu.generateItemsForWalletMenu(wallet.isCurrent);
final colors = walletMenu final currentColor = wallet.isCurrent
.generateColorsForWalletMenu(wallet.isCurrent); ? Theme.of(context).accentTextTheme.subtitle.decorationColor
final images = walletMenu : Theme.of(context).backgroundColor;
.generateImagesForWalletMenu(wallet.isCurrent);
return Container( return GestureDetector(
height: tileHeight, onTap: () {
width: double.infinity, showPopUp<void>(
child: CustomScrollView( context: context,
scrollDirection: Axis.horizontal, builder: (dialogContext) {
controller: scrollController, return WalletMenuAlert(
slivers: <Widget>[ wallet: wallet,
SliverPersistentHeader( walletMenu: walletMenu,
pinned: false, items: items);
floating: true, }
delegate: WalletTile( );
min: screenWidth - 170, },
max: screenWidth, child: Container(
image: _imageFor(type: wallet.type), height: tileHeight,
walletName: wallet.name, width: double.infinity,
walletAddress: '', //shortAddress, child: Row(
isCurrent: wallet.isCurrent), children: <Widget>[
), Container(
SliverList( height: tileHeight,
delegate: width: 4,
SliverChildBuilderDelegate((context, index) { decoration: BoxDecoration(
final item = items[index]; borderRadius: BorderRadius.only(
final image = images[index]; topRight: Radius.circular(4),
final firstColor = colors[index*2]; bottomRight: Radius.circular(4)),
final secondColor = colors[index*2 + 1]; color: currentColor
),
final radius = index == 0 ? 10.0 : 0.0; ),
Expanded(
return GestureDetector(
onTap: () {
scrollController.animateTo(0.0,
duration: Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn);
walletMenu.action(
walletMenu.listItems.indexOf(item),
wallet,
wallet.isCurrent);
},
child: Container(
height: tileHeight,
width: 80,
color: Theme.of(context).backgroundColor,
child: Container( child: Container(
padding: EdgeInsets.only(left: 5, right: 5), height: tileHeight,
decoration: BoxDecoration( padding: EdgeInsets.only(left: 20, right: 20),
borderRadius: BorderRadius.only( color: Theme.of(context).backgroundColor,
topLeft: Radius.circular(radius), alignment: Alignment.centerLeft,
bottomLeft: Radius.circular(radius)), child: Row(
gradient: LinearGradient( crossAxisAlignment: CrossAxisAlignment.center,
begin: Alignment.topCenter, children: <Widget>[
end: Alignment.bottomCenter, _imageFor(type: wallet.type),
colors: [ SizedBox(width: 10),
firstColor, Text(
secondColor wallet.name,
] style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color
),
) )
), ],
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
image,
SizedBox(height: 2),
Text(
item,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 7,
fontWeight: FontWeight.w500,
color: Colors.white),
)
],
),
), ),
), ),
), ),
); ],
}, childCount: items.length)) ),
], )
),
); );
}), }),
), ),

View file

@ -1,10 +1,10 @@
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu_item.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
// import 'package:cake_wallet/src/stores/wallet_list/wallet_list_store.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
@ -15,85 +15,46 @@ class WalletMenu {
final WalletListViewModel walletListViewModel; final WalletListViewModel walletListViewModel;
final BuildContext context; final BuildContext context;
final List<String> listItems = [ final List<WalletMenuItem> menuItems = [
S.current.wallet_list_load_wallet, WalletMenuItem(
S.current.show_seed, title: S.current.wallet_list_load_wallet,
S.current.remove, firstGradientColor: Palette.cornflower,
S.current.rescan secondGradientColor: Palette.royalBlue,
image: Image.asset('assets/images/load.png',
height: 24, width: 24, color: Colors.white)),
WalletMenuItem(
title: S.current.show_seed,
firstGradientColor: Palette.moderateOrangeYellow,
secondGradientColor: Palette.moderateOrange,
image: Image.asset('assets/images/eye_action.png',
height: 24, width: 24, color: Colors.white)),
WalletMenuItem(
title: S.current.remove,
firstGradientColor: Palette.lightRed,
secondGradientColor: Palette.persianRed,
image: Image.asset('assets/images/trash.png',
height: 24, width: 24, color: Colors.white)),
WalletMenuItem(
title: S.current.rescan,
firstGradientColor: Palette.shineGreen,
secondGradientColor: Palette.moderateGreen,
image: Image.asset('assets/images/scanner.png',
height: 24, width: 24, color: Colors.white))
]; ];
final List<Color> firstColors = [ List<WalletMenuItem> generateItemsForWalletMenu(bool isCurrentWallet) {
Palette.cornflower, final items = List<WalletMenuItem>();
Palette.moderateOrangeYellow,
Palette.lightRed,
Palette.shineGreen
];
final List<Color> secondColors = [ if (!isCurrentWallet) items.add(menuItems[0]);
Palette.royalBlue, if (isCurrentWallet) items.add(menuItems[1]);
Palette.moderateOrange, if (!isCurrentWallet) items.add(menuItems[2]);
Palette.persianRed, if (isCurrentWallet) items.add(menuItems[3]);
Palette.moderateGreen
];
final List<Image> listImages = [
Image.asset('assets/images/load.png',
height: 24, width: 24, color: Colors.white),
Image.asset('assets/images/eye_action.png',
height: 24, width: 24, color: Colors.white),
Image.asset('assets/images/trash.png',
height: 24, width: 24, color: Colors.white),
Image.asset('assets/images/scanner.png',
height: 24, width: 24, color: Colors.white)
];
List<String> generateItemsForWalletMenu(bool isCurrentWallet) {
final items = List<String>();
if (!isCurrentWallet) items.add(listItems[0]);
if (isCurrentWallet) items.add(listItems[1]);
if (!isCurrentWallet) items.add(listItems[2]);
if (isCurrentWallet) items.add(listItems[3]);
return items; return items;
} }
List<Color> generateColorsForWalletMenu(bool isCurrentWallet) {
final colors = <Color>[];
if (!isCurrentWallet) {
colors.add(firstColors[0]);
colors.add(secondColors[0]);
}
if (isCurrentWallet) {
colors.add(firstColors[1]);
colors.add(secondColors[1]);
}
if (!isCurrentWallet) {
colors.add(firstColors[2]);
colors.add(secondColors[2]);
}
if (isCurrentWallet) {
colors.add(firstColors[3]);
colors.add(secondColors[3]);
}
return colors;
}
List<Image> generateImagesForWalletMenu(bool isCurrentWallet) {
final images = <Image>[];
if (!isCurrentWallet) images.add(listImages[0]);
if (isCurrentWallet) images.add(listImages[1]);
if (!isCurrentWallet) images.add(listImages[2]);
if (isCurrentWallet) images.add(listImages[3]);
return images;
}
Future<void> action( Future<void> action(
int index, WalletListItem wallet, bool isCurrentWallet) async { int index, WalletListItem wallet) async {
switch (index) { switch (index) {
case 0: case 0:
await Navigator.of(context).pushNamed(Routes.auth, arguments: await Navigator.of(context).pushNamed(Routes.auth, arguments:
@ -126,7 +87,7 @@ class WalletMenu {
}); });
break; break;
case 2: case 2:
final isComfirmed = await showDialog<bool>( final isComfirmed = await showPopUp<bool>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(

View file

@ -0,0 +1,16 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
class WalletMenuItem {
WalletMenuItem({
@required this.title,
@required this.firstGradientColor,
@required this.secondGradientColor,
@required this.image
});
final String title;
final Color firstGradientColor;
final Color secondGradientColor;
final Image image;
}

View file

@ -0,0 +1,112 @@
import 'dart:ui';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart';
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu_item.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
class WalletMenuAlert extends StatelessWidget {
WalletMenuAlert({
@required this.wallet,
@required this.walletMenu,
@required this.items
});
final WalletListItem wallet;
final WalletMenu walletMenu;
final List<WalletMenuItem> items;
final closeButton = Image.asset('assets/images/close.png',
color: Palette.darkBlueCraiola,
);
@override
Widget build(BuildContext context) {
return AlertBackground(
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: 24,
right: 24,
),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
color: Theme.of(context).textTheme.body2.decorationColor,
padding: EdgeInsets.only(left: 24),
child: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: items.length,
separatorBuilder: (context, _) => Container(
height: 1,
color: Theme.of(context).accentTextTheme.subhead.backgroundColor,
),
itemBuilder: (_, index) {
final item = items[index];
return GestureDetector(
onTap: () {
Navigator.of(context).pop();
walletMenu.action(
walletMenu.menuItems.indexOf(item),
wallet);
},
child: Container(
height: 60,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
height: 32,
width: 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
item.firstGradientColor,
item.secondGradientColor
]
)
),
child: Center(
child: item.image,
),
),
SizedBox(width: 12),
Expanded(
child: Text(
item.title,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color,
fontSize: 18,
fontFamily: 'Poppins',
fontWeight: FontWeight.w500,
decoration: TextDecoration.none
),
)
)
],
),
),
);
},
),
),
),
),
AlertCloseButton(image: closeButton)
],
),
);
}
}

View file

@ -1,151 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class WalletTile extends SliverPersistentHeaderDelegate {
WalletTile({
@required this.min,
@required this.max,
@required this.image,
@required this.walletName,
@required this.walletAddress,
@required this.isCurrent
});
final double min;
final double max;
final Image image;
final String walletName;
final String walletAddress;
final bool isCurrent;
final double tileHeight = 60;
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
var opacity = 1 - shrinkOffset / (max - min);
opacity = opacity >= 0 ? opacity : 0;
var panelWidth = 10 * opacity;
panelWidth = panelWidth < 10 ? 0 : 10;
final currentColor = isCurrent
? Theme.of(context).accentTextTheme.subtitle.decorationColor
: Theme.of(context).backgroundColor;
return Stack(
fit: StackFit.expand,
overflow: Overflow.visible,
children: <Widget>[
Positioned(
top: 0,
right: max - 4,
child: Container(
height: tileHeight,
width: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
color: currentColor
),
),
),
Positioned(
top: 0,
right: 10,
child: Container(
height: tileHeight,
width: max - 14,
padding: EdgeInsets.only(left: 20, right: 20),
color: Theme.of(context).backgroundColor,
alignment: Alignment.centerLeft,
child: Row(
//mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 10),
Text(
walletName,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color
),
)
],
),
/*Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 10),
Text(
walletName,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color
),
)
],
),
isCurrent ? SizedBox(height: 5) : Offstage(),
isCurrent
? Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(width: 34),
Text(
walletAddress,
style: TextStyle(
fontSize: 12,
color: Theme.of(context).primaryTextTheme.caption.color
),
)
],
)
: Offstage()
],
),*/
),
),
Positioned(
top: 0,
right: 0,
child: Opacity(
opacity: opacity,
child: Container(
height: tileHeight,
width: panelWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Theme.of(context).accentTextTheme.headline.color,
Theme.of(context).accentTextTheme.headline.backgroundColor
]
)
),
),
)
),
],
);
}
@override
double get maxExtent => max;
@override
double get minExtent => min;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true;
}

View file

@ -103,7 +103,7 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton( child: PrimaryImageButton(
onPressed: () => Navigator.pushNamed(context, Routes.newWalletFromWelcome), onPressed: () => Navigator.pushNamed(context, Routes.newWallet),
image: newWalletImage, image: newWalletImage,
text: S.of(context).create_new, text: S.of(context).create_new,
color: Theme.of(context).accentTextTheme.subtitle.decorationColor, color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
@ -113,7 +113,7 @@ class WelcomePage extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: PrimaryImageButton( child: PrimaryImageButton(
onPressed: () => Navigator.pushNamed(context, Routes.restoreWalletOptionsFromWelcome), onPressed: () => Navigator.pushNamed(context, Routes.restoreWalletOptions),
image: restoreWalletImage, image: restoreWalletImage,
text: S.of(context).restore_wallet, text: S.of(context).restore_wallet,
color: Theme.of(context).accentTextTheme.caption.color, color: Theme.of(context).accentTextTheme.caption.color,

View file

@ -8,7 +8,7 @@ class AlertCloseButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Positioned( return Positioned(
bottom: 24, bottom: 60,
child: GestureDetector( child: GestureDetector(
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
child: Container( child: Container(

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart'; import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
@ -35,7 +36,7 @@ class SeedLanguageSelectorState extends State<SeedLanguageSelector> {
image: null, image: null,
text: seedLocales[seedLanguages.indexOf(selected)], text: seedLocales[seedLanguages.indexOf(selected)],
onTap: () async { onTap: () async {
final selected = await showDialog<String>( final selected = await showPopUp<String>(
context: context, context: context,
builder: (BuildContext context) => builder: (BuildContext context) =>
SeedLanguagePicker(key: _pickerKey, selected: this.selected)); SeedLanguagePicker(key: _pickerKey, selected: this.selected));

View file

@ -4,7 +4,6 @@ import 'package:cake_wallet/store/wallet_list_store.dart';
import 'package:cake_wallet/store/authentication_store.dart'; import 'package:cake_wallet/store/authentication_store.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/store/node_list_store.dart'; import 'package:cake_wallet/store/node_list_store.dart';
import 'package:cake_wallet/store/contact_list_store.dart';
part 'app_store.g.dart'; part 'app_store.g.dart';
@ -15,7 +14,6 @@ abstract class AppStoreBase with Store {
{this.authenticationStore, {this.authenticationStore,
this.walletList, this.walletList,
this.settingsStore, this.settingsStore,
this.contactListStore,
this.nodeListStore}); this.nodeListStore});
AuthenticationStore authenticationStore; AuthenticationStore authenticationStore;
@ -27,7 +25,5 @@ abstract class AppStoreBase with Store {
SettingsStore settingsStore; SettingsStore settingsStore;
ContactListStore contactListStore;
NodeListStore nodeListStore; NodeListStore nodeListStore;
} }

View file

@ -1,12 +0,0 @@
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/entities/contact.dart';
part 'contact_list_store.g.dart';
class ContactListStore = ContactListStoreBase with _$ContactListStore;
abstract class ContactListStoreBase with Store {
ContactListStoreBase() : contacts = ObservableList<Contact>();
final ObservableList<Contact> contacts;
}

View file

@ -22,17 +22,13 @@ abstract class NodeListStoreBase with Store {
final nodeSource = getIt.get<Box<Node>>(); final nodeSource = getIt.get<Box<Node>>();
_instance = NodeListStore(); _instance = NodeListStore();
_instance.replaceValues(nodeSource.values); _instance.nodes.clear();
_instance.nodes.addAll(nodeSource.values);
_onNodesSourceChange?.cancel(); _onNodesSourceChange?.cancel();
_onNodesSourceChange = bindBox(nodeSource, _instance.nodes); _onNodesSourceChange = nodeSource.bindToList(_instance.nodes);
return _instance; return _instance;
} }
final ObservableList<Node> nodes; final ObservableList<Node> nodes;
void replaceValues(Iterable<Node> newNodes) {
nodes.clear();
nodes.addAll(newNodes);
}
} }

View file

@ -1,5 +1,7 @@
import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/themes.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
@ -7,7 +9,7 @@ import 'package:devicelocale/devicelocale.dart';
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:cake_wallet/entities/language.dart'; import 'package:cake_wallet/entities/language_service.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/node.dart';
@ -21,7 +23,6 @@ class SettingsStore = SettingsStoreBase with _$SettingsStore;
abstract class SettingsStoreBase with Store { abstract class SettingsStoreBase with Store {
SettingsStoreBase( SettingsStoreBase(
{@required SharedPreferences sharedPreferences, {@required SharedPreferences sharedPreferences,
@required Box<Node> nodeSource,
@required FiatCurrency initialFiatCurrency, @required FiatCurrency initialFiatCurrency,
@required TransactionPriority initialTransactionPriority, @required TransactionPriority initialTransactionPriority,
@required BalanceDisplayMode initialBalanceDisplayMode, @required BalanceDisplayMode initialBalanceDisplayMode,
@ -30,7 +31,7 @@ abstract class SettingsStoreBase with Store {
@required bool initialDarkTheme, @required bool initialDarkTheme,
@required int initialPinLength, @required int initialPinLength,
@required String initialLanguageCode, @required String initialLanguageCode,
@required String initialCurrentLocale, // @required String initialCurrentLocale,
@required this.appVersion, @required this.appVersion,
@required Map<WalletType, Node> nodes, @required Map<WalletType, Node> nodes,
this.actionlistDisplayMode}) { this.actionlistDisplayMode}) {
@ -42,11 +43,9 @@ abstract class SettingsStoreBase with Store {
isDarkTheme = initialDarkTheme; isDarkTheme = initialDarkTheme;
pinCodeLength = initialPinLength; pinCodeLength = initialPinLength;
languageCode = initialLanguageCode; languageCode = initialLanguageCode;
currentLocale = initialCurrentLocale; currentNode = nodes[WalletType.monero];
itemHeaders = {};
this.nodes = ObservableMap<WalletType, Node>.of(nodes); this.nodes = ObservableMap<WalletType, Node>.of(nodes);
_sharedPreferences = sharedPreferences; _sharedPreferences = sharedPreferences;
_nodeSource = nodeSource;
reaction( reaction(
(_) => allowBiometricalAuthentication, (_) => allowBiometricalAuthentication,
@ -58,6 +57,13 @@ abstract class SettingsStoreBase with Store {
(_) => pinCodeLength, (_) => pinCodeLength,
(int pinLength) => sharedPreferences.setInt( (int pinLength) => sharedPreferences.setInt(
PreferencesKey.currentPinLength, pinLength)); PreferencesKey.currentPinLength, pinLength));
reaction((_) => currentNode,
(Node node) => _saveCurrentNode(node, WalletType.monero));
reaction((_) => languageCode,
(String languageCode) => sharedPreferences.setString(
PreferencesKey.currentLanguageCode, languageCode));
} }
static const defaultPinLength = 4; static const defaultPinLength = 4;
@ -88,16 +94,17 @@ abstract class SettingsStoreBase with Store {
int pinCodeLength; int pinCodeLength;
@observable @observable
Map<String, String> itemHeaders; Node currentNode;
@computed
ThemeData get theme => isDarkTheme ? Themes.darkTheme : Themes.lightTheme;
@observable
String languageCode; String languageCode;
String currentLocale;
String appVersion; String appVersion;
SharedPreferences _sharedPreferences; SharedPreferences _sharedPreferences;
Box<Node> _nodeSource;
ObservableMap<WalletType, Node> nodes; ObservableMap<WalletType, Node> nodes;
@ -135,8 +142,7 @@ abstract class SettingsStoreBase with Store {
defaultPinLength; defaultPinLength;
final savedLanguageCode = final savedLanguageCode =
sharedPreferences.getString(PreferencesKey.currentLanguageCode) ?? sharedPreferences.getString(PreferencesKey.currentLanguageCode) ??
await Language.localeDetection(); await LanguageService.localeDetection();
final initialCurrentLocale = await Devicelocale.currentLocale;
final nodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey); final nodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
final bitcoinElectrumServerId = sharedPreferences final bitcoinElectrumServerId = sharedPreferences
.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey); .getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
@ -150,7 +156,6 @@ abstract class SettingsStoreBase with Store {
WalletType.monero: moneroNode, WalletType.monero: moneroNode,
WalletType.bitcoin: bitcoinElectrumServer WalletType.bitcoin: bitcoinElectrumServer
}, },
nodeSource: nodeSource,
appVersion: packageInfo.version, appVersion: packageInfo.version,
initialFiatCurrency: currentFiatCurrency, initialFiatCurrency: currentFiatCurrency,
initialTransactionPriority: currentTransactionPriority, initialTransactionPriority: currentTransactionPriority,
@ -160,11 +165,11 @@ abstract class SettingsStoreBase with Store {
initialDarkTheme: savedDarkTheme, initialDarkTheme: savedDarkTheme,
actionlistDisplayMode: actionListDisplayMode, actionlistDisplayMode: actionListDisplayMode,
initialPinLength: pinLength, initialPinLength: pinLength,
initialLanguageCode: savedLanguageCode, initialLanguageCode: savedLanguageCode
initialCurrentLocale: initialCurrentLocale); );
} }
Future<void> setCurrentNode(Node node, WalletType walletType) async { Future<void> _saveCurrentNode(Node node, WalletType walletType) async {
switch (walletType) { switch (walletType) {
case WalletType.bitcoin: case WalletType.bitcoin:
await _sharedPreferences.setInt( await _sharedPreferences.setInt(

View file

@ -1,13 +0,0 @@
import 'package:cake_wallet/theme_changer.dart';
import 'package:mobx/mobx.dart';
part 'theme_changer_store.g.dart';
class ThemeChangerStore = ThemeChangerStoreBase with _$ThemeChangerStore;
abstract class ThemeChangerStoreBase with Store {
ThemeChangerStoreBase({this.themeChanger});
@observable
ThemeChanger themeChanger;
}

View file

@ -1,16 +0,0 @@
import 'package:flutter/material.dart';
class ThemeChanger with ChangeNotifier {
ThemeChanger(this._themeData);
ThemeData _themeData;
ThemeData getTheme() => _themeData;
void setTheme(ThemeData theme){
_themeData = theme;
notifyListeners();
}
}

View file

@ -4,7 +4,7 @@ import 'package:cake_wallet/store/settings_store.dart';
class DateFormatter { class DateFormatter {
static String get currentLocalFormat { static String get currentLocalFormat {
final isUSA = getIt.get<SettingsStore>().currentLocale == 'en_US'; final isUSA = getIt.get<SettingsStore>().languageCode.toLowerCase() == 'en';
final format = isUSA ? 'yyyy.MM.dd, HH:mm' : 'dd.MM.yyyy, HH:mm'; final format = isUSA ? 'yyyy.MM.dd, HH:mm' : 'dd.MM.yyyy, HH:mm';
return format; return format;

View file

@ -1,11 +1,18 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/utils/mobx.dart'; import 'package:cake_wallet/utils/mobx.dart';
// part 'node_list_view_model.g.dart';
//
// class NodeListViewModel = NodeListViewModelBase with _$NodeListViewModel;
class ItemCell<Item> with Keyable { class ItemCell<Item> with Keyable {
ItemCell(this.value, {@required this.isSelected, @required dynamic key}) { ItemCell(this.value, {this.isSelectedBuilder, @required dynamic key}) {
keyIndex = key; keyIndex = key;
} }
final Item value; final Item value;
final bool isSelected;
bool get isSelected => isSelectedBuilder(value);
bool Function(Item item) isSelectedBuilder;
} }

View file

@ -6,36 +6,6 @@ mixin Keyable {
dynamic keyIndex; dynamic keyIndex;
} }
void connectWithTransform<T extends Keyable, Y extends Keyable>(
ObservableList<T> source, ObservableList<Y> dest, Y Function(T) transform,
{bool Function(T) filter}) {
source.observe((ListChange<T> change) {
change.elementChanges.forEach((change) {
switch (change.type) {
case OperationType.add:
if (filter?.call(change.newValue as T) ?? true) {
dest.add(transform(change.newValue as T));
}
break;
case OperationType.remove:
// Hive could has equal index and key
dest.removeWhere(
(elem) => elem.keyIndex == (change.oldValue.key ?? change.index));
break;
case OperationType.update:
for (var i = 0; i < dest.length; i++) {
final item = dest[i];
if (item.keyIndex == change.newValue.key) {
dest[i] = transform(change.newValue as T);
}
}
break;
}
});
});
}
void connectMapToListWithTransform<T extends Keyable, Y extends Keyable>( void connectMapToListWithTransform<T extends Keyable, Y extends Keyable>(
ObservableMap<dynamic, T> source, ObservableMap<dynamic, T> source,
ObservableList<Y> dest, ObservableList<Y> dest,
@ -50,8 +20,8 @@ void connectMapToListWithTransform<T extends Keyable, Y extends Keyable>(
break; break;
case OperationType.remove: case OperationType.remove:
// Hive could has equal index and key // Hive could has equal index and key
dest.removeWhere( dest.removeWhere((elem) =>
(elem) => elem.keyIndex == (change.key ?? change.newValue.keyIndex)); elem.keyIndex == (change.key ?? change.newValue.keyIndex));
break; break;
case OperationType.update: case OperationType.update:
for (var i = 0; i < dest.length; i++) { for (var i = 0; i < dest.length; i++) {
@ -66,54 +36,126 @@ void connectMapToListWithTransform<T extends Keyable, Y extends Keyable>(
}); });
} }
void connect<T extends Keyable>( typedef Filter<T> = bool Function(T);
ObservableList<T> source, ObservableList<T> dest) { typedef Transform<T, Y> = Y Function(T);
source.observe((ListChange<T> change) {
source.observe((ListChange<T> change) {
change.elementChanges.forEach((change) {
switch (change.type) {
case OperationType.add:
// if (filter?.call(change.newValue as T) ?? true) {
dest.add(change.newValue as T);
// }
break;
case OperationType.remove:
// Hive could has equal index and key
dest.removeWhere((elem) =>
elem.keyIndex == (change.oldValue.key ?? change.index));
break;
case OperationType.update:
for (var i = 0; i < dest.length; i++) {
final item = dest[i];
if (item.keyIndex == change.newValue.key) { enum ChangeType { update, delete, add }
dest[i] = change.newValue as T;
} class EntityChange<T extends Keyable> {
} EntityChange(this.value, this.type, {dynamic key}) : _key = key;
break;
} dynamic get key => _key ?? value.keyIndex;
}); final T value;
}); final ChangeType type;
}); final dynamic _key;
} }
StreamSubscription<BoxEvent> bindBox<T extends Keyable>( extension MobxBindable<T extends Keyable> on Box<T> {
Box<T> source, ObservableList<T> dest) { StreamSubscription<BoxEvent> bindToList(
return source.watch().listen((event) { ObservableList<T> dest, {
bool initialFire = false,
Filter<T> filter,
}) {
if (initialFire) {
dest.addAll(values);
}
return watch().listen((event) {
if (filter != null && !filter(event.value as T)) {
return;
}
dest.acceptBoxChange(event);
});
}
StreamSubscription<BoxEvent> bindToListWithTransform<Y extends Keyable>(
ObservableList<Y> dest,
Transform<T, Y> transform, {
bool initialFire = false,
Filter<T> filter,
}) {
if (initialFire) {
dest.addAll(values.map((value) => transform(value)));
}
return watch().listen((event) {
if (filter != null && !filter(event.value as T)) {
return;
}
dest.acceptBoxChange(event,
transformed: event.deleted ? null : transform(event.value as T));
});
}
}
extension HiveBindable<T extends Keyable> on ObservableList<T> {
Stream<EntityChange<T>> listen() {
// ignore: close_sinks
final controller = StreamController<EntityChange<T>>();
observe((ListChange<T> change) {
change.elementChanges.forEach((change) {
ChangeType type;
switch (change.type) {
case OperationType.add:
type = ChangeType.add;
break;
case OperationType.remove:
type = ChangeType.delete;
break;
case OperationType.update:
type = ChangeType.update;
break;
}
final value = change.newValue as T;
controller.add(EntityChange(value, type,
key: type == ChangeType.delete ? change.index : value.keyIndex));
});
});
return controller.stream;
}
StreamSubscription<EntityChange<T>> bindToList(ObservableList<T> dest) =>
listen().listen((event) => dest.acceptEntityChange(event));
void acceptBoxChange(BoxEvent event, {T transformed}) {
if (event.deleted) { if (event.deleted) {
dest.removeWhere((el) => el.keyIndex == event.key); removeWhere((el) => el.keyIndex == event.key);
}
final dynamic value = transformed ?? event.value;
if (value is T) {
final index = indexWhere((el) => el.keyIndex == value.keyIndex);
if (index > -1) {
this.setAll(index, [value]); // FIXME: fixme
} else {
add(value);
}
}
}
void acceptEntityChange(EntityChange<T> event) {
if (event.type == ChangeType.delete) {
removeWhere((el) => el.keyIndex == event.key);
} }
final dynamic value = event.value; final dynamic value = event.value;
if (value is T) { if (value is T) {
final elIndex = dest.indexWhere((el) => el.keyIndex == value.keyIndex); final index = indexWhere((el) => el.keyIndex == value.keyIndex);
if (elIndex > -1) { if (index > -1) {
dest[elIndex] = value; this.setAll(index, [value]); // FIXME: fixme
} else { } else {
dest.add(value); add(value);
} }
} }
}); }
} }

View file

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
Future<T> showPopUp<T>({
@required BuildContext context,
WidgetBuilder builder,
bool barrierDismissible = true,
Color barrierColor,
bool useSafeArea = false,
bool useRootNavigator = true,
RouteSettings routeSettings,
Widget child,
}) {
return showDialog<T>(
context: context,
builder: builder,
barrierDismissible: barrierDismissible,
barrierColor: barrierColor,
useSafeArea: useSafeArea,
useRootNavigator: useRootNavigator,
routeSettings: routeSettings,
child: child);
}

View file

@ -1,8 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cake_wallet/core/contact_service.dart'; import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/store/contact_list_store.dart';
import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/utils/mobx.dart'; import 'package:cake_wallet/utils/mobx.dart';
@ -12,22 +11,16 @@ class ContactListViewModel = ContactListViewModelBase
with _$ContactListViewModel; with _$ContactListViewModel;
abstract class ContactListViewModelBase with Store { abstract class ContactListViewModelBase with Store {
ContactListViewModelBase( ContactListViewModelBase(this.contactSource)
this.addressBookStore, this.contactService, this.contactSource) { : contacts = ObservableList<ContactRecord>() {
_subscription = bindBox(contactSource, addressBookStore.contacts); _subscription = contactSource.bindToListWithTransform(
contacts, (Contact contact) => ContactRecord(contactSource, contact),
initialFire: true);
} }
final ContactListStore addressBookStore;
final ContactService contactService;
final Box<Contact> contactSource; final Box<Contact> contactSource;
final ObservableList<ContactRecord> contacts;
ObservableList<Contact> get contacts => addressBookStore.contacts;
StreamSubscription<BoxEvent> _subscription; StreamSubscription<BoxEvent> _subscription;
void dispose() { Future<void> delete(ContactRecord contact) async => contact.original.delete();
_subscription.cancel();
}
Future<void> delete(Contact contact) async => contactService.delete(contact);
} }

View file

@ -1,8 +1,8 @@
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/core/contact_service.dart';
import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/crypto_currency.dart'; import 'package:cake_wallet/entities/crypto_currency.dart';
@ -11,13 +11,13 @@ part 'contact_view_model.g.dart';
class ContactViewModel = ContactViewModelBase with _$ContactViewModel; class ContactViewModel = ContactViewModelBase with _$ContactViewModel;
abstract class ContactViewModelBase with Store { abstract class ContactViewModelBase with Store {
ContactViewModelBase(this._contacts, this._wallet, {Contact contact}) ContactViewModelBase(this._contacts, {ContactRecord contact})
: state = InitialExecutionState(), : state = InitialExecutionState(),
currencies = CryptoCurrency.all, currencies = CryptoCurrency.all,
_contact = contact { _contact = contact {
name = _contact?.name; name = _contact?.name;
address = _contact?.address; address = _contact?.address;
currency = _contact?.type; //_wallet.currency; currency = _contact?.type;
} }
@observable @observable
@ -39,9 +39,8 @@ abstract class ContactViewModelBase with Store {
(address?.isNotEmpty ?? false); (address?.isNotEmpty ?? false);
final List<CryptoCurrency> currencies; final List<CryptoCurrency> currencies;
final WalletBase _wallet;
final Box<Contact> _contacts; final Box<Contact> _contacts;
final Contact _contact; final ContactRecord _contact;
@action @action
void reset() { void reset() {
@ -57,8 +56,8 @@ abstract class ContactViewModelBase with Store {
if (_contact != null) { if (_contact != null) {
_contact.name = name; _contact.name = name;
_contact.address = address; _contact.address = address;
_contact.updateCryptoCurrency(currency: currency); _contact.type = currency;
await _contacts.put(_contact.key, _contact); await _contact.save();
} else { } else {
await _contacts await _contacts
.add(Contact(name: name, address: address, type: currency)); .add(Contact(name: name, address: address, type: currency));

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart'; import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/entities/crypto_currency.dart';
import 'package:cake_wallet/monero/monero_wallet.dart'; import 'package:cake_wallet/monero/monero_wallet.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/calculate_fiat_amount.dart'; import 'package:cake_wallet/entities/calculate_fiat_amount.dart';
@ -92,6 +93,9 @@ abstract class BalanceViewModelBase with Store {
return null; return null;
} }
@computed
CryptoCurrency get currency => appStore.wallet.currency;
String _getFiatBalance({double price, String cryptoAmount}) { String _getFiatBalance({double price, String cryptoAmount}) {
if (cryptoAmount == null) { if (cryptoAmount == null) {
return '0.00'; return '0.00';

View file

@ -1,45 +1,29 @@
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/entities/node_list.dart'; import 'package:cake_wallet/entities/node_list.dart';
import 'package:cake_wallet/store/node_list_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/entities/default_settings_migration.dart'; import 'package:cake_wallet/entities/default_settings_migration.dart';
import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/utils/mobx.dart'; import 'package:cake_wallet/utils/mobx.dart';
import 'package:cake_wallet/utils/item_cell.dart';
part 'node_list_view_model.g.dart'; part 'node_list_view_model.g.dart';
class NodeListViewModel = NodeListViewModelBase with _$NodeListViewModel; class NodeListViewModel = NodeListViewModelBase with _$NodeListViewModel;
abstract class NodeListViewModelBase with Store { abstract class NodeListViewModelBase with Store {
NodeListViewModelBase( NodeListViewModelBase(this._nodeSource, this._wallet, this.settingsStore)
this._nodeListStore, this._nodeSource, this._wallet, this._settingsStore) : nodes = ObservableList<Node>() {
: nodes = ObservableList<ItemCell<Node>>() { _nodeSource.bindToList(nodes,
final currentNode = _settingsStore.getCurrentNode(_wallet.type); filter: (Node val) => val.type == _wallet.type, initialFire: true);
final values = _nodeListStore.nodes;
nodes.clear();
nodes.addAll(values.where((Node node) => node.type == _wallet.type).map(
(Node val) => ItemCell<Node>(val,
isSelected: val.key == currentNode.key, key: val.key)));
connectWithTransform(
_nodeListStore.nodes,
nodes,
(Node val) => ItemCell<Node>(val,
isSelected: val.key == currentNode.key, key: val.key),
filter: (Node val) => val.type == _wallet.type);
reaction((_) => _settingsStore.nodes[_wallet.type],
(Node _) => _updateCurrentNode());
} }
ObservableList<ItemCell<Node>> nodes; final ObservableList<Node> nodes;
final SettingsStore settingsStore;
final WalletBase _wallet; final WalletBase _wallet;
final Box<Node> _nodeSource; final Box<Node> _nodeSource;
final NodeListStore _nodeListStore;
final SettingsStore _settingsStore;
Future<void> reset() async { Future<void> reset() async {
await resetToDefault(_nodeSource); await resetToDefault(_nodeSource);
@ -64,24 +48,6 @@ abstract class NodeListViewModelBase with Store {
Future<void> delete(Node node) async => _nodeSource.delete(node.key); Future<void> delete(Node node) async => _nodeSource.delete(node.key);
Future<void> setAsCurrent(Node node) async { Future<void> setAsCurrent(Node node) async =>
await _settingsStore.setCurrentNode(node, _wallet.type); settingsStore.currentNode = node;
_updateCurrentNode();
await _wallet.connectToNode(node: node);
}
@action
void _updateCurrentNode() {
final currentNode = _settingsStore.getCurrentNode(_wallet.type);
for (var i = 0; i < nodes.length; i++) {
final item = nodes[i];
final isSelected = item.value.key == currentNode.key;
if (item.isSelected != isSelected) {
nodes[i] = ItemCell<Node>(item.value,
isSelected: isSelected, key: item.keyIndex);
}
}
}
} }

View file

@ -70,15 +70,17 @@ abstract class SendViewModelBase with Store {
@computed @computed
String get balance { String get balance {
String balance = '0.0';
if (_wallet is MoneroWallet) { if (_wallet is MoneroWallet) {
_wallet.balance.formattedUnlockedBalance; balance = _wallet.balance.formattedUnlockedBalance as String ?? '';
} }
if (_wallet is BitcoinWallet) { if (_wallet is BitcoinWallet) {
_wallet.balance.confirmedFormatted; balance = _wallet.balance.confirmedFormatted as String ?? '';
} }
return '0.0'; return balance;
} }
@computed @computed

View file

@ -1,27 +1,24 @@
import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/entities/biometric_auth.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/theme_changer_store.dart';
import 'package:cake_wallet/themes.dart';
import 'package:cake_wallet/view_model/settings/version_list_item.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:package_info/package_info.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/entities/biometric_auth.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart'; import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/entities/node.dart';
import 'package:cake_wallet/entities/transaction_priority.dart'; import 'package:cake_wallet/entities/transaction_priority.dart';
import 'package:cake_wallet/entities/action_list_display_mode.dart'; import 'package:cake_wallet/entities/action_list_display_mode.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/view_model/settings/version_list_item.dart';
import 'package:cake_wallet/view_model/settings/link_list_item.dart'; import 'package:cake_wallet/view_model/settings/link_list_item.dart';
import 'package:cake_wallet/view_model/settings/picker_list_item.dart'; import 'package:cake_wallet/view_model/settings/picker_list_item.dart';
import 'package:cake_wallet/view_model/settings/regular_list_item.dart'; import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
import 'package:cake_wallet/view_model/settings/settings_list_item.dart'; import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
import 'package:cake_wallet/view_model/settings/switcher_list_item.dart'; import 'package:cake_wallet/view_model/settings/switcher_list_item.dart';
import 'package:package_info/package_info.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart';
part 'settings_view_model.g.dart'; part 'settings_view_model.g.dart';
@ -40,7 +37,9 @@ abstract class SettingsViewModelBase with Store {
PickerListItem( PickerListItem(
title: S.current.settings_display_balance_as, title: S.current.settings_display_balance_as,
items: BalanceDisplayMode.all, items: BalanceDisplayMode.all,
selectedItem: () => balanceDisplayMode), selectedItem: () => balanceDisplayMode,
onItemSelected: (BalanceDisplayMode mode) =>
_settingsStore.balanceDisplayMode = mode),
PickerListItem( PickerListItem(
title: S.current.settings_currency, title: S.current.settings_currency,
items: FiatCurrency.all, items: FiatCurrency.all,
@ -109,13 +108,8 @@ abstract class SettingsViewModelBase with Store {
SwitcherListItem( SwitcherListItem(
title: S.current.settings_dark_mode, title: S.current.settings_dark_mode,
value: () => _settingsStore.isDarkTheme, value: () => _settingsStore.isDarkTheme,
onValueChange: (_, bool value) { onValueChange: (_, bool value) =>
_settingsStore.isDarkTheme = value; _settingsStore.isDarkTheme = value)
getIt
.get<ThemeChangerStore>()
.themeChanger
.setTheme(value ? Themes.darkTheme : Themes.lightTheme);
})
], ],
[ [
LinkListItem( LinkListItem(
@ -204,6 +198,7 @@ abstract class SettingsViewModelBase with Store {
@action @action
void setFiatCurrency(FiatCurrency value) => void setFiatCurrency(FiatCurrency value) =>
_settingsStore.fiatCurrency = value; _settingsStore.fiatCurrency = value;
@action @action
void setShouldSaveRecipientAddress(bool value) => void setShouldSaveRecipientAddress(bool value) =>
_settingsStore.shouldSaveRecipientAddress = value; _settingsStore.shouldSaveRecipientAddress = value;

View file

@ -35,7 +35,7 @@ abstract class WalletListViewModelBase with Store {
@action @action
Future<void> remove(WalletListItem wallet) async { Future<void> remove(WalletListItem wallet) async {
final walletService = getIt.get<WalletService>(); final walletService = getIt.get<WalletService>(param1: wallet.type);
await walletService.remove(wallet.name); await walletService.remove(wallet.name);
await _walletInfoSource.delete(wallet.key); await _walletInfoSource.delete(wallet.key);
_updateList(); _updateList();

View file

@ -42,7 +42,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.1" version: "2.4.2"
auto_size_text: auto_size_text:
dependency: "direct main" dependency: "direct main"
description: description:
@ -210,14 +210,14 @@ packages:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.12" version: "1.14.13"
connectivity: connectivity:
dependency: "direct main" dependency: "direct main"
description: description:
name: connectivity name: connectivity
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9+2" version: "0.4.9+3"
connectivity_for_web: connectivity_for_web:
dependency: transitive dependency: transitive
description: description:
@ -252,7 +252,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "2.1.5"
csslib: csslib:
dependency: transitive dependency: transitive
description: description:
@ -330,6 +330,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -388,7 +395,7 @@ packages:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.9" version: "1.0.11"
flutter_secure_storage: flutter_secure_storage:
dependency: "direct main" dependency: "direct main"
description: description:
@ -463,7 +470,7 @@ packages:
name: hive_generator name: hive_generator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.7.1" version: "0.7.2+1"
html: html:
dependency: transitive dependency: transitive
description: description:
@ -498,7 +505,7 @@ packages:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.12" version: "2.1.18"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@ -526,14 +533,14 @@ packages:
name: json_annotation name: json_annotation
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.1.0"
local_auth: local_auth:
dependency: "direct main" dependency: "direct main"
description: description:
name: local_auth name: local_auth
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3+1" version: "0.6.3+2"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -547,7 +554,7 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.6" version: "0.12.8"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -617,7 +624,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.7.0"
path_drawing: path_drawing:
dependency: transitive dependency: transitive
description: description:
@ -638,7 +645,7 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.17" version: "1.6.18"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -680,7 +687,7 @@ packages:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "3.0.4"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -688,13 +695,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -778,14 +778,14 @@ packages:
name: share name: share
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.5+1" version: "0.6.5+2"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.11" version: "0.5.12"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
@ -867,7 +867,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "1.9.5"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -902,7 +902,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.15" version: "0.2.17"
time: time:
dependency: transitive dependency: transitive
description: description:
@ -923,14 +923,14 @@ packages:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.2.0"
url_launcher: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.7.0" version: "5.7.2"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
@ -958,7 +958,7 @@ packages:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3+2" version: "0.1.4+1"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@ -1014,7 +1014,7 @@ packages:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.6.1" version: "4.5.1"
yaml: yaml:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1023,5 +1023,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.7.0 <3.0.0" dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0"

View file

@ -14,7 +14,7 @@ description: Cake Wallet.
version: 1.0.5+5 version: 1.0.5+5
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.7.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:

View file

@ -13,7 +13,7 @@ import 'package:cake_wallet/main.dart';
void main() { void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // Build our app and trigger a frame.
await tester.pumpWidget(CakeWalletApp()); await tester.pumpWidget(App());
// Verify that our counter starts at 0. // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); expect(find.text('0'), findsOneWidget);