This commit is contained in:
Phuoc Nguyen
2025-10-24 16:20:48 +07:00
parent eaaa9921f5
commit b27c5d7742
17 changed files with 3245 additions and 5 deletions

View File

@@ -48,6 +48,9 @@ class HiveBoxNames {
/// Address book
static const String addressBox = 'address_box';
/// Favorite products
static const String favoriteBox = 'favorite_box';
/// Offline request queue for failed API calls
static const String offlineQueueBox = 'offline_queue_box';
@@ -65,6 +68,7 @@ class HiveBoxNames {
syncStateBox,
notificationBox,
addressBox,
favoriteBox,
offlineQueueBox,
];
}
@@ -115,6 +119,7 @@ class HiveTypeIds {
static const int memberCardModel = 25;
static const int promotionModel = 26;
static const int categoryModel = 27;
static const int favoriteModel = 28;
// Enums (30-59)
static const int userRole = 30;

View File

@@ -143,6 +143,9 @@ class HiveService {
// Notification box (non-sensitive)
Hive.openBox<dynamic>(HiveBoxNames.notificationBox),
// Favorites box (non-sensitive)
Hive.openBox<dynamic>(HiveBoxNames.favoriteBox),
]);
// Open potentially encrypted boxes (sensitive data)

View File

@@ -7,6 +7,7 @@ library;
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:worker/features/cart/presentation/pages/cart_page.dart';
import 'package:worker/features/favorites/presentation/pages/favorites_page.dart';
import 'package:worker/features/main/presentation/pages/main_scaffold.dart';
import 'package:worker/features/products/presentation/pages/product_detail_page.dart';
import 'package:worker/features/products/presentation/pages/products_page.dart';
@@ -84,6 +85,16 @@ class AppRouter {
),
),
// Favorites Route
GoRoute(
path: RouteNames.favorites,
name: RouteNames.favorites,
pageBuilder: (context, state) => MaterialPage(
key: state.pageKey,
child: const FavoritesPage(),
),
),
// TODO: Add more routes as features are implemented
],
@@ -165,6 +176,7 @@ class RouteNames {
static const String products = '/products';
static const String productDetail = '/products/:id';
static const String cart = '/cart';
static const String favorites = '/favorites';
static const String checkout = '/checkout';
static const String orderSuccess = '/order-success';
@@ -223,6 +235,9 @@ extension GoRouterExtension on BuildContext {
/// Navigate to cart page
void goCart() => go(RouteNames.cart);
/// Navigate to favorites page
void goFavorites() => go(RouteNames.favorites);
/// Navigate to loyalty page
void goLoyalty() => go(RouteNames.loyalty);