33 lines
811 B
Dart
33 lines
811 B
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import '../views/bar_screen_view.dart';
|
|
import '../views/product_form_view.dart';
|
|
import '../views/product_list_view.dart';
|
|
|
|
final appRouter = GoRouter(
|
|
initialLocation: '/bar',
|
|
routes: [
|
|
GoRoute(
|
|
path: '/bar',
|
|
builder: (context, state) => const BarScreenView(),
|
|
),
|
|
GoRoute(
|
|
path: '/products',
|
|
builder: (context, state) => const ProductListView(),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'new',
|
|
builder: (context, state) => const ProductFormView(),
|
|
),
|
|
GoRoute(
|
|
path: ':id/edit',
|
|
builder: (context, state) {
|
|
final productId = state.pathParameters['id']!;
|
|
|
|
return ProductFormView(productId: productId);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
); |