mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
+19
-1
@@ -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',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user