24
This commit is contained in:
32
lib/navigation/router/routers/dashboard.dart
Normal file
32
lib/navigation/router/routers/dashboard.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:iroute/pages/dashboard/chat_room.dart';
|
||||
import 'package:iroute/pages/dashboard/view_books.dart';
|
||||
|
||||
final RouteBase dashboardRouters = GoRoute(
|
||||
path: '/dashboard',
|
||||
redirect: (_,state) {
|
||||
if (state.fullPath == '/dashboard') {
|
||||
return '/dashboard/view';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: 'view',
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
return const ViewBooks();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: 'chat/:roomId',
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
String? roomId = state.pathParameters['roomId'];
|
||||
return ChatRoom(
|
||||
roomId: roomId,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
Reference in New Issue
Block a user