init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
Reference in New Issue
Block a user