update cart/favorite

This commit is contained in:
Phuoc Nguyen
2025-12-03 15:53:46 +07:00
parent e1c9f818d2
commit 27798cc234
19 changed files with 370 additions and 119 deletions

View File

@@ -6,7 +6,7 @@ library;
/// Cart Item Entity
///
/// Contains item-level information:
/// - Product reference
/// - Product reference and basic info
/// - Quantity
/// - Pricing
class CartItem {
@@ -31,6 +31,15 @@ class CartItem {
/// Timestamp when item was added
final DateTime addedAt;
/// Product name from cart API
final String? itemName;
/// Product image URL from cart API
final String? image;
/// Conversion factor (m² to tiles) from cart API
final double? conversionOfSm;
const CartItem({
required this.cartItemId,
required this.cartId,
@@ -39,6 +48,9 @@ class CartItem {
required this.unitPrice,
required this.subtotal,
required this.addedAt,
this.itemName,
this.image,
this.conversionOfSm,
});
/// Calculate subtotal (for verification)
@@ -53,6 +65,9 @@ class CartItem {
double? unitPrice,
double? subtotal,
DateTime? addedAt,
String? itemName,
String? image,
double? conversionOfSm,
}) {
return CartItem(
cartItemId: cartItemId ?? this.cartItemId,
@@ -62,6 +77,9 @@ class CartItem {
unitPrice: unitPrice ?? this.unitPrice,
subtotal: subtotal ?? this.subtotal,
addedAt: addedAt ?? this.addedAt,
itemName: itemName ?? this.itemName,
image: image ?? this.image,
conversionOfSm: conversionOfSm ?? this.conversionOfSm,
);
}