Files
iroute/lib/navigation/router/routers/dashboard.dart
toly 25e51d789f 24
2023-12-11 21:53:27 +08:00

33 lines
803 B
Dart

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,
);
},
),
],
);