This commit is contained in:
2026-03-20 09:26:14 +03:00
parent 3dcbb6164e
commit 99d985ca45
11 changed files with 1065 additions and 114 deletions
+19 -1
View File
@@ -3,6 +3,8 @@ import 'package:go_router/go_router.dart';
import '../features/dashboard/screen.dart';
import '../features/add_transaction/screen.dart';
import '../features/categories/screen.dart';
import '../features/settings/screen.dart';
import '../shared/models/transaction.dart';
final _shellKey = GlobalKey<NavigatorState>();
@@ -25,11 +27,20 @@ final appRouter = GoRouter(
child: CategoriesScreen(),
),
),
GoRoute(
path: '/settings',
pageBuilder: (context, state) => const NoTransitionPage(
child: SettingsScreen(),
),
),
],
),
GoRoute(
path: '/add',
builder: (context, state) => const AddTransactionScreen(),
builder: (context, state) {
final transaction = state.extra as Transaction?;
return AddTransactionScreen(initial: transaction);
},
),
],
);
@@ -41,6 +52,7 @@ class AppShell extends StatelessWidget {
int _locationToIndex(BuildContext context) {
final location = GoRouterState.of(context).uri.toString();
if (location.startsWith('/categories')) return 1;
if (location.startsWith('/settings')) return 2;
return 0;
}
@@ -60,6 +72,7 @@ class AppShell extends StatelessWidget {
onDestinationSelected: (i) {
if (i == 0) context.go('/dashboard');
if (i == 1) context.go('/categories');
if (i == 2) context.go('/settings');
},
destinations: const [
NavigationDestination(
@@ -72,6 +85,11 @@ class AppShell extends StatelessWidget {
selectedIcon: Icon(Icons.pie_chart_rounded),
label: 'Categories',
),
NavigationDestination(
icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings_rounded),
label: 'Settings',
),
],
),
);