|
| 1 | +import 'package:go_router/go_router.dart'; |
| 2 | +import 'package:bdk_demo/features/shared/widgets/placeholder_page.dart'; |
| 3 | +import 'package:bdk_demo/features/wallet_setup/wallet_choice_page.dart'; |
| 4 | + |
| 5 | +abstract final class AppRoutes { |
| 6 | + static const walletChoice = '/'; |
| 7 | + static const activeWallets = '/active-wallets'; |
| 8 | + static const createWallet = '/create-wallet'; |
| 9 | + static const recoverWallet = '/recover-wallet'; |
| 10 | + static const home = '/home'; |
| 11 | + static const receive = '/receive'; |
| 12 | + static const send = '/send'; |
| 13 | + static const transactionHistory = '/transactions'; |
| 14 | + static const transactionDetail = '/transactions/:txid'; |
| 15 | + static const settings = '/settings'; |
| 16 | + static const about = '/about'; |
| 17 | + static const theme = '/theme'; |
| 18 | + static const logs = '/logs'; |
| 19 | + static const recoveryData = '/recovery-data'; |
| 20 | +} |
| 21 | + |
| 22 | +GoRouter createRouter() => GoRouter( |
| 23 | + initialLocation: AppRoutes.walletChoice, |
| 24 | + routes: [ |
| 25 | + GoRoute( |
| 26 | + path: AppRoutes.walletChoice, |
| 27 | + name: 'walletChoice', |
| 28 | + builder: (context, state) => const WalletChoicePage(), |
| 29 | + ), |
| 30 | + GoRoute( |
| 31 | + path: AppRoutes.activeWallets, |
| 32 | + name: 'activeWallets', |
| 33 | + builder: (context, state) => |
| 34 | + const PlaceholderPage(title: 'Active Wallets'), |
| 35 | + ), |
| 36 | + GoRoute( |
| 37 | + path: AppRoutes.createWallet, |
| 38 | + name: 'createWallet', |
| 39 | + builder: (context, state) => |
| 40 | + const PlaceholderPage(title: 'Create Wallet'), |
| 41 | + ), |
| 42 | + GoRoute( |
| 43 | + path: AppRoutes.recoverWallet, |
| 44 | + name: 'recoverWallet', |
| 45 | + builder: (context, state) => |
| 46 | + const PlaceholderPage(title: 'Recover Wallet'), |
| 47 | + ), |
| 48 | + |
| 49 | + GoRoute( |
| 50 | + path: AppRoutes.home, |
| 51 | + name: 'home', |
| 52 | + builder: (context, state) => const PlaceholderPage(title: 'Home'), |
| 53 | + ), |
| 54 | + GoRoute( |
| 55 | + path: AppRoutes.receive, |
| 56 | + name: 'receive', |
| 57 | + builder: (context, state) => const PlaceholderPage(title: 'Receive'), |
| 58 | + ), |
| 59 | + GoRoute( |
| 60 | + path: AppRoutes.send, |
| 61 | + name: 'send', |
| 62 | + builder: (context, state) => const PlaceholderPage(title: 'Send'), |
| 63 | + ), |
| 64 | + GoRoute( |
| 65 | + path: AppRoutes.transactionHistory, |
| 66 | + name: 'transactionHistory', |
| 67 | + builder: (context, state) => |
| 68 | + const PlaceholderPage(title: 'Transaction History'), |
| 69 | + ), |
| 70 | + GoRoute( |
| 71 | + path: AppRoutes.transactionDetail, |
| 72 | + name: 'transactionDetail', |
| 73 | + builder: (context, state) { |
| 74 | + final txid = state.pathParameters['txid'] ?? ''; |
| 75 | + return PlaceholderPage(title: 'Transaction $txid'); |
| 76 | + }, |
| 77 | + ), |
| 78 | + |
| 79 | + GoRoute( |
| 80 | + path: AppRoutes.settings, |
| 81 | + name: 'settings', |
| 82 | + builder: (context, state) => const PlaceholderPage(title: 'Settings'), |
| 83 | + ), |
| 84 | + GoRoute( |
| 85 | + path: AppRoutes.about, |
| 86 | + name: 'about', |
| 87 | + builder: (context, state) => const PlaceholderPage(title: 'About'), |
| 88 | + ), |
| 89 | + GoRoute( |
| 90 | + path: AppRoutes.theme, |
| 91 | + name: 'theme', |
| 92 | + builder: (context, state) => const PlaceholderPage(title: 'Theme'), |
| 93 | + ), |
| 94 | + GoRoute( |
| 95 | + path: AppRoutes.logs, |
| 96 | + name: 'logs', |
| 97 | + builder: (context, state) => const PlaceholderPage(title: 'Logs'), |
| 98 | + ), |
| 99 | + GoRoute( |
| 100 | + path: AppRoutes.recoveryData, |
| 101 | + name: 'recoveryData', |
| 102 | + builder: (context, state) => |
| 103 | + const PlaceholderPage(title: 'Recovery Data'), |
| 104 | + ), |
| 105 | + ], |
| 106 | +); |
0 commit comments