87 lines
2.3 KiB
Dart
87 lines
2.3 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
class DiscountState extends Equatable {
|
|
final List<String> productImages;
|
|
final String productName;
|
|
final String? discountType;
|
|
final String description;
|
|
final DateTime? startDate;
|
|
final DateTime? endDate;
|
|
final String? startTime;
|
|
final String? endTime;
|
|
final String price;
|
|
final String discountedPrice;
|
|
final double notificationRadius;
|
|
final bool isSubmitting;
|
|
final bool isSuccess;
|
|
final String? errorMessage;
|
|
|
|
const DiscountState({
|
|
this.productImages = const [],
|
|
this.productName = '',
|
|
this.discountType,
|
|
this.description = '',
|
|
this.startDate,
|
|
this.endDate,
|
|
this.startTime,
|
|
this.endTime,
|
|
this.price = '',
|
|
this.discountedPrice = '',
|
|
this.notificationRadius = 0.0,
|
|
this.isSubmitting = false,
|
|
this.isSuccess = false,
|
|
this.errorMessage,
|
|
});
|
|
|
|
DiscountState copyWith({
|
|
List<String>? productImages,
|
|
String? productName,
|
|
String? discountType,
|
|
String? description,
|
|
DateTime? startDate,
|
|
DateTime? endDate,
|
|
String? startTime,
|
|
String? endTime,
|
|
String? price,
|
|
String? discountedPrice,
|
|
double? notificationRadius,
|
|
bool? isSubmitting,
|
|
bool? isSuccess,
|
|
String? errorMessage,
|
|
}) {
|
|
return DiscountState(
|
|
productImages: productImages ?? this.productImages,
|
|
productName: productName ?? this.productName,
|
|
discountType: discountType ?? this.discountType,
|
|
description: description ?? this.description,
|
|
startDate: startDate ?? this.startDate,
|
|
endDate: endDate ?? this.endDate,
|
|
startTime: startTime ?? this.startTime,
|
|
endTime: endTime ?? this.endTime,
|
|
price: price ?? this.price,
|
|
discountedPrice: discountedPrice ?? this.discountedPrice,
|
|
notificationRadius: notificationRadius ?? this.notificationRadius,
|
|
isSubmitting: isSubmitting ?? this.isSubmitting,
|
|
isSuccess: isSuccess ?? this.isSuccess,
|
|
errorMessage: errorMessage ?? this.errorMessage,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
productImages,
|
|
productName,
|
|
discountType,
|
|
description,
|
|
startDate,
|
|
endDate,
|
|
startTime,
|
|
endTime,
|
|
price,
|
|
discountedPrice,
|
|
notificationRadius,
|
|
isSubmitting,
|
|
isSuccess,
|
|
errorMessage,
|
|
];
|
|
} |