cake_wallet/lib/router.dart

406 lines
19 KiB
Dart
Raw Normal View History

2022-07-06 02:49:52 +00:00
import 'package:cake_wallet/entities/cake_phone_entities/phone_number_service.dart';
2020-09-26 19:17:31 +00:00
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/buy/order.dart';
2021-01-13 16:43:34 +00:00
import 'package:cake_wallet/src/screens/backup/backup_page.dart';
import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart';
import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart';
import 'package:cake_wallet/src/screens/buy/pre_order_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_auth_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/phone_number_service/auto_renew_settings_page.dart';
import 'package:cake_wallet/src/screens/order_details/order_details_page.dart';
2020-10-22 18:24:24 +00:00
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
2021-01-13 16:43:34 +00:00
import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart';
2020-10-13 21:11:04 +00:00
import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart';
import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart';
import 'package:cake_wallet/src/screens/support/support_page.dart';
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart';
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart';
import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart';
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
2020-01-04 19:31:52 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/utils/language_list.dart';
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_keys_vm.dart';
import 'package:cake_wallet/exchange/trade.dart';
2021-12-24 12:37:24 +00:00
import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/wallet_type.dart';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
2020-01-04 19:31:52 +00:00
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
2020-07-06 20:09:03 +00:00
import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart';
2020-01-04 19:31:52 +00:00
import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
import 'package:cake_wallet/src/screens/receive/receive_page.dart';
2020-06-20 07:10:00 +00:00
import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart';
2020-01-04 19:31:52 +00:00
import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart';
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart';
import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart';
import 'package:cake_wallet/src/screens/restore/restore_options_page.dart';
import 'package:cake_wallet/src/screens/restore/restore_wallet_options_page.dart';
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_page.dart';
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_keys_page.dart';
import 'package:cake_wallet/src/screens/send/send_page.dart';
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
import 'package:cake_wallet/src/screens/seed_language/seed_language_page.dart';
2020-01-04 19:31:52 +00:00
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
2020-07-06 20:09:03 +00:00
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_edit_or_create_page.dart';
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
import 'package:cake_wallet/src/screens/contact/contact_page.dart';
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
2020-01-04 19:31:52 +00:00
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_details.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
import 'package:cake_wallet/src/screens/settings/settings.dart';
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
import 'package:cake_wallet/src/screens/faq/faq_page.dart';
import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart';
import 'package:cake_wallet/src/screens/welcome/create_welcome_page.dart';
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_type_page.dart';
import 'package:cake_wallet/src/screens/send/send_template_page.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dart';
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart';
import 'package:flutter/services.dart';
2022-03-30 15:57:04 +00:00
import 'package:cake_wallet/wallet_types.g.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/address_page.dart';
import 'package:cake_wallet/src/screens/receive/fullscreen_qr_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_welcome_page.dart';
2022-07-01 12:57:55 +00:00
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_verification_page.dart';
2022-07-01 14:24:44 +00:00
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_products_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/phone_number_service/phone_number_product_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/active_services_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/phone_number_service/number_settings_page.dart';
2020-09-14 12:08:33 +00:00
RouteSettings currentRouteSettings;
2020-10-19 11:20:24 +00:00
Route<dynamic> createRoute(RouteSettings settings) {
currentRouteSettings = settings;
2020-10-19 11:20:24 +00:00
switch (settings.name) {
case Routes.welcome:
return MaterialPageRoute<void>(builder: (_) => createWelcomePage());
case Routes.newWalletFromWelcome:
return CupertinoPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<SetupPinCodePage>(param1: (PinCodeState<PinCodeWidget> context, dynamic _) {
if (availableWalletTypes.length == 1) {
Navigator.of(context.context).pushNamed(Routes.newWallet, arguments: availableWalletTypes.first);
} else {
Navigator.of(context.context).pushNamed(Routes.newWalletType);
}
}),
2020-10-19 11:20:24 +00:00
fullscreenDialog: true);
case Routes.newWalletType:
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>(
param1: (BuildContext context, WalletType type) =>
2022-07-06 02:49:52 +00:00
Navigator.of(context).pushNamed(Routes.newWallet, arguments: type),
param2: false));
2020-10-19 11:20:24 +00:00
case Routes.newWallet:
2020-11-30 17:17:44 +00:00
final type = settings.arguments as WalletType;
2020-10-19 11:20:24 +00:00
final walletNewVM = getIt.get<WalletNewVM>(param1: type);
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => NewWalletPage(walletNewVM));
2020-10-19 11:20:24 +00:00
case Routes.setupPin:
2020-10-24 14:35:55 +00:00
Function(PinCodeState<PinCodeWidget>, String) callback;
2020-10-19 11:20:24 +00:00
2020-10-24 14:35:55 +00:00
if (settings.arguments is Function(PinCodeState<PinCodeWidget>, String)) {
2022-07-06 02:49:52 +00:00
callback = settings.arguments as Function(PinCodeState<PinCodeWidget>, String);
2020-10-19 11:20:24 +00:00
}
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SetupPinCodePage>(param1: callback));
2020-10-19 11:20:24 +00:00
2021-12-30 17:20:00 +00:00
case Routes.moneroRestoreWalletFromWelcome:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(
2021-12-30 17:20:00 +00:00
builder: (_) => getIt.get<SetupPinCodePage>(
param1: (PinCodeState<PinCodeWidget> context, dynamic _) =>
2022-07-06 02:49:52 +00:00
Navigator.pushNamed(context.context, Routes.restoreWallet, arguments: WalletType.monero)),
2021-12-30 17:20:00 +00:00
fullscreenDialog: true);
2020-10-19 11:20:24 +00:00
case Routes.restoreWalletType:
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<NewWalletTypePage>(
param1: (BuildContext context, WalletType type) =>
2022-07-06 02:49:52 +00:00
Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type),
param2: false));
2020-10-19 11:20:24 +00:00
case Routes.restoreOptions:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<RestoreOptionsPage>());
2020-10-19 11:20:24 +00:00
case Routes.restoreWalletOptions:
final type = WalletType.monero; //settings.arguments as WalletType;
return CupertinoPageRoute<void>(
builder: (_) => RestoreWalletOptionsPage(
type: type,
onRestoreFromSeed: (context) {
2022-07-06 02:49:52 +00:00
final route = type == WalletType.monero ? Routes.seedLanguage : Routes.restoreWalletFromSeed;
final args = type == WalletType.monero ? [type, Routes.restoreWalletFromSeed] : [type];
2020-10-19 11:20:24 +00:00
Navigator.of(context).pushNamed(route, arguments: args);
},
onRestoreFromKeys: (context) {
2022-07-06 02:49:52 +00:00
final route = type == WalletType.monero ? Routes.seedLanguage : Routes.restoreWalletFromKeys;
final args = type == WalletType.monero ? [type, Routes.restoreWalletFromKeys] : [type];
2020-10-19 11:20:24 +00:00
Navigator.of(context).pushNamed(route, arguments: args);
}));
case Routes.restoreWalletOptionsFromWelcome:
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<SetupPinCodePage>(
param1: (PinCodeState<PinCodeWidget> context, dynamic _) =>
2022-07-06 02:49:52 +00:00
Navigator.pushNamed(context.context, Routes.restoreWalletType)),
2020-10-19 11:20:24 +00:00
fullscreenDialog: true);
case Routes.seed:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<WalletSeedPage>(param1: settings.arguments as bool));
2020-10-19 11:20:24 +00:00
case Routes.restoreWallet:
return MaterialPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<WalletRestorePage>(param1: settings.arguments as WalletType));
2020-10-19 11:20:24 +00:00
case Routes.restoreWalletFromSeed:
final type = settings.arguments as WalletType;
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => RestoreWalletFromSeedPage(type: type));
2020-10-19 11:20:24 +00:00
case Routes.restoreWalletFromKeys:
final args = settings.arguments as List<dynamic>;
final type = args.first as WalletType;
2022-07-06 02:49:52 +00:00
final language = type == WalletType.monero ? args[1] as String : LanguageList.english;
2020-10-19 11:20:24 +00:00
2022-07-06 02:49:52 +00:00
final walletRestorationFromKeysVM = getIt.get<WalletRestorationFromKeysVM>(param1: [type, language]);
2020-10-19 11:20:24 +00:00
return CupertinoPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => RestoreWalletFromKeysPage(walletRestorationFromKeysVM: walletRestorationFromKeysVM));
2020-10-19 11:20:24 +00:00
case Routes.dashboard:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<DashboardPage>());
2020-10-19 11:20:24 +00:00
case Routes.send:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<SendPage>());
2020-10-19 11:20:24 +00:00
case Routes.sendTemplate:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<SendTemplatePage>());
2020-10-19 11:20:24 +00:00
case Routes.receive:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<ReceivePage>());
2020-10-19 11:20:24 +00:00
2022-03-30 15:57:04 +00:00
case Routes.addressPage:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<AddressPage>());
2022-03-30 15:57:04 +00:00
2020-10-19 11:20:24 +00:00
case Routes.transactionDetails:
return CupertinoPageRoute<void>(
fullscreenDialog: true,
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<TransactionDetailsPage>(param1: settings.arguments as TransactionInfo));
2020-10-19 11:20:24 +00:00
case Routes.newSubaddress:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
2020-10-19 11:20:24 +00:00
case Routes.disclaimer:
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage());
case Routes.readDisclaimer:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage(isReadOnly: true));
2020-10-19 11:20:24 +00:00
case Routes.seedLanguage:
final args = settings.arguments as List<dynamic>;
final type = args.first as WalletType;
final redirectRoute = args[1] as String;
return CupertinoPageRoute<void>(builder: (_) {
return SeedLanguage(
2022-07-06 02:49:52 +00:00
onConfirm: (context, lang) =>
Navigator.of(context).popAndPushNamed(redirectRoute, arguments: [type, lang]));
2020-10-19 11:20:24 +00:00
});
case Routes.walletList:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<WalletListPage>());
2020-10-19 11:20:24 +00:00
case Routes.auth:
return MaterialPageRoute<void>(
fullscreenDialog: true,
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<AuthPage>(param1: settings.arguments as OnAuthenticationFinished, param2: true));
2020-10-19 11:20:24 +00:00
case Routes.unlock:
return MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => WillPopScope(
2022-07-06 02:49:52 +00:00
child: getIt.get<AuthPage>(param1: settings.arguments as OnAuthenticationFinished, param2: false),
onWillPop: () async => false));
2020-10-19 11:20:24 +00:00
case Routes.nodeList:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<NodeListPage>());
2020-10-19 11:20:24 +00:00
case Routes.newNode:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<NodeCreateOrEditPage>());
2020-10-19 11:20:24 +00:00
case Routes.login:
return CupertinoPageRoute<void>(
builder: (context) => WillPopScope(
child: getIt.get<AuthPage>(instanceName: 'login'),
2022-07-06 02:49:52 +00:00
onWillPop: () => SystemChannels.platform.invokeMethod('SystemNavigator.pop')),
2020-10-19 11:20:24 +00:00
fullscreenDialog: true);
case Routes.accountCreation:
return CupertinoPageRoute<String>(
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<MoneroAccountEditOrCreatePage>(param1: settings.arguments as AccountListItem));
2020-10-19 11:20:24 +00:00
case Routes.addressBook:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<ContactListPage>(param1: true));
2020-10-19 11:20:24 +00:00
case Routes.pickerAddressBook:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<ContactListPage>(param1: false));
2020-10-19 11:20:24 +00:00
case Routes.addressBookAddContact:
return CupertinoPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<ContactPage>(param1: settings.arguments as ContactRecord));
2020-10-19 11:20:24 +00:00
case Routes.showKeys:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<WalletKeysPage>(), fullscreenDialog: true);
2020-10-19 11:20:24 +00:00
case Routes.exchangeTrade:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTradePage>());
2020-10-19 11:20:24 +00:00
case Routes.exchangeConfirm:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeConfirmPage>());
2020-10-19 11:20:24 +00:00
case Routes.tradeDetails:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
2020-10-19 11:20:24 +00:00
case Routes.orderDetails:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<OrderDetailsPage>(param1: settings.arguments as Order));
case Routes.preOrder:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<PreOrderPage>());
case Routes.buyWebView:
final args = settings.arguments as List;
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<BuyWebViewPage>(param1: args));
2021-03-17 10:32:22 +00:00
2020-10-19 11:20:24 +00:00
case Routes.restoreWalletFromSeedDetails:
final args = settings.arguments as List;
2022-07-06 02:49:52 +00:00
final walletRestorationFromSeedVM = getIt.get<WalletRestorationFromSeedVM>(param1: args);
2020-10-19 11:20:24 +00:00
return CupertinoPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => RestoreWalletFromSeedDetailsPage(walletRestorationFromSeedVM: walletRestorationFromSeedVM));
2020-10-19 11:20:24 +00:00
case Routes.exchange:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangePage>());
2020-10-19 11:20:24 +00:00
case Routes.exchangeTemplate:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<ExchangeTemplatePage>());
2020-10-19 11:20:24 +00:00
case Routes.settings:
return MaterialPageRoute<void>(builder: (_) => getIt.get<SettingsPage>());
case Routes.rescan:
return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>());
case Routes.faq:
return MaterialPageRoute<void>(builder: (_) => getIt.get<FaqPage>());
case Routes.preSeed:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<PreSeedPage>(param1: settings.arguments as WalletType));
2021-01-13 16:43:34 +00:00
case Routes.backup:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => getIt.get<BackupPage>());
2021-01-13 16:43:34 +00:00
case Routes.editBackupPassword:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<EditBackupPasswordPage>());
2021-01-13 16:43:34 +00:00
case Routes.restoreFromBackup:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<RestoreFromBackupPage>());
case Routes.support:
2022-07-06 02:49:52 +00:00
return CupertinoPageRoute<void>(builder: (_) => getIt.get<SupportPage>());
case Routes.unspentCoinsList:
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<UnspentCoinsListPage>());
case Routes.unspentCoinsDetails:
final args = settings.arguments as List;
2022-07-06 02:49:52 +00:00
return MaterialPageRoute<void>(builder: (_) => getIt.get<UnspentCoinsDetailsPage>(param1: args));
case Routes.fullscreenQR:
final args = settings.arguments as Map<String, dynamic>;
return MaterialPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => getIt.get<FullscreenQRPage>(
param1: args['qrData'] as String,
param2: args['isLight'] as bool,
));
case Routes.cakePhoneWelcome:
return MaterialPageRoute<CakePhoneWelcomePage>(
settings: RouteSettings(name: Routes.cakePhoneWelcome),
builder: (_) => CakePhoneWelcomePage(),
);
case Routes.cakePhoneAuth:
final isLogin = settings.arguments as bool ?? false;
return MaterialPageRoute<CakePhoneWelcomePage>(
settings: RouteSettings(name: Routes.cakePhoneAuth),
builder: (_) => CakePhoneAuthPage(isLogin: isLogin),
);
2022-07-01 12:57:55 +00:00
case Routes.cakePhoneVerification:
return MaterialPageRoute<CakePhoneVerificationPage>(
settings: RouteSettings(name: Routes.cakePhoneVerification),
2022-07-01 12:57:55 +00:00
builder: (_) => CakePhoneVerificationPage(),
);
2022-07-01 14:24:44 +00:00
case Routes.cakePhoneProducts:
return MaterialPageRoute<CakePhoneProductsPage>(
settings: RouteSettings(name: Routes.cakePhoneProducts),
2022-07-01 14:24:44 +00:00
builder: (_) => CakePhoneProductsPage(),
);
case Routes.phoneNumberProduct:
return MaterialPageRoute<PhoneNumberProductPage>(
settings: RouteSettings(name: Routes.phoneNumberProduct),
builder: (_) => PhoneNumberProductPage(
getIt.get<PhonePlanViewModel>(),
phoneNumberService: settings.arguments as PhoneNumberService,
),
);
case Routes.cakePhoneActiveServices:
return MaterialPageRoute<ActiveServicesPage>(
settings: RouteSettings(name: Routes.cakePhoneActiveServices),
builder: (_) => ActiveServicesPage(),
);
2022-07-06 02:49:52 +00:00
case Routes.numberSettings:
return MaterialPageRoute<NumberSettingsPage>(
settings: RouteSettings(name: Routes.numberSettings),
builder: (_) => NumberSettingsPage(
phoneNumberService: settings.arguments as PhoneNumberService,
phonePlanViewModel: getIt.get<PhonePlanViewModel>(),
),
);
case Routes.autoRenewSettings:
return MaterialPageRoute<AutoRenewSettingsPage>(
settings: RouteSettings(name: Routes.autoRenewSettings),
builder: (_) => AutoRenewSettingsPage(
phoneNumberService: settings.arguments as PhoneNumberService,
phonePlanViewModel: getIt.get<PhonePlanViewModel>(),
),
);
2020-10-19 11:20:24 +00:00
default:
return MaterialPageRoute<void>(
2022-07-06 02:49:52 +00:00
builder: (_) => Scaffold(body: Center(child: Text(S.current.router_no_route(settings.name)))));
2020-01-04 19:31:52 +00:00
}
2020-11-06 18:54:00 +00:00
}