This commit is contained in:
Phuoc Nguyen
2025-10-28 14:24:58 +07:00
parent df99d0c9e3
commit e14ae56c3c
10 changed files with 329 additions and 78 deletions

View File

@@ -125,8 +125,9 @@ class AppRouter {
/// Product Detail Route
/// Path: /product-detail
/// Takes warehouseId, productId, and warehouseName as extra parameter
/// Takes warehouseId, productId, warehouseName, and optional stageId as extra parameter
/// Shows detailed information for a specific product
/// If stageId is provided, only that stage is shown, otherwise all stages are shown
GoRoute(
path: '/product-detail',
name: 'product-detail',
@@ -147,6 +148,8 @@ class AppRouter {
final warehouseId = params['warehouseId'] as int?;
final productId = params['productId'] as int?;
final warehouseName = params['warehouseName'] as String?;
// Extract optional stageId
final stageId = params['stageId'] as int?;
// Validate parameters
if (warehouseId == null || productId == null || warehouseName == null) {
@@ -162,6 +165,7 @@ class AppRouter {
warehouseId: warehouseId,
productId: productId,
warehouseName: warehouseName,
stageId: stageId,
);
},
),
@@ -375,10 +379,12 @@ extension AppRouterExtension on BuildContext {
/// [warehouseId] - ID of the warehouse
/// [productId] - ID of the product to view
/// [warehouseName] - Name of the warehouse (for display)
/// [stageId] - Optional ID of specific stage to show (if null, show all stages)
void goToProductDetail({
required int warehouseId,
required int productId,
required String warehouseName,
int? stageId,
}) {
push(
'/product-detail',
@@ -386,6 +392,7 @@ extension AppRouterExtension on BuildContext {
'warehouseId': warehouseId,
'productId': productId,
'warehouseName': warehouseName,
if (stageId != null) 'stageId': stageId,
},
);
}