proxibuy_bussiness/lib/presentation/discount/bloc/discount_state.dart

100 lines
2.8 KiB
Dart

// lib/presentation/discount/bloc/discount_state.dart
import 'package:equatable/equatable.dart';
class DiscountState extends Equatable {
final String? discountId;
// *** CHANGE IS HERE: Storing image ID and URL together ***
final List<Map<String, String?>> productImages;
final String productName;
final String? discountTypeId;
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 isLoadingDetails;
final bool isSuccess;
final String? errorMessage;
const DiscountState({
this.discountId,
this.productImages = const [],
this.productName = '',
this.discountTypeId,
this.description = '',
this.startDate,
this.endDate,
this.startTime,
this.endTime,
this.price = '',
this.discountedPrice = '',
this.notificationRadius = 0.0,
this.isSubmitting = false,
this.isLoadingDetails = false,
this.isSuccess = false,
this.errorMessage,
});
DiscountState copyWith({
String? discountId,
List<Map<String, String?>>? productImages,
String? productName,
String? discountTypeId,
String? description,
DateTime? startDate,
DateTime? endDate,
String? startTime,
String? endTime,
String? price,
String? discountedPrice,
double? notificationRadius,
bool? isSubmitting,
bool? isLoadingDetails,
bool? isSuccess,
String? errorMessage,
}) {
return DiscountState(
discountId: discountId ?? this.discountId,
productImages: productImages ?? this.productImages,
productName: productName ?? this.productName,
discountTypeId: discountTypeId ?? this.discountTypeId,
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,
isLoadingDetails: isLoadingDetails ?? this.isLoadingDetails,
isSuccess: isSuccess ?? this.isSuccess,
errorMessage: errorMessage ?? this.errorMessage,
);
}
@override
List<Object?> get props => [
discountId,
productImages,
productName,
discountTypeId,
description,
startDate,
endDate,
startTime,
endTime,
price,
discountedPrice,
notificationRadius,
isSubmitting,
isLoadingDetails,
isSuccess,
errorMessage,
];
}