This commit is contained in:
Phuoc Nguyen
2025-10-10 16:38:07 +07:00
parent e5b247d622
commit b94c158004
177 changed files with 25080 additions and 152 deletions

View File

@@ -0,0 +1,50 @@
import 'package:equatable/equatable.dart';
/// Cart item domain entity
class CartItem extends Equatable {
final String productId;
final String productName;
final double price;
final int quantity;
final String? imageUrl;
final DateTime addedAt;
const CartItem({
required this.productId,
required this.productName,
required this.price,
required this.quantity,
this.imageUrl,
required this.addedAt,
});
double get total => price * quantity;
CartItem copyWith({
String? productId,
String? productName,
double? price,
int? quantity,
String? imageUrl,
DateTime? addedAt,
}) {
return CartItem(
productId: productId ?? this.productId,
productName: productName ?? this.productName,
price: price ?? this.price,
quantity: quantity ?? this.quantity,
imageUrl: imageUrl ?? this.imageUrl,
addedAt: addedAt ?? this.addedAt,
);
}
@override
List<Object?> get props => [
productId,
productName,
price,
quantity,
imageUrl,
addedAt,
];
}