stack_wallet/lib/route_generator.dart

2674 lines
93 KiB
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
2022-08-26 08:11:35 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import 'models/add_wallet_list_entity/add_wallet_list_entity.dart';
import 'models/add_wallet_list_entity/sub_classes/eth_token_entity.dart';
import 'models/buy/response_objects/quote.dart';
import 'models/exchange/incomplete_exchange.dart';
import 'models/exchange/response_objects/trade.dart';
import 'models/isar/models/blockchain_data/v2/transaction_v2.dart';
import 'models/isar/models/contact_entry.dart';
import 'models/isar/models/isar_models.dart';
import 'models/isar/ordinal.dart';
2024-07-04 21:17:05 +00:00
import 'models/keys/key_data_interface.dart';
import 'models/paynym/paynym_account_lite.dart';
import 'models/send_view_auto_fill_data.dart';
import 'pages/add_wallet_views/add_token_view/add_custom_token_view.dart';
import 'pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart';
import 'pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
import 'pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart';
import 'pages/add_wallet_views/frost_ms/new/create_new_frost_ms_wallet_view.dart';
import 'pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart';
import 'pages/add_wallet_views/frost_ms/restore/restore_frost_ms_wallet_view.dart';
import 'pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart';
import 'pages/add_wallet_views/new_wallet_options/new_wallet_options_view.dart';
import 'pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
import 'pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart';
import 'pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart';
import 'pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart';
import 'pages/add_wallet_views/select_wallet_for_token_view.dart';
import 'pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart';
import 'pages/address_book_views/address_book_view.dart';
import 'pages/address_book_views/subviews/add_address_book_entry_view.dart';
import 'pages/address_book_views/subviews/add_new_contact_address_view.dart';
import 'pages/address_book_views/subviews/address_book_filter_view.dart';
import 'pages/address_book_views/subviews/contact_details_view.dart';
import 'pages/address_book_views/subviews/edit_contact_address_view.dart';
import 'pages/address_book_views/subviews/edit_contact_name_emoji_view.dart';
import 'pages/buy_view/buy_in_wallet_view.dart';
import 'pages/buy_view/buy_quote_preview.dart';
import 'pages/buy_view/buy_view.dart';
import 'pages/cashfusion/cashfusion_view.dart';
import 'pages/cashfusion/fusion_progress_view.dart';
import 'pages/coin_control/coin_control_view.dart';
import 'pages/coin_control/utxo_details_view.dart';
import 'pages/exchange_view/choose_from_stack_view.dart';
import 'pages/exchange_view/edit_trade_note_view.dart';
import 'pages/exchange_view/exchange_step_views/step_1_view.dart';
import 'pages/exchange_view/exchange_step_views/step_2_view.dart';
import 'pages/exchange_view/exchange_step_views/step_3_view.dart';
import 'pages/exchange_view/exchange_step_views/step_4_view.dart';
import 'pages/exchange_view/send_from_view.dart';
import 'pages/exchange_view/trade_details_view.dart';
import 'pages/exchange_view/wallet_initiated_exchange_view.dart';
import 'pages/generic/single_field_edit_view.dart';
import 'pages/home_view/home_view.dart';
import 'pages/intro_view.dart';
import 'pages/manage_favorites_view/manage_favorites_view.dart';
import 'pages/monkey/monkey_view.dart';
import 'pages/notification_views/notifications_view.dart';
import 'pages/ordinals/ordinal_details_view.dart';
import 'pages/ordinals/ordinals_filter_view.dart';
import 'pages/ordinals/ordinals_view.dart';
import 'pages/paynym/add_new_paynym_follow_view.dart';
import 'pages/paynym/paynym_claim_view.dart';
import 'pages/paynym/paynym_home_view.dart';
import 'pages/pinpad_views/create_pin_view.dart';
import 'pages/receive_view/addresses/address_details_view.dart';
import 'pages/receive_view/addresses/edit_address_label_view.dart';
import 'pages/receive_view/addresses/wallet_addresses_view.dart';
import 'pages/receive_view/generate_receiving_uri_qr_code_view.dart';
import 'pages/receive_view/receive_view.dart';
import 'pages/send_view/confirm_transaction_view.dart';
import 'pages/send_view/frost_ms/frost_send_view.dart';
import 'pages/send_view/send_view.dart';
import 'pages/send_view/token_send_view.dart';
import 'pages/settings_views/global_settings_view/about_view.dart';
import 'pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart';
import 'pages/settings_views/global_settings_view/advanced_views/debug_view.dart';
import 'pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart';
import 'pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart';
import 'pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart';
import 'pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart';
import 'pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart';
import 'pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart';
import 'pages/settings_views/global_settings_view/currency_view.dart';
import 'pages/settings_views/global_settings_view/delete_account_view.dart';
import 'pages/settings_views/global_settings_view/global_settings_view.dart';
import 'pages/settings_views/global_settings_view/hidden_settings.dart';
import 'pages/settings_views/global_settings_view/language_view.dart';
import 'pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import 'pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import 'pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart';
import 'pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart';
import 'pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart';
import 'pages/settings_views/global_settings_view/security_views/security_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart';
import 'pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart';
import 'pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart';
import 'pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart';
import 'pages/settings_views/global_settings_view/support_view.dart';
import 'pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
import 'pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
import 'pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart';
import 'pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart';
import 'pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart';
import 'pages/settings_views/wallet_settings_view/frost_ms/frost_participants_view.dart';
import 'pages/settings_views/wallet_settings_view/frost_ms/initiate_resharing/complete_reshare_config_view.dart';
import 'pages/settings_views/wallet_settings_view/frost_ms/initiate_resharing/initiate_resharing_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_recovery_phrase_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/lelantus_settings_view.dart';
2024-06-20 14:56:50 +00:00
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rbf_settings_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/spark_info.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart';
import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart';
import 'pages/special/firo_rescan_recovery_error_dialog.dart';
import 'pages/stack_privacy_calls.dart';
import 'pages/token_view/my_tokens_view.dart';
import 'pages/token_view/token_contract_details_view.dart';
import 'pages/token_view/token_view.dart';
import 'pages/wallet_view/transaction_views/all_transactions_view.dart';
import 'pages/wallet_view/transaction_views/edit_note_view.dart';
import 'pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'pages/wallet_view/transaction_views/transaction_search_filter_view.dart';
import 'pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart';
2024-06-15 16:27:16 +00:00
import 'pages/wallet_view/transaction_views/tx_v2/boost_transaction_view.dart';
import 'pages/wallet_view/transaction_views/tx_v2/fusion_group_details_view.dart';
import 'pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart';
import 'pages/wallet_view/wallet_view.dart';
import 'pages/wallets_view/wallets_overview.dart';
import 'pages/wallets_view/wallets_view.dart';
import 'pages_desktop_specific/address_book_view/desktop_address_book.dart';
import 'pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart';
import 'pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart';
import 'pages_desktop_specific/coin_control/desktop_coin_control_view.dart';
2023-01-04 16:49:13 +00:00
// import 'package:stackwallet/pages_desktop_specific/desktop_exchange/desktop_all_buys_view.dart';
import 'pages_desktop_specific/desktop_buy/desktop_buy_view.dart';
import 'pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart';
import 'pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart';
import 'pages_desktop_specific/desktop_home_view.dart';
import 'pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart';
import 'pages_desktop_specific/my_stack_view/my_stack_view.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart';
import 'pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart';
import 'pages_desktop_specific/notifications/desktop_notifications_view.dart';
import 'pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart';
import 'pages_desktop_specific/ordinals/desktop_ordinals_view.dart';
import 'pages_desktop_specific/password/create_password_view.dart';
import 'pages_desktop_specific/password/delete_password_warning_view.dart';
import 'pages_desktop_specific/password/forgot_password_desktop_view.dart';
import 'pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart';
import 'pages_desktop_specific/settings/desktop_settings_view.dart';
import 'pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/backup_and_restore/backup_and_restore_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/desktop_about_view.dart';
import 'pages_desktop_specific/settings/settings_menu/desktop_support_view.dart';
import 'pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/nodes_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/security_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart';
import 'pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart';
import 'pages_desktop_specific/spark_coins/spark_coins_view.dart';
import 'services/event_bus/events/global/node_connection_status_changed_event.dart';
import 'services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'utilities/amount/amount.dart';
import 'utilities/enums/add_wallet_type_enum.dart';
import 'wallets/crypto_currency/crypto_currency.dart';
import 'wallets/crypto_currency/intermediate/frost_currency.dart';
import 'wallets/models/tx_data.dart';
import 'wallets/wallet/wallet.dart';
2024-07-03 18:30:30 +00:00
import 'wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import 'widgets/choose_coin_view.dart';
import 'widgets/frost_scaffold.dart';
2022-08-26 08:11:35 +00:00
2023-05-26 19:25:59 +00:00
/*
* This file contains all the routes for the app.
* To add a new route, add it to the switch statement in the generateRoute method.
*/
2022-08-26 08:11:35 +00:00
class RouteGenerator {
static const bool useMaterialPageRoute = true;
static Route<dynamic> generateRoute(RouteSettings settings) {
// Getting arguments passed into Navigator.pushNamed
final args = settings.arguments;
switch (settings.name) {
2022-10-09 19:28:39 +00:00
case IntroView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const IntroView(),
settings: RouteSettings(name: settings.name),
);
2022-10-09 19:28:39 +00:00
case DeleteAccountView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DeleteAccountView(),
settings: RouteSettings(name: settings.name),
);
2022-10-09 19:28:39 +00:00
2022-08-26 08:11:35 +00:00
case HomeView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const HomeView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case CreatePinView.routeName:
if (args is bool) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CreatePinView(
popOnSuccess: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreatePinView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
2022-10-07 23:13:02 +00:00
case StackPrivacyCalls.routeName:
if (args is bool) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => StackPrivacyCalls(isSettings: args),
settings: RouteSettings(name: settings.name),
);
}
2022-10-07 23:13:02 +00:00
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StackPrivacyCalls(isSettings: false),
settings: RouteSettings(name: settings.name),
);
2022-10-07 23:13:02 +00:00
2023-05-04 18:10:37 +00:00
case ChooseCoinView.routeName:
if (args is Tuple3<String, String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ChooseCoinView(
title: args.item1,
coinAdditional: args.item2,
nextRouteName: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ManageExplorerView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2023-05-04 18:10:37 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ManageExplorerView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-28 19:10:57 +00:00
case FiroRescanRecoveryErrorView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FiroRescanRecoveryErrorView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case WalletsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const WalletsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AddWalletView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddWalletView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
2023-04-07 14:45:05 +00:00
case EditWalletTokensView.routeName:
2023-02-28 19:26:17 +00:00
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2023-04-07 14:45:05 +00:00
builder: (_) => EditWalletTokensView(
2023-02-28 19:26:17 +00:00
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
2023-04-07 14:45:05 +00:00
} else if (args is Tuple2<String, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditWalletTokensView(
walletId: args.item1,
contractsToMarkSelected: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
2023-02-28 19:26:17 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-04-03 23:05:48 +00:00
case DesktopTokenView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopTokenView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-27 20:29:55 +00:00
case SelectWalletForTokenView.routeName:
if (args is EthTokenEntity) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SelectWalletForTokenView(
entity: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-02-28 22:03:56 +00:00
case AddCustomTokenView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddCustomTokenView(),
settings: RouteSettings(
name: settings.name,
),
);
2023-02-28 22:03:56 +00:00
2023-04-10 15:12:07 +00:00
case WalletsOverview.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2023-04-10 15:12:07 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletsOverview(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-23 22:53:40 +00:00
case TokenContractDetailsView.routeName:
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TokenContractDetailsView(
contractAddress: args.item1,
walletId: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-07 17:11:57 +00:00
case SingleFieldEditView.routeName:
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SingleFieldEditView(
initialValue: args.item1,
label: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case MonkeyView.routeName:
2023-07-26 21:32:00 +00:00
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => MonkeyView(
2023-07-26 21:32:00 +00:00
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-01-19 23:44:01 +00:00
case CreateNewFrostMsWalletView.routeName:
if (args is ({
String walletName,
2024-04-25 17:44:59 +00:00
FrostCurrency frostCurrency,
2024-01-19 23:44:01 +00:00
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CreateNewFrostMsWalletView(
walletName: args.walletName,
2024-04-25 17:44:59 +00:00
frostCurrency: args.frostCurrency,
2024-01-19 23:44:01 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case RestoreFrostMsWalletView.routeName:
if (args is ({
String walletName,
2024-04-25 17:44:59 +00:00
FrostCurrency frostCurrency,
2024-01-19 23:44:01 +00:00
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RestoreFrostMsWalletView(
walletName: args.walletName,
2024-04-25 17:44:59 +00:00
frostCurrency: args.frostCurrency,
2024-01-19 23:44:01 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case SelectNewFrostImportTypeView.routeName:
if (args is ({
String walletName,
FrostCurrency frostCurrency,
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SelectNewFrostImportTypeView(
walletName: args.walletName,
frostCurrency: args.frostCurrency,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case FrostStepScaffold.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const FrostStepScaffold(),
settings: RouteSettings(
name: settings.name,
),
);
2024-01-19 23:44:01 +00:00
case FrostMSWalletOptionsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FrostMSWalletOptionsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case FrostParticipantsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FrostParticipantsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-04-29 16:55:46 +00:00
case InitiateResharingView.routeName:
2024-01-19 23:44:01 +00:00
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2024-04-29 16:55:46 +00:00
builder: (_) => InitiateResharingView(
2024-01-19 23:44:01 +00:00
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case CompleteReshareConfigView.routeName:
if (args is ({String walletId, Map<String, int> resharers})) {
2024-01-19 23:44:01 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CompleteReshareConfigView(
walletId: args.walletId,
resharers: args.resharers,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-01-24 00:33:40 +00:00
case FrostSendView.routeName:
if (args is ({
String walletId,
2024-05-15 21:20:45 +00:00
CryptoCurrency coin,
2024-01-24 00:33:40 +00:00
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FrostSendView(
walletId: args.walletId,
coin: args.coin,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-26 18:03:01 +00:00
// case MonkeyLoadedView.routeName:
// if (args is Tuple2<String, ChangeNotifierProvider<Manager>>) {
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => MonkeyLoadedView(
// walletId: args.item1,
// managerProvider: args.item2,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
// }
// return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-07 17:11:57 +00:00
case CoinControlView.routeName:
2023-03-07 19:51:06 +00:00
if (args is Tuple2<String, CoinControlViewType>) {
2022-12-20 23:00:03 +00:00
return getRoute(
2022-12-20 20:48:31 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CoinControlView(
2023-03-07 19:51:06 +00:00
walletId: args.item1,
type: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
2023-03-07 21:45:22 +00:00
} else if (args
is Tuple4<String, CoinControlViewType, Amount?, Set<UTXO>?>) {
2023-03-07 19:51:06 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CoinControlView(
walletId: args.item1,
type: args.item2,
requestedTotal: args.item3,
2023-03-07 21:45:22 +00:00
selectedUTXOs: args.item4,
2022-12-20 23:00:03 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-18 16:15:05 +00:00
case OrdinalsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => OrdinalsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-21 22:54:51 +00:00
case DesktopOrdinalsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopOrdinalsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-18 16:15:05 +00:00
case OrdinalDetailsView.routeName:
if (args is ({Ordinal ordinal, String walletId})) {
2023-07-18 16:15:05 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => OrdinalDetailsView(
walletId: args.walletId,
ordinal: args.ordinal,
2023-07-18 16:15:05 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DesktopOrdinalDetailsView.routeName:
if (args is ({Ordinal ordinal, String walletId})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2023-07-21 23:50:18 +00:00
builder: (_) => DesktopOrdinalDetailsView(
walletId: args.walletId,
ordinal: args.ordinal,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-18 17:48:15 +00:00
case OrdinalsFilterView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const OrdinalsFilterView(),
settings: RouteSettings(name: settings.name),
);
2023-07-18 17:48:15 +00:00
case UtxoDetailsView.routeName:
if (args is Tuple2<Id, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => UtxoDetailsView(
walletId: args.item2,
utxoId: args.item1,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case PaynymClaimView.routeName:
2023-03-06 18:11:13 +00:00
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => PaynymClaimView(
2023-03-06 18:11:13 +00:00
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-12-20 23:00:03 +00:00
case PaynymHomeView.routeName:
2022-12-21 23:02:14 +00:00
if (args is String) {
2022-12-20 23:00:03 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => PaynymHomeView(
2022-12-21 23:02:14 +00:00
walletId: args,
2022-12-21 19:46:50 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case AddNewPaynymFollowView.routeName:
2022-12-21 23:02:14 +00:00
if (args is String) {
2022-12-21 19:46:50 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddNewPaynymFollowView(
2022-12-21 23:02:14 +00:00
walletId: args,
2022-12-20 23:00:03 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-12-20 20:48:31 +00:00
2023-07-26 22:21:13 +00:00
case CashFusionView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CashFusionView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-10-16 21:28:09 +00:00
case FusionProgressView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FusionProgressView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-07-26 22:21:13 +00:00
case DesktopCashFusionView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopCashFusionView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case GlobalSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const GlobalSettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AddressBookView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddressBookView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddressBookView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AddressBookFilterView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddressBookFilterView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case StackBackupView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StackBackupView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AutoBackupView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AutoBackupView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case EditAutoBackupView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const EditAutoBackupView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case CreateAutoBackupView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateAutoBackupView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case SecurityView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SecurityView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case ChangePinView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ChangePinView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case BaseCurrencySettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BaseCurrencySettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case LanguageSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const LanguageSettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
2023-09-01 22:50:17 +00:00
case TorSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const TorSettingsView(),
settings: RouteSettings(name: settings.name),
);
2023-09-01 22:50:17 +00:00
case TorSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const TorSettings(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AboutView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AboutView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case DebugView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DebugView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
2023-04-06 19:28:11 +00:00
case XPubView.routeName:
2024-07-03 18:30:30 +00:00
if (args is (String, ({List<XPub> xpubs, String fingerprint}))) {
return getRoute(
2023-04-06 19:28:11 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => XPubView(
2024-07-03 18:30:30 +00:00
walletId: args.$1,
xpubData: args.$2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ChangeRepresentativeView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ChangeRepresentativeView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-04-06 19:28:11 +00:00
2022-08-26 08:11:35 +00:00
case AppearanceSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AppearanceSettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case SyncingPreferencesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingPreferencesView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case StartupPreferencesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StartupPreferencesView(),
settings: RouteSettings(name: settings.name),
);
case StartupWalletSelectionView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StartupWalletSelectionView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case ManageNodesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageNodesView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case SyncingOptionsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingOptionsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case WalletSyncingOptionsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const WalletSyncingOptionsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AdvancedSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AdvancedSettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case SupportView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SupportView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case AddAddressBookEntryView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddAddressBookEntryView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case RestoreFromFileView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const RestoreFromFileView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case RestoreFromEncryptedStringView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RestoreFromEncryptedStringView(
encrypted: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-05-29 22:50:21 +00:00
case ManageCoinUnitsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageCoinUnitsView(),
settings: RouteSettings(name: settings.name),
);
2023-05-29 22:50:21 +00:00
case EditCoinUnitsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2023-05-29 22:50:21 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditCoinUnitsView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case CreateBackupInfoView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateBackupInfoView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case CreateBackupView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateBackupView(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case HiddenSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: false,
builder: (_) => const HiddenSettings(),
settings: RouteSettings(name: settings.name),
);
2022-08-26 08:11:35 +00:00
case CoinNodesView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CoinNodesView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NodeDetailsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple3<CryptoCurrency, String, String>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NodeDetailsView(
coin: args.item1,
nodeId: args.item2,
popRouteName: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case EditNoteView.routeName:
2023-11-09 17:39:12 +00:00
if (args is Tuple2<String, String>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditNoteView(
txid: args.item1,
walletId: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-02-02 21:37:59 +00:00
case EditAddressLabelView.routeName:
2023-03-06 19:27:04 +00:00
if (args is int) {
2023-02-02 21:37:59 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditAddressLabelView(
2023-03-06 19:27:04 +00:00
addressLabelId: args,
2023-02-02 21:37:59 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case EditTradeNoteView.routeName:
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditTradeNoteView(
tradeId: args.item1,
note: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case AddEditNodeView.routeName:
2024-05-15 21:20:45 +00:00
if (args
is Tuple4<AddEditNodeViewType, CryptoCurrency, String?, String>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddEditNodeView(
viewType: args.item1,
coin: args.item2,
nodeId: args.item3,
routeOnSuccessOrDelete: args.item4,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ContactDetailsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ContactDetailsView(
contactId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case AddNewContactAddressView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddNewContactAddressView(
contactId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case EditContactNameEmojiView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditContactNameEmojiView(
contactId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case EditContactAddressView.routeName:
if (args is Tuple2<String, ContactAddressEntry>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditContactAddressView(
contactId: args.item1,
addressEntry: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case SystemBrightnessThemeSelectionView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SystemBrightnessThemeSelectionView(),
settings: RouteSettings(
name: settings.name,
),
);
2022-08-26 08:11:35 +00:00
case WalletNetworkSettingsView.routeName:
if (args is Tuple3<String, WalletSyncStatus, NodeConnectionStatus>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletNetworkSettingsView(
walletId: args.item1,
initialSyncStatus: args.item2,
initialNodeStatus: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case WalletBackupView.routeName:
if (args is ({String walletId, List<String> mnemonic})) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletBackupView(
walletId: args.walletId,
mnemonic: args.mnemonic,
),
settings: RouteSettings(
name: settings.name,
),
);
} else if (args is ({
String walletId,
List<String> mnemonic,
({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData,
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletBackupView(
walletId: args.walletId,
mnemonic: args.mnemonic,
frostWalletData: args.frostWalletData,
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
2024-07-03 19:55:11 +00:00
} else if (args is ({
String walletId,
List<String> mnemonic,
2024-07-04 21:17:05 +00:00
KeyDataInterface? keyData,
2024-07-03 19:55:11 +00:00
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletBackupView(
walletId: args.walletId,
mnemonic: args.mnemonic,
2024-07-04 21:17:05 +00:00
keyData: args.keyData,
2024-07-03 19:55:11 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
} else if (args is ({
String walletId,
List<String> mnemonic,
2024-07-04 21:17:05 +00:00
KeyDataInterface? keyData,
2024-07-03 19:55:11 +00:00
({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData,
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletBackupView(
walletId: args.walletId,
mnemonic: args.mnemonic,
frostWalletData: args.frostWalletData,
2024-07-04 21:17:05 +00:00
keyData: args.keyData,
2024-07-03 19:55:11 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-07-04 21:17:05 +00:00
case MobileKeyDataView.routeName:
2024-07-03 19:55:11 +00:00
if (args is ({
String walletId,
2024-07-04 21:17:05 +00:00
KeyDataInterface keyData,
2024-07-03 19:55:11 +00:00
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2024-07-04 21:17:05 +00:00
builder: (_) => MobileKeyDataView(
2024-07-03 19:55:11 +00:00
walletId: args.walletId,
2024-07-04 21:17:05 +00:00
keyData: args.keyData,
2024-07-03 19:55:11 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
2022-08-26 08:11:35 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case WalletSettingsWalletSettingsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletSettingsWalletSettingsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case RenameWalletView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RenameWalletView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DeleteWalletWarningView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeleteWalletWarningView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case CreateOrRestoreWalletView.routeName:
2023-02-27 22:43:09 +00:00
if (args is AddWalletListEntity) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CreateOrRestoreWalletView(
2023-02-27 22:43:09 +00:00
entity: args,
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NameYourWalletView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<AddWalletType, CryptoCurrency>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NameYourWalletView(
addWalletType: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NewWalletRecoveryPhraseWarningView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<String, CryptoCurrency>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NewWalletRecoveryPhraseWarningView(
walletName: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case RestoreOptionsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<String, CryptoCurrency>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RestoreOptionsView(
walletName: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NewWalletOptionsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<String, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NewWalletOptionsView(
walletName: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case RestoreWalletView.routeName:
if (args
is Tuple6<String, CryptoCurrency, int, DateTime?, String, bool>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RestoreWalletView(
2024-05-15 21:20:45 +00:00
walletName: args.item1,
coin: args.item2,
seedWordsLength: args.item3,
restoreFromDate: args.item4,
mnemonicPassphrase: args.item5,
enableLelantusScanning: args.item6 ?? false,
2024-05-15 21:20:45 +00:00
),
2022-08-26 08:11:35 +00:00
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NewWalletRecoveryPhraseView.routeName:
if (args is Tuple2<Wallet, List<String>>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NewWalletRecoveryPhraseView(
wallet: args.item1,
2022-08-26 08:11:35 +00:00
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case VerifyRecoveryPhraseView.routeName:
if (args is Tuple2<Wallet, List<String>>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => VerifyRecoveryPhraseView(
wallet: args.item1,
2022-08-26 08:11:35 +00:00
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ManageFavoritesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageFavoritesView(),
);
2022-08-26 08:11:35 +00:00
case WalletView.routeName:
if (args is String) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletView(
walletId: args,
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case TransactionDetailsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple3<Transaction, CryptoCurrency, String>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TransactionDetailsView(
transaction: args.item1,
coin: args.item2,
walletId: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-10-20 20:19:40 +00:00
case TransactionV2DetailsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is ({
TransactionV2 tx,
CryptoCurrency coin,
String walletId
})) {
2023-10-20 20:19:40 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TransactionV2DetailsView(
transaction: args.tx,
coin: args.coin,
walletId: args.walletId,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-10-23 17:42:45 +00:00
case FusionGroupDetailsView.routeName:
if (args is ({
List<TransactionV2> transactions,
2024-05-15 21:20:45 +00:00
CryptoCurrency coin,
2023-10-23 17:42:45 +00:00
String walletId
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => FusionGroupDetailsView(
transactions: args.transactions,
coin: args.coin,
walletId: args.walletId,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case AllTransactionsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AllTransactionsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-10-23 19:29:46 +00:00
case AllTransactionsV2View.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AllTransactionsV2View(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
if (args is ({String walletId, String contractAddress})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AllTransactionsV2View(
walletId: args.walletId,
contractAddress: args.contractAddress,
),
settings: RouteSettings(
name: settings.name,
),
);
}
2023-10-23 19:29:46 +00:00
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case TransactionSearchFilterView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TransactionSearchFilterView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ReceiveView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ReceiveView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
} else if (args is Tuple2<String, EthContract?>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ReceiveView(
walletId: args.item1,
tokenContract: args.item2,
2023-02-01 15:29:51 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-06 21:09:32 +00:00
case WalletAddressesView.routeName:
if (args is String) {
2023-02-01 15:29:51 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2023-03-06 21:09:32 +00:00
builder: (_) => WalletAddressesView(
walletId: args,
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-21 23:18:07 +00:00
case AddressDetailsView.routeName:
if (args is Tuple2<Id, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddressDetailsView(
walletId: args.item2,
addressId: args.item1,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case SendView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<String, CryptoCurrency>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
2024-05-15 21:20:45 +00:00
} else if (args
is Tuple3<String, CryptoCurrency, SendViewAutoFillData>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
autoFillData: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
2024-05-15 21:20:45 +00:00
} else if (args is Tuple3<String, CryptoCurrency, PaynymAccountLite>) {
2023-01-26 17:46:16 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
accountLite: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
2024-05-15 21:20:45 +00:00
} else if (args is ({CryptoCurrency coin, String walletId})) {
2024-03-15 23:57:30 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.walletId,
coin: args.coin,
),
settings: RouteSettings(
name: settings.name,
),
);
2022-08-26 08:11:35 +00:00
}
2024-03-15 23:57:30 +00:00
2022-08-26 08:11:35 +00:00
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-03-30 16:55:02 +00:00
case TokenSendView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple3<String, CryptoCurrency, EthContract>) {
2023-03-30 16:55:02 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TokenSendView(
walletId: args.item1,
coin: args.item2,
tokenContract: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-11-01 17:42:33 +00:00
case ConfirmTransactionView.routeName:
2024-01-04 18:52:00 +00:00
if (args is (TxData, String, VoidCallback)) {
2022-11-01 17:42:33 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ConfirmTransactionView(
2024-01-04 18:52:00 +00:00
txData: args.$1,
walletId: args.$2,
onSuccess: args.$3,
2022-11-01 17:42:33 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case WalletInitiatedExchangeView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<String, CryptoCurrency>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2022-08-30 22:34:49 +00:00
builder: (_) => Stack(
children: [
WalletInitiatedExchangeView(
walletId: args.item1,
coin: args.item2,
),
// ExchangeLoadingOverlayView(
// unawaitedLoad: args.item3,
// ),
2022-08-30 22:34:49 +00:00
],
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
}
2024-05-15 21:20:45 +00:00
if (args is Tuple3<String, CryptoCurrency, EthContract?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => Stack(
children: [
WalletInitiatedExchangeView(
walletId: args.item1,
coin: args.item2,
contract: args.item3,
),
// ExchangeLoadingOverlayView(
// unawaitedLoad: args.item3,
// ),
],
),
settings: RouteSettings(
name: settings.name,
),
);
}
2022-08-26 08:11:35 +00:00
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NotificationsView.routeName:
if (args is String?) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NotificationsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case WalletSettingsView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple4<String, CryptoCurrency, WalletSyncStatus,
NodeConnectionStatus>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletSettingsView(
walletId: args.item1,
coin: args.item2,
initialSyncStatus: args.item3,
initialNodeStatus: args.item4,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DeleteWalletRecoveryPhraseView.routeName:
if (args is ({String walletId, List<String> mnemonicWords})) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeleteWalletRecoveryPhraseView(
mnemonic: args.mnemonicWords,
walletId: args.walletId,
2022-08-26 08:11:35 +00:00
),
settings: RouteSettings(
name: settings.name,
2024-05-14 15:49:20 +00:00
),
);
} else if (args is ({
String walletId,
List<String> mnemonicWords,
({
String myName,
String config,
String keys,
({String config, String keys})? prevGen,
})? frostWalletData,
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeleteWalletRecoveryPhraseView(
mnemonic: args.mnemonicWords,
walletId: args.walletId,
frostWalletData: args.frostWalletData,
),
settings: RouteSettings(
name: settings.name,
2022-08-26 08:11:35 +00:00
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
// exchange steps
case Step1View.routeName:
if (args is IncompleteExchangeModel) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => Step1View(
model: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case Step2View.routeName:
if (args is IncompleteExchangeModel) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => Step2View(
model: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case Step3View.routeName:
if (args is IncompleteExchangeModel) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => Step3View(
model: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case Step4View.routeName:
if (args is IncompleteExchangeModel) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => Step4View(
model: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case TradeDetailsView.routeName:
if (args is Tuple4<String, Transaction?, String?, String?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TradeDetailsView(
tradeId: args.item1,
transactionIfSentFromStack: args.item2,
walletId: args.item3,
walletName: args.item4,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ChooseFromStackView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ChooseFromStackView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-09-30 21:21:10 +00:00
case SendFromView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple4<CryptoCurrency, Amount, String, Trade>) {
2022-09-30 21:21:10 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendFromView(
coin: args.item1,
amount: args.item2,
trade: args.item4,
address: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-10-31 18:03:21 +00:00
case GenerateUriQrCodeView.routeName:
2024-05-15 21:20:45 +00:00
if (args is Tuple2<CryptoCurrency, String>) {
2022-10-31 18:03:21 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => GenerateUriQrCodeView(
coin: args.item1,
receivingAddress: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case BuyQuotePreviewView.routeName:
if (args is SimplexQuote) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => BuyQuotePreviewView(
quote: args,
),
settings: RouteSettings(
name: settings.name,
2022-10-31 18:03:21 +00:00
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case LelantusSettingsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => LelantusSettingsView(walletId: args),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-06-20 14:56:50 +00:00
case RbfSettingsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RbfSettingsView(walletId: args),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case SparkInfoView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SparkInfoView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-09-15 19:48:48 +00:00
// == Desktop specific routes ============================================
case CreatePasswordView.routeName:
if (args is bool) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CreatePasswordView(
restoreFromSWB: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
2022-09-15 19:48:48 +00:00
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreatePasswordView(),
settings: RouteSettings(name: settings.name),
);
2022-09-15 19:48:48 +00:00
2022-11-08 20:04:00 +00:00
case ForgotPasswordDesktopView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ForgotPasswordDesktopView(),
settings: RouteSettings(name: settings.name),
);
2022-11-08 20:04:00 +00:00
case ForgottenPassphraseRestoreFromSWB.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ForgottenPassphraseRestoreFromSWB(),
settings: RouteSettings(name: settings.name),
);
case DeletePasswordWarningView.routeName:
if (args is bool) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeletePasswordWarningView(
shouldCreateNew: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DesktopHomeView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopHomeView(),
settings: RouteSettings(name: settings.name),
);
case DesktopNotificationsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopNotificationsView(),
settings: RouteSettings(name: settings.name),
);
2022-11-18 18:45:42 +00:00
case DesktopExchangeView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopExchangeView(),
settings: RouteSettings(name: settings.name),
);
2022-11-18 18:45:42 +00:00
case BuyView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BuyView(),
settings: RouteSettings(name: settings.name),
);
case BuyInWalletView.routeName:
2024-05-15 21:20:45 +00:00
if (args is CryptoCurrency) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => BuyInWalletView(coin: args),
settings: RouteSettings(
name: settings.name,
),
);
}
2024-05-15 21:20:45 +00:00
if (args is Tuple2<CryptoCurrency, EthContract?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => BuyInWalletView(
coin: args.item1,
contract: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-01-04 16:49:13 +00:00
case DesktopBuyView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopBuyView(),
settings: RouteSettings(name: settings.name),
);
2023-01-04 16:49:13 +00:00
2022-11-29 19:29:03 +00:00
case DesktopAllTradesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAllTradesView(),
settings: RouteSettings(name: settings.name),
);
2022-11-29 19:29:03 +00:00
2022-10-19 22:10:34 +00:00
case DesktopSettingsView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopSettingsView(),
settings: RouteSettings(name: settings.name),
);
2022-10-05 17:41:41 +00:00
2022-09-16 23:54:46 +00:00
case MyStackView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const MyStackView(),
settings: RouteSettings(name: settings.name),
);
2022-09-16 23:54:46 +00:00
2022-10-13 19:07:48 +00:00
case DesktopWalletView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopWalletView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-04-02 19:21:59 +00:00
case DesktopWalletAddressesView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopWalletAddressesView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case LelantusCoinsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => LelantusCoinsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-12-16 20:26:23 +00:00
case SparkCoinsView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SparkCoinsView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DesktopCoinControlView.routeName:
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DesktopCoinControlView(
walletId: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2024-06-15 16:27:16 +00:00
case BoostTransactionView.routeName:
if (args is TransactionV2) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => BoostTransactionView(
transaction: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-10-19 22:10:34 +00:00
case BackupRestoreSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BackupRestoreSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
case SecuritySettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SecuritySettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
case CurrencySettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CurrencySettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
case LanguageOptionSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const LanguageOptionSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
2022-10-20 17:54:24 +00:00
case NodesSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const NodesSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-20 17:54:24 +00:00
2022-10-19 22:10:34 +00:00
case SyncingPreferencesSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingPreferencesSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
case AppearanceOptionSettings.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AppearanceOptionSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-19 22:10:34 +00:00
2023-04-27 23:06:46 +00:00
case ManageThemesView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageThemesView(),
settings: RouteSettings(name: settings.name),
);
2023-04-27 23:06:46 +00:00
2022-10-19 22:10:34 +00:00
case AdvancedSettings.routeName:
2022-10-17 15:07:17 +00:00
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AdvancedSettings(),
settings: RouteSettings(name: settings.name),
);
2022-10-17 15:07:17 +00:00
2022-11-07 15:15:44 +00:00
case DesktopSupportView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopSupportView(),
settings: RouteSettings(name: settings.name),
);
2022-11-07 15:15:44 +00:00
2022-11-07 17:42:55 +00:00
case DesktopAboutView.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAboutView(),
settings: RouteSettings(name: settings.name),
);
2022-11-07 17:42:55 +00:00
2022-11-09 15:57:41 +00:00
case DesktopAddressBook.routeName:
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAddressBook(),
settings: RouteSettings(name: settings.name),
);
2022-11-09 15:57:41 +00:00
2022-10-28 20:42:50 +00:00
case WalletKeysDesktopPopup.routeName:
if (args is ({
List<String> mnemonic,
String walletId,
({String keys, String config})? frostData
})) {
2022-11-02 23:29:26 +00:00
return FadePageRoute(
WalletKeysDesktopPopup(
words: args.mnemonic,
walletId: args.walletId,
frostData: args.frostData,
2022-10-28 20:42:50 +00:00
),
2022-11-02 23:29:26 +00:00
RouteSettings(
2022-10-28 20:42:50 +00:00
name: settings.name,
),
);
2024-07-04 15:31:41 +00:00
} else if (args is ({
List<String> mnemonic,
String walletId,
({String keys, String config})? frostData,
2024-07-04 21:17:05 +00:00
KeyDataInterface? keyData,
2024-07-04 15:31:41 +00:00
})) {
return FadePageRoute(
WalletKeysDesktopPopup(
words: args.mnemonic,
walletId: args.walletId,
frostData: args.frostData,
2024-07-04 21:17:05 +00:00
keyData: args.keyData,
2024-07-04 15:31:41 +00:00
),
RouteSettings(
name: settings.name,
),
);
} else if (args is ({
List<String> mnemonic,
String walletId,
2024-07-04 21:17:05 +00:00
KeyDataInterface? keyData,
2024-07-04 15:31:41 +00:00
})) {
return FadePageRoute(
WalletKeysDesktopPopup(
words: args.mnemonic,
walletId: args.walletId,
2024-07-04 21:17:05 +00:00
keyData: args.keyData,
2024-07-04 15:31:41 +00:00
),
RouteSettings(
name: settings.name,
),
);
2022-11-02 23:29:26 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case UnlockWalletKeysDesktop.routeName:
if (args is String) {
return FadePageRoute(
UnlockWalletKeysDesktop(
walletId: args,
),
RouteSettings(
name: settings.name,
),
);
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => WalletKeysDesktopPopup(
// words: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
2022-10-28 20:42:50 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DesktopDeleteWalletDialog.routeName:
if (args is String) {
return FadePageRoute(
DesktopDeleteWalletDialog(
walletId: args,
),
RouteSettings(
name: settings.name,
),
);
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => WalletKeysDesktopPopup(
// words: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-11-21 17:50:53 +00:00
case DesktopAttentionDeleteWallet.routeName:
if (args is String) {
return FadePageRoute(
DesktopAttentionDeleteWallet(
walletId: args,
),
RouteSettings(
name: settings.name,
),
);
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => WalletKeysDesktopPopup(
// words: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case DeleteWalletKeysPopup.routeName:
if (args is Tuple2<String, List<String>>) {
return FadePageRoute(
DeleteWalletKeysPopup(
walletId: args.item1,
words: args.item2,
),
RouteSettings(
name: settings.name,
),
);
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => WalletKeysDesktopPopup(
// words: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-10-28 20:42:50 +00:00
case QRCodeDesktopPopupContent.routeName:
if (args is String) {
2022-11-02 23:29:26 +00:00
return FadePageRoute(
QRCodeDesktopPopupContent(
2022-10-28 20:42:50 +00:00
value: args,
),
2022-11-02 23:29:26 +00:00
RouteSettings(
2022-10-28 20:42:50 +00:00
name: settings.name,
),
);
2022-11-02 23:29:26 +00:00
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => QRCodeDesktopPopupContent(
// value: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
2022-10-28 20:42:50 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-01-16 13:19:32 +00:00
case MyTokensView.routeName:
2023-03-01 00:36:54 +00:00
if (args is String) {
2023-01-16 13:19:32 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => MyTokensView(
2023-03-01 00:36:54 +00:00
walletId: args,
),
2023-01-20 17:24:19 +00:00
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2023-01-25 09:29:20 +00:00
// case WalletView.routeName:
// if (args is Tuple2<String, ChangeNotifierProvider<Manager>>) {
// return getRoute(
// shouldUseMaterialRoute: useMaterialPageRoute,
// builder: (_) => WalletView(
// walletId: args.item1,
// managerProvider: args.item2,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
// }
2023-01-20 17:24:19 +00:00
case TokenView.routeName:
if (args is String) {
2023-01-20 17:24:19 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TokenView(
walletId: args,
2023-01-16 13:19:32 +00:00
),
settings: RouteSettings(
name: settings.name,
),
);
2023-10-17 17:21:53 +00:00
} else if (args is ({String walletId, bool popPrevious})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => TokenView(
walletId: args.walletId,
popPrevious: args.popPrevious,
),
settings: RouteSettings(
name: settings.name,
),
);
2023-01-16 13:19:32 +00:00
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-09-16 23:54:46 +00:00
// == End of desktop specific routes =====================================
2022-09-15 19:48:48 +00:00
2022-08-26 08:11:35 +00:00
default:
return _routeError("");
}
}
static Route<dynamic> getRoute({
bool shouldUseMaterialRoute = useMaterialPageRoute,
required Widget Function(BuildContext) builder,
String? title,
RouteSettings? settings,
bool maintainState = true,
bool fullscreenDialog = false,
}) {
if (shouldUseMaterialRoute) {
return MaterialPageRoute(
builder: builder,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullscreenDialog,
);
} else {
return CupertinoPageRoute(
builder: builder,
settings: settings,
title: title,
maintainState: maintainState,
fullscreenDialog: fullscreenDialog,
);
}
}
static Route<dynamic> createSlideTransitionRoute(Widget viewToInsert) {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => viewToInsert,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
2024-05-27 23:56:22 +00:00
final begin = const Offset(0.0, 1.0);
final end = Offset.zero;
final curve = Curves.easeInOut;
2022-08-26 08:11:35 +00:00
2024-05-27 23:56:22 +00:00
final tween =
2022-08-26 08:11:35 +00:00
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
static Route<dynamic> _routeError(String message) {
// Replace with robust ErrorView page
2024-05-27 23:56:22 +00:00
final Widget errorView = Scaffold(
2022-08-26 08:11:35 +00:00
appBar: AppBar(
backgroundColor: Colors.black,
title: const Text('Navigation error'),
),
body: Center(
child: Text(
2024-05-15 21:20:45 +00:00
'Error handling route, this is not supposed to happen. Try restarting the app.\n$message',
),
2022-08-26 08:11:35 +00:00
),
);
return getRoute(
2024-05-15 21:20:45 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => errorView,
);
2022-08-26 08:11:35 +00:00
}
}
2022-11-02 23:29:26 +00:00
class FadePageRoute<T> extends PageRoute<T> {
FadePageRoute(this.child, RouteSettings settings) : _settings = settings;
final Widget child;
final RouteSettings _settings;
@override
Color? get barrierColor => null;
@override
String? get barrierLabel => null;
@override
Widget buildPage(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return FadeTransition(
opacity: animation,
child: child,
);
}
@override
bool get maintainState => true;
@override
Duration get transitionDuration => const Duration(milliseconds: 100);
@override
RouteSettings get settings => _settings;
}