stack_wallet/lib/route_generator.dart

2102 lines
79 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:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart';
2023-03-22 15:25:21 +00:00
import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart';
2023-03-27 20:29:55 +00:00
import 'package:stackwallet/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart';
import 'package:stackwallet/models/buy/response_objects/quote.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/isar/models/contact_entry.dart';
2023-02-03 19:22:21 +00:00
import 'package:stackwallet/models/isar/models/isar_models.dart';
2023-07-21 23:51:04 +00:00
import 'package:stackwallet/models/isar/ordinal.dart';
2023-01-26 17:46:16 +00:00
import 'package:stackwallet/models/paynym/paynym_account_lite.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/models/send_view_auto_fill_data.dart';
2023-02-28 22:03:56 +00:00
import 'package:stackwallet/pages/add_wallet_views/add_token_view/add_custom_token_view.dart';
2023-04-07 14:45:05 +00:00
import 'package:stackwallet/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart';
import 'package:stackwallet/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart';
2022-09-19 21:53:21 +00:00
import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart';
2023-03-27 20:29:55 +00:00
import 'package:stackwallet/pages/add_wallet_views/select_wallet_for_token_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart';
import 'package:stackwallet/pages/address_book_views/address_book_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/add_address_book_entry_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/add_new_contact_address_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/address_book_filter_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/contact_details_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/edit_contact_address_view.dart';
import 'package:stackwallet/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart';
import 'package:stackwallet/pages/buy_view/buy_in_wallet_view.dart';
import 'package:stackwallet/pages/buy_view/buy_quote_preview.dart';
import 'package:stackwallet/pages/buy_view/buy_view.dart';
2023-07-26 22:21:13 +00:00
import 'package:stackwallet/pages/cashfusion/cashfusion_view.dart';
2023-03-06 18:11:13 +00:00
import 'package:stackwallet/pages/coin_control/coin_control_view.dart';
import 'package:stackwallet/pages/coin_control/utxo_details_view.dart';
import 'package:stackwallet/pages/exchange_view/choose_from_stack_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/exchange_view/edit_trade_note_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_1_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_2_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_3_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_4_view.dart';
2022-09-30 21:21:10 +00:00
import 'package:stackwallet/pages/exchange_view/send_from_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
import 'package:stackwallet/pages/exchange_view/wallet_initiated_exchange_view.dart';
2023-03-07 17:11:57 +00:00
import 'package:stackwallet/pages/generic/single_field_edit_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/home_view/home_view.dart';
2022-10-09 19:28:39 +00:00
import 'package:stackwallet/pages/intro_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/manage_favorites_view/manage_favorites_view.dart';
import 'package:stackwallet/pages/monkey/monkey_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
2023-07-18 16:15:05 +00:00
import 'package:stackwallet/pages/ordinals/ordinal_details_view.dart';
2023-07-18 17:48:15 +00:00
import 'package:stackwallet/pages/ordinals/ordinals_filter_view.dart';
2023-07-18 16:15:05 +00:00
import 'package:stackwallet/pages/ordinals/ordinals_view.dart';
2022-12-21 19:46:50 +00:00
import 'package:stackwallet/pages/paynym/add_new_paynym_follow_view.dart';
2022-12-20 20:48:31 +00:00
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
2022-12-20 23:00:03 +00:00
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
2023-03-21 23:18:07 +00:00
import 'package:stackwallet/pages/receive_view/addresses/address_details_view.dart';
2023-02-02 21:37:59 +00:00
import 'package:stackwallet/pages/receive_view/addresses/edit_address_label_view.dart';
2023-03-07 17:12:51 +00:00
import 'package:stackwallet/pages/receive_view/addresses/wallet_addresses_view.dart';
2022-10-31 18:03:21 +00:00
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/receive_view/receive_view.dart';
2022-11-01 17:42:33 +00:00
import 'package:stackwallet/pages/send_view/confirm_transaction_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/send_view/send_view.dart';
2023-03-30 16:55:02 +00:00
import 'package:stackwallet/pages/send_view/token_send_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/about_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/debug_view.dart';
2023-05-29 22:50:21 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart';
2023-05-04 18:10:37 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart';
2023-04-27 23:06:46 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/currency_view.dart';
2022-10-09 19:28:39 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/delete_account_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/global_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/language_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/security_views/security_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/settings_views/global_settings_view/support_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_recovery_phrase_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart';
2023-07-28 19:10:57 +00:00
import 'package:stackwallet/pages/special/firo_rescan_recovery_error_dialog.dart';
2022-10-07 23:13:02 +00:00
import 'package:stackwallet/pages/stack_privacy_calls.dart';
2023-01-16 13:19:32 +00:00
import 'package:stackwallet/pages/token_view/my_tokens_view.dart';
2023-03-23 22:53:40 +00:00
import 'package:stackwallet/pages/token_view/token_contract_details_view.dart';
2023-01-20 17:24:19 +00:00
import 'package:stackwallet/pages/token_view/token_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/edit_note_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_search_filter_view.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
2023-04-10 15:12:07 +00:00
import 'package:stackwallet/pages/wallets_view/wallets_overview.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/pages/wallets_view/wallets_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/address_book_view/desktop_address_book.dart';
2023-04-02 19:21:59 +00:00
import 'package:stackwallet/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart';
2023-07-26 22:21:13 +00:00
import 'package:stackwallet/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart';
import 'package:stackwallet/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 'package:stackwallet/pages_desktop_specific/desktop_buy/desktop_buy_view.dart';
2022-11-29 19:29:03 +00:00
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart';
2022-11-18 18:45:42 +00:00
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/desktop_home_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_stack_view.dart';
2023-04-03 23:05:48 +00:00
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart';
import 'package:stackwallet/pages_desktop_specific/notifications/desktop_notifications_view.dart';
import 'package:stackwallet/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart';
2023-07-21 22:54:51 +00:00
import 'package:stackwallet/pages_desktop_specific/ordinals/desktop_ordinals_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/password/create_password_view.dart';
import 'package:stackwallet/pages_desktop_specific/password/delete_password_warning_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/password/forgot_password_desktop_view.dart';
import 'package:stackwallet/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/settings/desktop_settings_view.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/backup_and_restore/backup_and_restore_settings.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart';
2022-12-01 16:10:18 +00:00
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/desktop_support_view.dart';
2022-12-01 14:48:23 +00:00
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/nodes_settings.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/security_settings.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
2023-04-06 21:24:56 +00:00
import 'package:stackwallet/utilities/amount/amount.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/utilities/enums/add_wallet_type_enum.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/widgets/choose_coin_view.dart';
2022-08-26 08:11:35 +00:00
import 'package:tuple/tuple.dart';
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const IntroView(),
settings: RouteSettings(name: settings.name));
case DeleteAccountView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DeleteAccountView(),
settings: RouteSettings(name: settings.name));
2022-08-26 08:11:35 +00:00
case HomeView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const HomeView(),
settings: RouteSettings(name: settings.name));
case CreatePinView.routeName:
if (args is bool) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CreatePinView(
popOnSuccess: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreatePinView(),
settings: RouteSettings(name: settings.name));
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(
shouldUseMaterialRoute: useMaterialPageRoute,
2022-12-20 20:48:31 +00:00
builder: (_) => const StackPrivacyCalls(isSettings: false),
2022-10-07 23:13:02 +00:00
settings: RouteSettings(name: settings.name));
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:
if (args is Coin) {
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const WalletsView(),
settings: RouteSettings(name: settings.name));
case AddWalletView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddWalletView(),
settings: RouteSettings(name: settings.name));
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:
if (args is Coin) {
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()}");
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const OrdinalsFilterView(),
settings: RouteSettings(name: settings.name));
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()}");
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const GlobalSettingsView(),
settings: RouteSettings(name: settings.name));
case AddressBookView.routeName:
if (args is Coin) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AddressBookView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddressBookView(),
settings: RouteSettings(name: settings.name));
case AddressBookFilterView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddressBookFilterView(),
settings: RouteSettings(name: settings.name));
case StackBackupView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StackBackupView(),
settings: RouteSettings(name: settings.name));
case AutoBackupView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AutoBackupView(),
settings: RouteSettings(name: settings.name));
case EditAutoBackupView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const EditAutoBackupView(),
settings: RouteSettings(name: settings.name));
case CreateAutoBackupView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateAutoBackupView(),
settings: RouteSettings(name: settings.name));
case SecurityView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SecurityView(),
settings: RouteSettings(name: settings.name));
case ChangePinView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ChangePinView(),
settings: RouteSettings(name: settings.name));
case BaseCurrencySettingsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BaseCurrencySettingsView(),
settings: RouteSettings(name: settings.name));
case LanguageSettingsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const LanguageSettingsView(),
settings: RouteSettings(name: settings.name));
case AboutView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AboutView(),
settings: RouteSettings(name: settings.name));
case DebugView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DebugView(),
settings: RouteSettings(name: settings.name));
2023-04-06 19:28:11 +00:00
case XPubView.routeName:
if (args is String) {
return getRoute(
2023-04-06 19:28:11 +00:00
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => XPubView(
2023-04-08 02:04:48 +00:00
walletId: args,
),
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AppearanceSettingsView(),
settings: RouteSettings(name: settings.name));
case SyncingPreferencesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingPreferencesView(),
settings: RouteSettings(name: settings.name));
case StartupPreferencesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StartupPreferencesView(),
settings: RouteSettings(name: settings.name));
case StartupWalletSelectionView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const StartupWalletSelectionView(),
settings: RouteSettings(name: settings.name));
2022-08-26 08:11:35 +00:00
case ManageNodesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageNodesView(),
settings: RouteSettings(name: settings.name));
case SyncingOptionsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingOptionsView(),
settings: RouteSettings(name: settings.name));
case WalletSyncingOptionsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const WalletSyncingOptionsView(),
settings: RouteSettings(name: settings.name));
case AdvancedSettingsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AdvancedSettingsView(),
settings: RouteSettings(name: settings.name));
case SupportView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SupportView(),
settings: RouteSettings(name: settings.name));
case AddAddressBookEntryView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AddAddressBookEntryView(),
settings: RouteSettings(name: settings.name));
case RestoreFromFileView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const RestoreFromFileView(),
settings: RouteSettings(name: settings.name));
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageCoinUnitsView(),
settings: RouteSettings(name: settings.name));
case EditCoinUnitsView.routeName:
if (args is Coin) {
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateBackupInfoView(),
settings: RouteSettings(name: settings.name));
case CreateBackupView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreateBackupView(),
settings: RouteSettings(name: settings.name));
case HiddenSettings.routeName:
return getRoute(
shouldUseMaterialRoute: false,
builder: (_) => const HiddenSettings(),
settings: RouteSettings(name: settings.name));
case CoinNodesView.routeName:
if (args is Coin) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => CoinNodesView(
coin: args,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case NodeDetailsView.routeName:
if (args is Tuple3<Coin, String, String>) {
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:
if (args is Tuple3<String, String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => EditNoteView(
txid: args.item1,
walletId: args.item2,
note: args.item3,
),
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:
if (args is Tuple4<AddEditNodeViewType, Coin, String?, String>) {
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 Tuple2<String, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => WalletBackupView(
walletId: args.item1,
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
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:
if (args is Tuple2<AddWalletType, Coin>) {
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:
if (args is Tuple2<String, Coin>) {
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:
if (args is Tuple2<String, Coin>) {
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 RestoreWalletView.routeName:
2023-02-08 15:20:34 +00:00
if (args is Tuple5<String, Coin, int, DateTime, String>) {
2022-08-26 08:11:35 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => RestoreWalletView(
2023-02-08 15:20:34 +00:00
walletName: args.item1,
coin: args.item2,
seedWordsLength: args.item3,
restoreFromDate: args.item4,
mnemonicPassphrase: args.item5),
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<Manager, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => NewWalletRecoveryPhraseView(
manager: args.item1,
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case VerifyRecoveryPhraseView.routeName:
if (args is Tuple2<Manager, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => VerifyRecoveryPhraseView(
manager: args.item1,
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case ManageFavoritesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageFavoritesView());
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,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case TransactionDetailsView.routeName:
if (args is Tuple3<Transaction, Coin, String>) {
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()}");
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()}");
case TransactionSearchFilterView.routeName:
if (args is Coin) {
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:
if (args is Tuple2<String, Coin>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
} else if (args is Tuple3<String, Coin, SendViewAutoFillData>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
autoFillData: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
2023-01-26 17:46:16 +00:00
} else if (args is Tuple3<String, Coin, PaynymAccountLite>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => SendView(
walletId: args.item1,
coin: args.item2,
accountLite: args.item3,
),
settings: RouteSettings(
name: settings.name,
),
);
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:
if (args is Tuple3<String, Coin, EthContract>) {
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:
if (args is Tuple2<Map<String, dynamic>, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => ConfirmTransactionView(
transactionInfo: args.item1,
walletId: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
2022-08-26 08:11:35 +00:00
case WalletInitiatedExchangeView.routeName:
if (args is Tuple2<String, Coin>) {
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,
),
);
}
if (args is Tuple3<String, Coin, 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:
if (args
is Tuple4<String, Coin, WalletSyncStatus, NodeConnectionStatus>) {
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 Tuple2<Manager, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => DeleteWalletRecoveryPhraseView(
manager: args.item1,
mnemonic: args.item2,
),
settings: RouteSettings(
name: settings.name,
),
);
}
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:
if (args is Coin) {
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:
2023-04-05 22:06:31 +00:00
if (args is Tuple4<Coin, 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:
if (args is Tuple2<Coin, String>) {
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()}");
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CreatePasswordView(),
settings: RouteSettings(name: settings.name));
2022-11-08 20:04:00 +00:00
case ForgotPasswordDesktopView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ForgotPasswordDesktopView(),
settings: RouteSettings(name: settings.name));
case ForgottenPassphraseRestoreFromSWB.routeName:
return getRoute(
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopHomeView(),
settings: RouteSettings(name: settings.name));
case DesktopNotificationsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopNotificationsView(),
settings: RouteSettings(name: settings.name));
2022-11-18 18:45:42 +00:00
case DesktopExchangeView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopExchangeView(),
settings: RouteSettings(name: settings.name));
case BuyView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BuyView(),
settings: RouteSettings(name: settings.name));
case BuyInWalletView.routeName:
if (args is Coin) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => BuyInWalletView(coin: args),
settings: RouteSettings(
name: settings.name,
),
);
}
if (args is Tuple2<Coin, 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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopBuyView(),
settings: RouteSettings(name: settings.name));
2022-11-29 19:29:03 +00:00
case DesktopAllTradesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAllTradesView(),
settings: RouteSettings(name: settings.name));
2022-10-19 22:10:34 +00:00
case DesktopSettingsView.routeName:
return getRoute(
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(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const MyStackView(),
settings: RouteSettings(name: settings.name));
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 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()}");
2022-10-19 22:10:34 +00:00
case BackupRestoreSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BackupRestoreSettings(),
settings: RouteSettings(name: settings.name));
case SecuritySettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SecuritySettings(),
settings: RouteSettings(name: settings.name));
case CurrencySettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const CurrencySettings(),
settings: RouteSettings(name: settings.name));
case LanguageOptionSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const LanguageOptionSettings(),
settings: RouteSettings(name: settings.name));
2022-10-20 17:54:24 +00:00
case NodesSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const NodesSettings(),
settings: RouteSettings(name: settings.name));
2022-10-19 22:10:34 +00:00
case SyncingPreferencesSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const SyncingPreferencesSettings(),
settings: RouteSettings(name: settings.name));
case AppearanceOptionSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const AppearanceOptionSettings(),
settings: RouteSettings(name: settings.name));
2023-04-27 23:06:46 +00:00
case ManageThemesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageThemesView(),
settings: RouteSettings(name: settings.name));
2022-10-19 22:10:34 +00:00
case AdvancedSettings.routeName:
2022-10-17 15:07:17 +00:00
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
2022-10-19 22:10:34 +00:00
builder: (_) => const AdvancedSettings(),
2022-10-17 15:07:17 +00:00
settings: RouteSettings(name: settings.name));
2022-11-07 15:15:44 +00:00
case DesktopSupportView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopSupportView(),
settings: RouteSettings(name: settings.name));
2022-11-07 17:42:55 +00:00
case DesktopAboutView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAboutView(),
settings: RouteSettings(name: settings.name));
2022-11-09 15:57:41 +00:00
case DesktopAddressBook.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAddressBook(),
settings: RouteSettings(name: settings.name));
2022-10-28 20:42:50 +00:00
case WalletKeysDesktopPopup.routeName:
if (args is List<String>) {
2022-11-02 23:29:26 +00:00
return FadePageRoute(
WalletKeysDesktopPopup(
2022-10-28 20:42:50 +00:00
words: 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: (_) => WalletKeysDesktopPopup(
// words: args,
// ),
// settings: RouteSettings(
// name: settings.name,
// ),
// );
}
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,
),
);
}
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) {
var begin = const Offset(0.0, 1.0);
var end = Offset.zero;
var curve = Curves.easeInOut;
var tween =
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
Widget errorView = Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: const Text('Navigation error'),
),
body: Center(
child: Text(
'Error handling route, this is not supposed to happen. Try restarting the app.\n$message'),
),
);
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => errorView);
}
}
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;
}