feat: product variant
This commit is contained in:
parent
04e1edbe79
commit
835c834ce1
@ -187,6 +187,7 @@ class OrderItem {
|
||||
final String? productId;
|
||||
final String? productName;
|
||||
final String? productVariantId;
|
||||
final String? productVariantName;
|
||||
final int? quantity;
|
||||
final int? unitPrice;
|
||||
final int? totalPrice;
|
||||
@ -202,6 +203,7 @@ class OrderItem {
|
||||
this.productId,
|
||||
this.productName,
|
||||
this.productVariantId,
|
||||
this.productVariantName,
|
||||
this.quantity,
|
||||
this.unitPrice,
|
||||
this.totalPrice,
|
||||
@ -218,6 +220,7 @@ class OrderItem {
|
||||
productId: json["product_id"],
|
||||
productName: json["product_name"],
|
||||
productVariantId: json["product_variant_id"],
|
||||
productVariantName: json["product_variant_name"],
|
||||
quantity: json["quantity"],
|
||||
unitPrice: json["unit_price"],
|
||||
totalPrice: json["total_price"],
|
||||
@ -238,6 +241,7 @@ class OrderItem {
|
||||
"product_id": productId,
|
||||
"product_name": productName,
|
||||
"product_variant_id": productVariantId,
|
||||
"product_variant_name": productVariantName,
|
||||
"quantity": quantity,
|
||||
"unit_price": unitPrice,
|
||||
"total_price": totalPrice,
|
||||
|
||||
@ -25,15 +25,29 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
|
||||
on<_AddItem>((event, emit) {
|
||||
var currentState = state as _Loaded;
|
||||
List<ProductQuantity> items = [...currentState.items];
|
||||
var index =
|
||||
items.indexWhere((element) => element.product.id == event.product.id);
|
||||
var index = items.indexWhere(
|
||||
(element) =>
|
||||
element.product.id == event.product.id &&
|
||||
element.variant?.id == event.variant?.id,
|
||||
);
|
||||
emit(const _Loading());
|
||||
if (index != -1) {
|
||||
items[index] = ProductQuantity(
|
||||
product: event.product, quantity: items[index].quantity + 1);
|
||||
product: event.product,
|
||||
quantity: items[index].quantity + 1,
|
||||
variant: event.variant,
|
||||
);
|
||||
} else {
|
||||
items.add(ProductQuantity(product: event.product, quantity: 1));
|
||||
items.add(
|
||||
ProductQuantity(
|
||||
product: event.product,
|
||||
quantity: 1,
|
||||
variant: event.variant,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
log("Items: $items");
|
||||
emit(_Loaded(
|
||||
items,
|
||||
currentState.discountModel,
|
||||
@ -50,13 +64,19 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
|
||||
on<_RemoveItem>((event, emit) {
|
||||
var currentState = state as _Loaded;
|
||||
List<ProductQuantity> items = [...currentState.items];
|
||||
var index =
|
||||
items.indexWhere((element) => element.product.id == event.product.id);
|
||||
var index = items.indexWhere(
|
||||
(element) =>
|
||||
element.product.id == event.product.id &&
|
||||
element.variant?.id == event.variant?.id,
|
||||
);
|
||||
emit(const _Loading());
|
||||
if (index != -1) {
|
||||
if (items[index].quantity > 1) {
|
||||
items[index] = ProductQuantity(
|
||||
product: event.product, quantity: items[index].quantity - 1);
|
||||
product: event.product,
|
||||
quantity: items[index].quantity - 1,
|
||||
variant: event.variant);
|
||||
;
|
||||
} else {
|
||||
items.removeAt(index);
|
||||
}
|
||||
@ -77,8 +97,11 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
|
||||
on<_DeleteItem>((event, emit) {
|
||||
var currentState = state as _Loaded;
|
||||
List<ProductQuantity> items = [...currentState.items];
|
||||
var index =
|
||||
items.indexWhere((element) => element.product.id == event.product.id);
|
||||
var index = items.indexWhere(
|
||||
(element) =>
|
||||
element.product.id == event.product.id &&
|
||||
element.variant?.id == event.variant?.id,
|
||||
);
|
||||
emit(const _Loading());
|
||||
|
||||
items.removeAt(index);
|
||||
|
||||
@ -19,9 +19,11 @@ mixin _$CheckoutEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -39,9 +41,9 @@ mixin _$CheckoutEvent {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -58,9 +60,9 @@ mixin _$CheckoutEvent {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -195,9 +197,11 @@ class _$StartedImpl implements _Started {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -218,9 +222,9 @@ class _$StartedImpl implements _Started {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -240,9 +244,9 @@ class _$StartedImpl implements _Started {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -340,7 +344,7 @@ abstract class _$$AddItemImplCopyWith<$Res> {
|
||||
_$AddItemImpl value, $Res Function(_$AddItemImpl) then) =
|
||||
__$$AddItemImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Product product});
|
||||
$Res call({Product product, ProductVariant? variant});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -357,12 +361,17 @@ class __$$AddItemImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? product = null,
|
||||
Object? variant = freezed,
|
||||
}) {
|
||||
return _then(_$AddItemImpl(
|
||||
null == product
|
||||
? _value.product
|
||||
: product // ignore: cast_nullable_to_non_nullable
|
||||
as Product,
|
||||
freezed == variant
|
||||
? _value.variant
|
||||
: variant // ignore: cast_nullable_to_non_nullable
|
||||
as ProductVariant?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -370,14 +379,16 @@ class __$$AddItemImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$AddItemImpl implements _AddItem {
|
||||
const _$AddItemImpl(this.product);
|
||||
const _$AddItemImpl(this.product, this.variant);
|
||||
|
||||
@override
|
||||
final Product product;
|
||||
@override
|
||||
final ProductVariant? variant;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutEvent.addItem(product: $product)';
|
||||
return 'CheckoutEvent.addItem(product: $product, variant: $variant)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -385,11 +396,12 @@ class _$AddItemImpl implements _AddItem {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AddItemImpl &&
|
||||
(identical(other.product, product) || other.product == product));
|
||||
(identical(other.product, product) || other.product == product) &&
|
||||
(identical(other.variant, variant) || other.variant == variant));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, product);
|
||||
int get hashCode => Object.hash(runtimeType, product, variant);
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -403,9 +415,11 @@ class _$AddItemImpl implements _AddItem {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -419,16 +433,16 @@ class _$AddItemImpl implements _AddItem {
|
||||
saveDraftOrder,
|
||||
required TResult Function(DraftOrderModel data) loadDraftOrder,
|
||||
}) {
|
||||
return addItem(product);
|
||||
return addItem(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -441,16 +455,16 @@ class _$AddItemImpl implements _AddItem {
|
||||
saveDraftOrder,
|
||||
TResult? Function(DraftOrderModel data)? loadDraftOrder,
|
||||
}) {
|
||||
return addItem?.call(product);
|
||||
return addItem?.call(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -465,7 +479,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
return addItem(product);
|
||||
return addItem(product, variant);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@ -539,9 +553,11 @@ class _$AddItemImpl implements _AddItem {
|
||||
}
|
||||
|
||||
abstract class _AddItem implements CheckoutEvent {
|
||||
const factory _AddItem(final Product product) = _$AddItemImpl;
|
||||
const factory _AddItem(final Product product, final ProductVariant? variant) =
|
||||
_$AddItemImpl;
|
||||
|
||||
Product get product;
|
||||
ProductVariant? get variant;
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -556,7 +572,7 @@ abstract class _$$RemoveItemImplCopyWith<$Res> {
|
||||
_$RemoveItemImpl value, $Res Function(_$RemoveItemImpl) then) =
|
||||
__$$RemoveItemImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Product product});
|
||||
$Res call({Product product, ProductVariant? variant});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -573,12 +589,17 @@ class __$$RemoveItemImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? product = null,
|
||||
Object? variant = freezed,
|
||||
}) {
|
||||
return _then(_$RemoveItemImpl(
|
||||
null == product
|
||||
? _value.product
|
||||
: product // ignore: cast_nullable_to_non_nullable
|
||||
as Product,
|
||||
freezed == variant
|
||||
? _value.variant
|
||||
: variant // ignore: cast_nullable_to_non_nullable
|
||||
as ProductVariant?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -586,14 +607,16 @@ class __$$RemoveItemImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$RemoveItemImpl implements _RemoveItem {
|
||||
const _$RemoveItemImpl(this.product);
|
||||
const _$RemoveItemImpl(this.product, this.variant);
|
||||
|
||||
@override
|
||||
final Product product;
|
||||
@override
|
||||
final ProductVariant? variant;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutEvent.removeItem(product: $product)';
|
||||
return 'CheckoutEvent.removeItem(product: $product, variant: $variant)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -601,11 +624,12 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RemoveItemImpl &&
|
||||
(identical(other.product, product) || other.product == product));
|
||||
(identical(other.product, product) || other.product == product) &&
|
||||
(identical(other.variant, variant) || other.variant == variant));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, product);
|
||||
int get hashCode => Object.hash(runtimeType, product, variant);
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -619,9 +643,11 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -635,16 +661,16 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
saveDraftOrder,
|
||||
required TResult Function(DraftOrderModel data) loadDraftOrder,
|
||||
}) {
|
||||
return removeItem(product);
|
||||
return removeItem(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -657,16 +683,16 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
saveDraftOrder,
|
||||
TResult? Function(DraftOrderModel data)? loadDraftOrder,
|
||||
}) {
|
||||
return removeItem?.call(product);
|
||||
return removeItem?.call(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -681,7 +707,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
return removeItem(product);
|
||||
return removeItem(product, variant);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@ -755,9 +781,11 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
}
|
||||
|
||||
abstract class _RemoveItem implements CheckoutEvent {
|
||||
const factory _RemoveItem(final Product product) = _$RemoveItemImpl;
|
||||
const factory _RemoveItem(
|
||||
final Product product, final ProductVariant? variant) = _$RemoveItemImpl;
|
||||
|
||||
Product get product;
|
||||
ProductVariant? get variant;
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -772,7 +800,7 @@ abstract class _$$DeleteItemImplCopyWith<$Res> {
|
||||
_$DeleteItemImpl value, $Res Function(_$DeleteItemImpl) then) =
|
||||
__$$DeleteItemImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Product product});
|
||||
$Res call({Product product, ProductVariant? variant});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -789,12 +817,17 @@ class __$$DeleteItemImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? product = null,
|
||||
Object? variant = freezed,
|
||||
}) {
|
||||
return _then(_$DeleteItemImpl(
|
||||
null == product
|
||||
? _value.product
|
||||
: product // ignore: cast_nullable_to_non_nullable
|
||||
as Product,
|
||||
freezed == variant
|
||||
? _value.variant
|
||||
: variant // ignore: cast_nullable_to_non_nullable
|
||||
as ProductVariant?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -802,14 +835,16 @@ class __$$DeleteItemImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$DeleteItemImpl implements _DeleteItem {
|
||||
const _$DeleteItemImpl(this.product);
|
||||
const _$DeleteItemImpl(this.product, this.variant);
|
||||
|
||||
@override
|
||||
final Product product;
|
||||
@override
|
||||
final ProductVariant? variant;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutEvent.deleteItem(product: $product)';
|
||||
return 'CheckoutEvent.deleteItem(product: $product, variant: $variant)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -817,11 +852,12 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DeleteItemImpl &&
|
||||
(identical(other.product, product) || other.product == product));
|
||||
(identical(other.product, product) || other.product == product) &&
|
||||
(identical(other.variant, variant) || other.variant == variant));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, product);
|
||||
int get hashCode => Object.hash(runtimeType, product, variant);
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -835,9 +871,11 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -851,16 +889,16 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
saveDraftOrder,
|
||||
required TResult Function(DraftOrderModel data) loadDraftOrder,
|
||||
}) {
|
||||
return deleteItem(product);
|
||||
return deleteItem(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -873,16 +911,16 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
saveDraftOrder,
|
||||
TResult? Function(DraftOrderModel data)? loadDraftOrder,
|
||||
}) {
|
||||
return deleteItem?.call(product);
|
||||
return deleteItem?.call(product, variant);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -897,7 +935,7 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (deleteItem != null) {
|
||||
return deleteItem(product);
|
||||
return deleteItem(product, variant);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@ -971,9 +1009,11 @@ class _$DeleteItemImpl implements _DeleteItem {
|
||||
}
|
||||
|
||||
abstract class _DeleteItem implements CheckoutEvent {
|
||||
const factory _DeleteItem(final Product product) = _$DeleteItemImpl;
|
||||
const factory _DeleteItem(
|
||||
final Product product, final ProductVariant? variant) = _$DeleteItemImpl;
|
||||
|
||||
Product get product;
|
||||
ProductVariant? get variant;
|
||||
|
||||
/// Create a copy of CheckoutEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -1052,9 +1092,11 @@ class _$AddDiscountImpl implements _AddDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -1075,9 +1117,9 @@ class _$AddDiscountImpl implements _AddDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -1097,9 +1139,9 @@ class _$AddDiscountImpl implements _AddDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -1241,9 +1283,11 @@ class _$RemoveDiscountImpl implements _RemoveDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -1264,9 +1308,9 @@ class _$RemoveDiscountImpl implements _RemoveDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -1286,9 +1330,9 @@ class _$RemoveDiscountImpl implements _RemoveDiscount {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -1449,9 +1493,11 @@ class _$AddTaxImpl implements _AddTax {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -1472,9 +1518,9 @@ class _$AddTaxImpl implements _AddTax {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -1494,9 +1540,9 @@ class _$AddTaxImpl implements _AddTax {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -1667,9 +1713,11 @@ class _$AddServiceChargeImpl implements _AddServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -1690,9 +1738,9 @@ class _$AddServiceChargeImpl implements _AddServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -1712,9 +1760,9 @@ class _$AddServiceChargeImpl implements _AddServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -1857,9 +1905,11 @@ class _$RemoveTaxImpl implements _RemoveTax {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -1880,9 +1930,9 @@ class _$RemoveTaxImpl implements _RemoveTax {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -1902,9 +1952,9 @@ class _$RemoveTaxImpl implements _RemoveTax {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -2039,9 +2089,11 @@ class _$RemoveServiceChargeImpl implements _RemoveServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -2062,9 +2114,9 @@ class _$RemoveServiceChargeImpl implements _RemoveServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -2084,9 +2136,9 @@ class _$RemoveServiceChargeImpl implements _RemoveServiceCharge {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -2249,9 +2301,11 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -2272,9 +2326,9 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -2294,9 +2348,9 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -2475,9 +2529,11 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -2498,9 +2554,9 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -2520,9 +2576,9 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -2715,9 +2771,11 @@ class _$SaveDraftOrderImpl implements _SaveDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -2738,9 +2796,9 @@ class _$SaveDraftOrderImpl implements _SaveDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -2760,9 +2818,9 @@ class _$SaveDraftOrderImpl implements _SaveDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
@ -2935,9 +2993,11 @@ class _$LoadDraftOrderImpl implements _LoadDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(Product product) addItem,
|
||||
required TResult Function(Product product) removeItem,
|
||||
required TResult Function(Product product) deleteItem,
|
||||
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
removeItem,
|
||||
required TResult Function(Product product, ProductVariant? variant)
|
||||
deleteItem,
|
||||
required TResult Function(Discount discount) addDiscount,
|
||||
required TResult Function() removeDiscount,
|
||||
required TResult Function(int tax) addTax,
|
||||
@ -2958,9 +3018,9 @@ class _$LoadDraftOrderImpl implements _LoadDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(Product product)? addItem,
|
||||
TResult? Function(Product product)? removeItem,
|
||||
TResult? Function(Product product)? deleteItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult? Function(Discount discount)? addDiscount,
|
||||
TResult? Function()? removeDiscount,
|
||||
TResult? Function(int tax)? addTax,
|
||||
@ -2980,9 +3040,9 @@ class _$LoadDraftOrderImpl implements _LoadDraftOrder {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(Product product)? addItem,
|
||||
TResult Function(Product product)? removeItem,
|
||||
TResult Function(Product product)? deleteItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, ProductVariant? variant)? deleteItem,
|
||||
TResult Function(Discount discount)? addDiscount,
|
||||
TResult Function()? removeDiscount,
|
||||
TResult Function(int tax)? addTax,
|
||||
|
||||
@ -4,11 +4,14 @@ part of 'checkout_bloc.dart';
|
||||
class CheckoutEvent with _$CheckoutEvent {
|
||||
const factory CheckoutEvent.started() = _Started;
|
||||
//add item
|
||||
const factory CheckoutEvent.addItem(Product product) = _AddItem;
|
||||
const factory CheckoutEvent.addItem(
|
||||
Product product, ProductVariant? variant) = _AddItem;
|
||||
//remove item
|
||||
const factory CheckoutEvent.removeItem(Product product) = _RemoveItem;
|
||||
const factory CheckoutEvent.removeItem(
|
||||
Product product, ProductVariant? variant) = _RemoveItem;
|
||||
// Delete Item
|
||||
const factory CheckoutEvent.deleteItem(Product product) = _DeleteItem;
|
||||
const factory CheckoutEvent.deleteItem(
|
||||
Product product, ProductVariant? variant) = _DeleteItem;
|
||||
|
||||
//add discount
|
||||
const factory CheckoutEvent.addDiscount(Discount discount) = _AddDiscount;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:developer';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/customer_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||
@ -37,7 +38,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
tableId: event.table.id,
|
||||
tableNumber: event.table.tableName,
|
||||
outletId: userData.user?.outletId,
|
||||
userId: userData.user?.id,
|
||||
customerId: event.customer?.id ?? '',
|
||||
orderItems: event.items
|
||||
.map(
|
||||
(productQuantity) => OrderItemRequest(
|
||||
@ -45,6 +46,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
quantity: productQuantity.quantity,
|
||||
notes: productQuantity.notes,
|
||||
unitPrice: productQuantity.product.price,
|
||||
productVariantId: productQuantity.variant?.id,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
@ -78,7 +80,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
tableId: event.table.id,
|
||||
tableNumber: event.table.tableName,
|
||||
outletId: userData.user?.outletId,
|
||||
userId: userData.user?.id,
|
||||
customerId: event.customer?.id ?? '',
|
||||
orderItems: event.items
|
||||
.map(
|
||||
(productQuantity) => OrderItemRequest(
|
||||
@ -86,6 +88,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
quantity: productQuantity.quantity,
|
||||
notes: productQuantity.notes,
|
||||
unitPrice: productQuantity.product.price,
|
||||
productVariantId: productQuantity.variant?.id,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
@ -114,11 +117,15 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
final result = await _orderRemoteDatasource.addToOrder(
|
||||
orderId: event.orderId,
|
||||
orderItems: event.items
|
||||
.map((item) => OrderItemRequest(
|
||||
.map(
|
||||
(item) => OrderItemRequest(
|
||||
productId: item.product.id,
|
||||
quantity: item.quantity,
|
||||
unitPrice: item.product.price,
|
||||
notes: item.notes))
|
||||
notes: item.notes,
|
||||
productVariantId: item.variant?.id,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
|
||||
@ -20,10 +20,15 @@ mixin _$OrderFormEvent {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -41,10 +46,15 @@ mixin _$OrderFormEvent {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -59,10 +69,15 @@ mixin _$OrderFormEvent {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -204,10 +219,15 @@ class _$StartedImpl implements _Started {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -228,10 +248,15 @@ class _$StartedImpl implements _Started {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -249,10 +274,15 @@ class _$StartedImpl implements _Started {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -340,6 +370,7 @@ abstract class _$$CreateImplCopyWith<$Res> {
|
||||
$Res call(
|
||||
{List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table});
|
||||
}
|
||||
@ -359,6 +390,7 @@ class __$$CreateImplCopyWithImpl<$Res>
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
Object? customerName = null,
|
||||
Object? customer = freezed,
|
||||
Object? orderType = null,
|
||||
Object? table = null,
|
||||
}) {
|
||||
@ -371,6 +403,10 @@ class __$$CreateImplCopyWithImpl<$Res>
|
||||
? _value.customerName
|
||||
: customerName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
customer: freezed == customer
|
||||
? _value.customer
|
||||
: customer // ignore: cast_nullable_to_non_nullable
|
||||
as Customer?,
|
||||
orderType: null == orderType
|
||||
? _value.orderType
|
||||
: orderType // ignore: cast_nullable_to_non_nullable
|
||||
@ -389,6 +425,7 @@ class _$CreateImpl implements _Create {
|
||||
const _$CreateImpl(
|
||||
{required final List<ProductQuantity> items,
|
||||
required this.customerName,
|
||||
required this.customer,
|
||||
required this.orderType,
|
||||
required this.table})
|
||||
: _items = items;
|
||||
@ -404,13 +441,15 @@ class _$CreateImpl implements _Create {
|
||||
@override
|
||||
final String customerName;
|
||||
@override
|
||||
final Customer? customer;
|
||||
@override
|
||||
final OrderType orderType;
|
||||
@override
|
||||
final TableModel table;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OrderFormEvent.create(items: $items, customerName: $customerName, orderType: $orderType, table: $table)';
|
||||
return 'OrderFormEvent.create(items: $items, customerName: $customerName, customer: $customer, orderType: $orderType, table: $table)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -421,6 +460,8 @@ class _$CreateImpl implements _Create {
|
||||
const DeepCollectionEquality().equals(other._items, _items) &&
|
||||
(identical(other.customerName, customerName) ||
|
||||
other.customerName == customerName) &&
|
||||
(identical(other.customer, customer) ||
|
||||
other.customer == customer) &&
|
||||
(identical(other.orderType, orderType) ||
|
||||
other.orderType == orderType) &&
|
||||
(identical(other.table, table) || other.table == table));
|
||||
@ -431,6 +472,7 @@ class _$CreateImpl implements _Create {
|
||||
runtimeType,
|
||||
const DeepCollectionEquality().hash(_items),
|
||||
customerName,
|
||||
customer,
|
||||
orderType,
|
||||
table);
|
||||
|
||||
@ -447,10 +489,15 @@ class _$CreateImpl implements _Create {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -463,7 +510,7 @@ class _$CreateImpl implements _Create {
|
||||
required TResult Function(OrderItem item) toggleItem,
|
||||
required TResult Function(bool selectAll) toggleSelectAll,
|
||||
}) {
|
||||
return create(items, customerName, orderType, table);
|
||||
return create(items, customerName, customer, orderType, table);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -471,10 +518,15 @@ class _$CreateImpl implements _Create {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -484,7 +536,7 @@ class _$CreateImpl implements _Create {
|
||||
TResult? Function(OrderItem item)? toggleItem,
|
||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||
}) {
|
||||
return create?.call(items, customerName, orderType, table);
|
||||
return create?.call(items, customerName, customer, orderType, table);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -492,10 +544,15 @@ class _$CreateImpl implements _Create {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -507,7 +564,7 @@ class _$CreateImpl implements _Create {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (create != null) {
|
||||
return create(items, customerName, orderType, table);
|
||||
return create(items, customerName, customer, orderType, table);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@ -566,11 +623,13 @@ abstract class _Create implements OrderFormEvent {
|
||||
const factory _Create(
|
||||
{required final List<ProductQuantity> items,
|
||||
required final String customerName,
|
||||
required final Customer? customer,
|
||||
required final OrderType orderType,
|
||||
required final TableModel table}) = _$CreateImpl;
|
||||
|
||||
List<ProductQuantity> get items;
|
||||
String get customerName;
|
||||
Customer? get customer;
|
||||
OrderType get orderType;
|
||||
TableModel get table;
|
||||
|
||||
@ -591,6 +650,7 @@ abstract class _$$CreateWithPaymentMethodImplCopyWith<$Res> {
|
||||
$Res call(
|
||||
{List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod});
|
||||
@ -612,6 +672,7 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
Object? customerName = null,
|
||||
Object? customer = freezed,
|
||||
Object? orderType = null,
|
||||
Object? table = null,
|
||||
Object? paymentMethod = null,
|
||||
@ -625,6 +686,10 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
||||
? _value.customerName
|
||||
: customerName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
customer: freezed == customer
|
||||
? _value.customer
|
||||
: customer // ignore: cast_nullable_to_non_nullable
|
||||
as Customer?,
|
||||
orderType: null == orderType
|
||||
? _value.orderType
|
||||
: orderType // ignore: cast_nullable_to_non_nullable
|
||||
@ -647,6 +712,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
const _$CreateWithPaymentMethodImpl(
|
||||
{required final List<ProductQuantity> items,
|
||||
required this.customerName,
|
||||
required this.customer,
|
||||
required this.orderType,
|
||||
required this.table,
|
||||
required this.paymentMethod})
|
||||
@ -663,6 +729,8 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
@override
|
||||
final String customerName;
|
||||
@override
|
||||
final Customer? customer;
|
||||
@override
|
||||
final OrderType orderType;
|
||||
@override
|
||||
final TableModel table;
|
||||
@ -671,7 +739,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, orderType: $orderType, table: $table, paymentMethod: $paymentMethod)';
|
||||
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, customer: $customer, orderType: $orderType, table: $table, paymentMethod: $paymentMethod)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -682,6 +750,8 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
const DeepCollectionEquality().equals(other._items, _items) &&
|
||||
(identical(other.customerName, customerName) ||
|
||||
other.customerName == customerName) &&
|
||||
(identical(other.customer, customer) ||
|
||||
other.customer == customer) &&
|
||||
(identical(other.orderType, orderType) ||
|
||||
other.orderType == orderType) &&
|
||||
(identical(other.table, table) || other.table == table) &&
|
||||
@ -694,6 +764,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
runtimeType,
|
||||
const DeepCollectionEquality().hash(_items),
|
||||
customerName,
|
||||
customer,
|
||||
orderType,
|
||||
table,
|
||||
paymentMethod);
|
||||
@ -712,10 +783,15 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -729,7 +805,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
required TResult Function(bool selectAll) toggleSelectAll,
|
||||
}) {
|
||||
return createWithPayment(
|
||||
items, customerName, orderType, table, paymentMethod);
|
||||
items, customerName, customer, orderType, table, paymentMethod);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -737,10 +813,15 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -751,7 +832,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||
}) {
|
||||
return createWithPayment?.call(
|
||||
items, customerName, orderType, table, paymentMethod);
|
||||
items, customerName, customer, orderType, table, paymentMethod);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -759,10 +840,15 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -775,7 +861,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
||||
}) {
|
||||
if (createWithPayment != null) {
|
||||
return createWithPayment(
|
||||
items, customerName, orderType, table, paymentMethod);
|
||||
items, customerName, customer, orderType, table, paymentMethod);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@ -834,6 +920,7 @@ abstract class _CreateWithPaymentMethod implements OrderFormEvent {
|
||||
const factory _CreateWithPaymentMethod(
|
||||
{required final List<ProductQuantity> items,
|
||||
required final String customerName,
|
||||
required final Customer? customer,
|
||||
required final OrderType orderType,
|
||||
required final TableModel table,
|
||||
required final PaymentMethod paymentMethod}) =
|
||||
@ -841,6 +928,7 @@ abstract class _CreateWithPaymentMethod implements OrderFormEvent {
|
||||
|
||||
List<ProductQuantity> get items;
|
||||
String get customerName;
|
||||
Customer? get customer;
|
||||
OrderType get orderType;
|
||||
TableModel get table;
|
||||
PaymentMethod get paymentMethod;
|
||||
@ -939,10 +1027,15 @@ class _$AddToOrderImpl implements _AddToOrder {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -963,10 +1056,15 @@ class _$AddToOrderImpl implements _AddToOrder {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -984,10 +1082,15 @@ class _$AddToOrderImpl implements _AddToOrder {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1166,10 +1269,15 @@ class _$RefundImpl implements _Refund {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -1190,10 +1298,15 @@ class _$RefundImpl implements _Refund {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1211,10 +1324,15 @@ class _$RefundImpl implements _Refund {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1395,10 +1513,15 @@ class _$VoidOrderImpl implements _VoidOrder {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -1419,10 +1542,15 @@ class _$VoidOrderImpl implements _VoidOrder {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1440,10 +1568,15 @@ class _$VoidOrderImpl implements _VoidOrder {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1597,10 +1730,15 @@ class _$ToggleItemImpl implements _ToggleItem {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -1621,10 +1759,15 @@ class _$ToggleItemImpl implements _ToggleItem {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1642,10 +1785,15 @@ class _$ToggleItemImpl implements _ToggleItem {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1796,10 +1944,15 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) started,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)
|
||||
Customer? customer, OrderType orderType, TableModel table)
|
||||
create,
|
||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)
|
||||
createWithPayment,
|
||||
required TResult Function(List<ProductQuantity> items, String orderId)
|
||||
addToOrder,
|
||||
@ -1820,10 +1973,15 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? started,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult? Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult? Function(List<OrderItem> items, String orderId, String reason)?
|
||||
@ -1841,10 +1999,15 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? started,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table)?
|
||||
Customer? customer, OrderType orderType, TableModel table)?
|
||||
create,
|
||||
TResult Function(List<ProductQuantity> items, String customerName,
|
||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
String customerName,
|
||||
Customer? customer,
|
||||
OrderType orderType,
|
||||
TableModel table,
|
||||
PaymentMethod paymentMethod)?
|
||||
createWithPayment,
|
||||
TResult Function(List<ProductQuantity> items, String orderId)? addToOrder,
|
||||
TResult Function(List<OrderItem> items, String orderId, String reason)?
|
||||
|
||||
@ -6,12 +6,14 @@ class OrderFormEvent with _$OrderFormEvent {
|
||||
const factory OrderFormEvent.create({
|
||||
required List<ProductQuantity> items,
|
||||
required String customerName,
|
||||
required Customer? customer,
|
||||
required OrderType orderType,
|
||||
required TableModel table,
|
||||
}) = _Create;
|
||||
const factory OrderFormEvent.createWithPayment({
|
||||
required List<ProductQuantity> items,
|
||||
required String customerName,
|
||||
required Customer? customer,
|
||||
required OrderType orderType,
|
||||
required TableModel table,
|
||||
required PaymentMethod paymentMethod,
|
||||
|
||||
@ -19,13 +19,5 @@ class OutletLoaderBloc extends Bloc<OutletLoaderEvent, OutletLoaderState> {
|
||||
(r) => emit(_Loaded(r.data?.outlets ?? [])),
|
||||
);
|
||||
});
|
||||
on<_CurrentOutlet>((event, emit) async {
|
||||
emit(const _LoadingDetail());
|
||||
final result = await _outletRemoteDataSource.currentOutlet();
|
||||
result.fold(
|
||||
(l) => emit(_ErrorDetail(l)),
|
||||
(r) => emit(_LoadedDetail(r.data!)),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,38 +19,32 @@ mixin _$OutletLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() getOutlet,
|
||||
required TResult Function() currentOutlet,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? getOutlet,
|
||||
TResult? Function()? currentOutlet,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? getOutlet,
|
||||
TResult Function()? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_GetOutlet value) getOutlet,
|
||||
required TResult Function(_CurrentOutlet value) currentOutlet,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_GetOutlet value)? getOutlet,
|
||||
TResult? Function(_CurrentOutlet value)? currentOutlet,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_GetOutlet value)? getOutlet,
|
||||
TResult Function(_CurrentOutlet value)? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@ -119,7 +113,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() getOutlet,
|
||||
required TResult Function() currentOutlet,
|
||||
}) {
|
||||
return getOutlet();
|
||||
}
|
||||
@ -128,7 +121,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? getOutlet,
|
||||
TResult? Function()? currentOutlet,
|
||||
}) {
|
||||
return getOutlet?.call();
|
||||
}
|
||||
@ -137,7 +129,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? getOutlet,
|
||||
TResult Function()? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getOutlet != null) {
|
||||
@ -150,7 +141,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_GetOutlet value) getOutlet,
|
||||
required TResult Function(_CurrentOutlet value) currentOutlet,
|
||||
}) {
|
||||
return getOutlet(this);
|
||||
}
|
||||
@ -159,7 +149,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_GetOutlet value)? getOutlet,
|
||||
TResult? Function(_CurrentOutlet value)? currentOutlet,
|
||||
}) {
|
||||
return getOutlet?.call(this);
|
||||
}
|
||||
@ -168,7 +157,6 @@ class _$GetOutletImpl implements _GetOutlet {
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_GetOutlet value)? getOutlet,
|
||||
TResult Function(_CurrentOutlet value)? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getOutlet != null) {
|
||||
@ -182,111 +170,6 @@ abstract class _GetOutlet implements OutletLoaderEvent {
|
||||
const factory _GetOutlet() = _$GetOutletImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CurrentOutletImplCopyWith<$Res> {
|
||||
factory _$$CurrentOutletImplCopyWith(
|
||||
_$CurrentOutletImpl value, $Res Function(_$CurrentOutletImpl) then) =
|
||||
__$$CurrentOutletImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CurrentOutletImplCopyWithImpl<$Res>
|
||||
extends _$OutletLoaderEventCopyWithImpl<$Res, _$CurrentOutletImpl>
|
||||
implements _$$CurrentOutletImplCopyWith<$Res> {
|
||||
__$$CurrentOutletImplCopyWithImpl(
|
||||
_$CurrentOutletImpl _value, $Res Function(_$CurrentOutletImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of OutletLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CurrentOutletImpl implements _CurrentOutlet {
|
||||
const _$CurrentOutletImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OutletLoaderEvent.currentOutlet()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$CurrentOutletImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() getOutlet,
|
||||
required TResult Function() currentOutlet,
|
||||
}) {
|
||||
return currentOutlet();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? getOutlet,
|
||||
TResult? Function()? currentOutlet,
|
||||
}) {
|
||||
return currentOutlet?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? getOutlet,
|
||||
TResult Function()? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (currentOutlet != null) {
|
||||
return currentOutlet();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_GetOutlet value) getOutlet,
|
||||
required TResult Function(_CurrentOutlet value) currentOutlet,
|
||||
}) {
|
||||
return currentOutlet(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_GetOutlet value)? getOutlet,
|
||||
TResult? Function(_CurrentOutlet value)? currentOutlet,
|
||||
}) {
|
||||
return currentOutlet?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_GetOutlet value)? getOutlet,
|
||||
TResult Function(_CurrentOutlet value)? currentOutlet,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (currentOutlet != null) {
|
||||
return currentOutlet(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CurrentOutlet implements OutletLoaderEvent {
|
||||
const factory _CurrentOutlet() = _$CurrentOutletImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$OutletLoaderState {
|
||||
@optionalTypeArgs
|
||||
@ -295,9 +178,6 @@ mixin _$OutletLoaderState {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -306,9 +186,6 @@ mixin _$OutletLoaderState {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -317,9 +194,6 @@ mixin _$OutletLoaderState {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@ -329,9 +203,6 @@ mixin _$OutletLoaderState {
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -340,9 +211,6 @@ mixin _$OutletLoaderState {
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -351,9 +219,6 @@ mixin _$OutletLoaderState {
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@ -425,9 +290,6 @@ class _$InitialImpl implements _Initial {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
@ -439,9 +301,6 @@ class _$InitialImpl implements _Initial {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
@ -453,9 +312,6 @@ class _$InitialImpl implements _Initial {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
@ -471,9 +327,6 @@ class _$InitialImpl implements _Initial {
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
@ -485,9 +338,6 @@ class _$InitialImpl implements _Initial {
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
@ -499,9 +349,6 @@ class _$InitialImpl implements _Initial {
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
@ -560,9 +407,6 @@ class _$LoadingImpl implements _Loading {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
@ -574,9 +418,6 @@ class _$LoadingImpl implements _Loading {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
@ -588,9 +429,6 @@ class _$LoadingImpl implements _Loading {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
@ -606,9 +444,6 @@ class _$LoadingImpl implements _Loading {
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
@ -620,9 +455,6 @@ class _$LoadingImpl implements _Loading {
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
@ -634,9 +466,6 @@ class _$LoadingImpl implements _Loading {
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
@ -728,9 +557,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return loaded(outlets);
|
||||
}
|
||||
@ -742,9 +568,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return loaded?.call(outlets);
|
||||
}
|
||||
@ -756,9 +579,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
@ -774,9 +594,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
@ -788,9 +605,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
@ -802,9 +616,6 @@ class _$LoadedImpl implements _Loaded {
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
@ -898,9 +709,6 @@ class _$ErrorImpl implements _Error {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return error(message);
|
||||
}
|
||||
@ -912,9 +720,6 @@ class _$ErrorImpl implements _Error {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return error?.call(message);
|
||||
}
|
||||
@ -926,9 +731,6 @@ class _$ErrorImpl implements _Error {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
@ -944,9 +746,6 @@ class _$ErrorImpl implements _Error {
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
@ -958,9 +757,6 @@ class _$ErrorImpl implements _Error {
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
@ -972,9 +768,6 @@ class _$ErrorImpl implements _Error {
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
@ -995,478 +788,3 @@ abstract class _Error implements OutletLoaderState {
|
||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingDetailImplCopyWith<$Res> {
|
||||
factory _$$LoadingDetailImplCopyWith(
|
||||
_$LoadingDetailImpl value, $Res Function(_$LoadingDetailImpl) then) =
|
||||
__$$LoadingDetailImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingDetailImplCopyWithImpl<$Res>
|
||||
extends _$OutletLoaderStateCopyWithImpl<$Res, _$LoadingDetailImpl>
|
||||
implements _$$LoadingDetailImplCopyWith<$Res> {
|
||||
__$$LoadingDetailImplCopyWithImpl(
|
||||
_$LoadingDetailImpl _value, $Res Function(_$LoadingDetailImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingDetailImpl implements _LoadingDetail {
|
||||
const _$LoadingDetailImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OutletLoaderState.loadingDetail()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingDetailImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return loadingDetail();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return loadingDetail?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loadingDetail != null) {
|
||||
return loadingDetail();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return loadingDetail(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return loadingDetail?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loadingDetail != null) {
|
||||
return loadingDetail(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoadingDetail implements OutletLoaderState {
|
||||
const factory _LoadingDetail() = _$LoadingDetailImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadedDetailImplCopyWith<$Res> {
|
||||
factory _$$LoadedDetailImplCopyWith(
|
||||
_$LoadedDetailImpl value, $Res Function(_$LoadedDetailImpl) then) =
|
||||
__$$LoadedDetailImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Outlet outlet});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadedDetailImplCopyWithImpl<$Res>
|
||||
extends _$OutletLoaderStateCopyWithImpl<$Res, _$LoadedDetailImpl>
|
||||
implements _$$LoadedDetailImplCopyWith<$Res> {
|
||||
__$$LoadedDetailImplCopyWithImpl(
|
||||
_$LoadedDetailImpl _value, $Res Function(_$LoadedDetailImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? outlet = null,
|
||||
}) {
|
||||
return _then(_$LoadedDetailImpl(
|
||||
null == outlet
|
||||
? _value.outlet
|
||||
: outlet // ignore: cast_nullable_to_non_nullable
|
||||
as Outlet,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadedDetailImpl implements _LoadedDetail {
|
||||
const _$LoadedDetailImpl(this.outlet);
|
||||
|
||||
@override
|
||||
final Outlet outlet;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OutletLoaderState.loadedDetail(outlet: $outlet)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoadedDetailImpl &&
|
||||
(identical(other.outlet, outlet) || other.outlet == outlet));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, outlet);
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoadedDetailImplCopyWith<_$LoadedDetailImpl> get copyWith =>
|
||||
__$$LoadedDetailImplCopyWithImpl<_$LoadedDetailImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return loadedDetail(outlet);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return loadedDetail?.call(outlet);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loadedDetail != null) {
|
||||
return loadedDetail(outlet);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return loadedDetail(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return loadedDetail?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loadedDetail != null) {
|
||||
return loadedDetail(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoadedDetail implements OutletLoaderState {
|
||||
const factory _LoadedDetail(final Outlet outlet) = _$LoadedDetailImpl;
|
||||
|
||||
Outlet get outlet;
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoadedDetailImplCopyWith<_$LoadedDetailImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ErrorDetailImplCopyWith<$Res> {
|
||||
factory _$$ErrorDetailImplCopyWith(
|
||||
_$ErrorDetailImpl value, $Res Function(_$ErrorDetailImpl) then) =
|
||||
__$$ErrorDetailImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String message});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ErrorDetailImplCopyWithImpl<$Res>
|
||||
extends _$OutletLoaderStateCopyWithImpl<$Res, _$ErrorDetailImpl>
|
||||
implements _$$ErrorDetailImplCopyWith<$Res> {
|
||||
__$$ErrorDetailImplCopyWithImpl(
|
||||
_$ErrorDetailImpl _value, $Res Function(_$ErrorDetailImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? message = null,
|
||||
}) {
|
||||
return _then(_$ErrorDetailImpl(
|
||||
null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ErrorDetailImpl implements _ErrorDetail {
|
||||
const _$ErrorDetailImpl(this.message);
|
||||
|
||||
@override
|
||||
final String message;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OutletLoaderState.errorDetail(message: $message)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ErrorDetailImpl &&
|
||||
(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, message);
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ErrorDetailImplCopyWith<_$ErrorDetailImpl> get copyWith =>
|
||||
__$$ErrorDetailImplCopyWithImpl<_$ErrorDetailImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Outlet> outlets) loaded,
|
||||
required TResult Function(String message) error,
|
||||
required TResult Function() loadingDetail,
|
||||
required TResult Function(Outlet outlet) loadedDetail,
|
||||
required TResult Function(String message) errorDetail,
|
||||
}) {
|
||||
return errorDetail(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Outlet> outlets)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
TResult? Function()? loadingDetail,
|
||||
TResult? Function(Outlet outlet)? loadedDetail,
|
||||
TResult? Function(String message)? errorDetail,
|
||||
}) {
|
||||
return errorDetail?.call(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Outlet> outlets)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
TResult Function()? loadingDetail,
|
||||
TResult Function(Outlet outlet)? loadedDetail,
|
||||
TResult Function(String message)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (errorDetail != null) {
|
||||
return errorDetail(message);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
required TResult Function(_LoadingDetail value) loadingDetail,
|
||||
required TResult Function(_LoadedDetail value) loadedDetail,
|
||||
required TResult Function(_ErrorDetail value) errorDetail,
|
||||
}) {
|
||||
return errorDetail(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
TResult? Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult? Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult? Function(_ErrorDetail value)? errorDetail,
|
||||
}) {
|
||||
return errorDetail?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
TResult Function(_LoadingDetail value)? loadingDetail,
|
||||
TResult Function(_LoadedDetail value)? loadedDetail,
|
||||
TResult Function(_ErrorDetail value)? errorDetail,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (errorDetail != null) {
|
||||
return errorDetail(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ErrorDetail implements OutletLoaderState {
|
||||
const factory _ErrorDetail(final String message) = _$ErrorDetailImpl;
|
||||
|
||||
String get message;
|
||||
|
||||
/// Create a copy of OutletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ErrorDetailImplCopyWith<_$ErrorDetailImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:enaklo_pos/core/components/flushbar.dart';
|
||||
import 'package:enaklo_pos/core/components/spaces.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/data/models/response/customer_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/get_table_status/get_table_status_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/order_form/order_form_bloc.dart';
|
||||
@ -18,12 +19,15 @@ class PaymentSaveDialog extends StatefulWidget {
|
||||
final String customerName;
|
||||
final OrderType orderType;
|
||||
final List<ProductQuantity> items;
|
||||
const PaymentSaveDialog(
|
||||
{super.key,
|
||||
required this.selectedTable,
|
||||
required this.customerName,
|
||||
required this.orderType,
|
||||
required this.items});
|
||||
final Customer? customer;
|
||||
const PaymentSaveDialog({
|
||||
super.key,
|
||||
required this.selectedTable,
|
||||
required this.customerName,
|
||||
required this.orderType,
|
||||
required this.items,
|
||||
required this.customer,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PaymentSaveDialog> createState() => _PaymentSaveDialogState();
|
||||
@ -163,6 +167,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
||||
customerName: widget.customerName,
|
||||
orderType: widget.orderType,
|
||||
table: selectTable!,
|
||||
customer: widget.customer,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:enaklo_pos/core/components/custom_modal_dialog.dart';
|
||||
import 'package:enaklo_pos/core/components/spaces.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/data/models/response/customer_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||
import 'package:enaklo_pos/presentation/home/dialog/payment_add_order_dialog.dart';
|
||||
import 'package:enaklo_pos/presentation/home/dialog/payment_save_dialog.dart';
|
||||
@ -14,13 +15,16 @@ class SaveDialog extends StatefulWidget {
|
||||
final String customerName;
|
||||
final OrderType orderType;
|
||||
final List<ProductQuantity> items;
|
||||
final Customer? customer;
|
||||
|
||||
const SaveDialog(
|
||||
{super.key,
|
||||
required this.selectedTable,
|
||||
required this.customerName,
|
||||
required this.orderType,
|
||||
required this.items});
|
||||
const SaveDialog({
|
||||
super.key,
|
||||
required this.selectedTable,
|
||||
required this.customerName,
|
||||
required this.orderType,
|
||||
required this.items,
|
||||
required this.customer,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SaveDialog> createState() => _SaveDialogState();
|
||||
@ -45,10 +49,12 @@ class _SaveDialogState extends State<SaveDialog> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => PaymentSaveDialog(
|
||||
selectedTable: widget.selectedTable,
|
||||
customerName: widget.customerName,
|
||||
orderType: widget.orderType,
|
||||
items: widget.items),
|
||||
selectedTable: widget.selectedTable,
|
||||
customerName: widget.customerName,
|
||||
orderType: widget.orderType,
|
||||
items: widget.items,
|
||||
customer: widget.customer,
|
||||
),
|
||||
);
|
||||
}),
|
||||
SpaceHeight(16.0),
|
||||
|
||||
65
lib/presentation/home/dialog/variant_dialog.dart
Normal file
65
lib/presentation/home/dialog/variant_dialog.dart
Normal file
@ -0,0 +1,65 @@
|
||||
import 'package:enaklo_pos/core/components/custom_modal_dialog.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class VariantDialog extends StatelessWidget {
|
||||
final Product product;
|
||||
const VariantDialog({super.key, required this.product});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomModalDialog(
|
||||
title: 'Pilih Varian',
|
||||
subtitle: 'Silahkan pilih varian yang sesuai',
|
||||
minWidth: context.deviceWidth * 0.4,
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
children: product.variants!.map((variant) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// Aksi saat varian dipilih
|
||||
context.pop();
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.addItem(product, variant),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: (context.deviceWidth * 0.4 - 12 - 32) / 2 - 6, // 2 per row
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
variant.name ?? "",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
(variant.priceModifier ?? 0).currencyFormatRpV2,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@ import 'dart:convert';
|
||||
|
||||
class OrderRequestModel {
|
||||
final String? outletId;
|
||||
final String? userId;
|
||||
final String? customerId;
|
||||
final String? tableNumber;
|
||||
final String? tableId;
|
||||
final String? orderType;
|
||||
@ -12,7 +12,7 @@ class OrderRequestModel {
|
||||
|
||||
OrderRequestModel({
|
||||
this.outletId,
|
||||
this.userId,
|
||||
this.customerId,
|
||||
this.tableNumber,
|
||||
this.tableId,
|
||||
this.orderType,
|
||||
@ -29,7 +29,7 @@ class OrderRequestModel {
|
||||
factory OrderRequestModel.fromMap(Map<String, dynamic> json) =>
|
||||
OrderRequestModel(
|
||||
outletId: json["outlet_id"],
|
||||
userId: json["user_id"],
|
||||
customerId: json["customer_id"],
|
||||
tableNumber: json["table_number"],
|
||||
tableId: json["table_id"],
|
||||
orderType: json["order_type"],
|
||||
@ -43,7 +43,7 @@ class OrderRequestModel {
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"outlet_id": outletId,
|
||||
"user_id": userId,
|
||||
"customer_id": customerId,
|
||||
"table_number": tableNumber,
|
||||
"table_id": tableId,
|
||||
"order_type": orderType,
|
||||
@ -57,12 +57,14 @@ class OrderRequestModel {
|
||||
|
||||
class OrderItemRequest {
|
||||
final String? productId;
|
||||
final String? productVariantId;
|
||||
final int? quantity;
|
||||
final int? unitPrice;
|
||||
final String? notes;
|
||||
|
||||
OrderItemRequest({
|
||||
this.productId,
|
||||
this.productVariantId,
|
||||
this.quantity,
|
||||
this.unitPrice,
|
||||
this.notes,
|
||||
@ -74,6 +76,7 @@ class OrderItemRequest {
|
||||
factory OrderItemRequest.fromMap(Map<String, dynamic> json) =>
|
||||
OrderItemRequest(
|
||||
productId: json["product_id"],
|
||||
productVariantId: json["product_variant_id"],
|
||||
quantity: json["quantity"],
|
||||
unitPrice: json["unit_price"]?.toDouble(),
|
||||
notes: json["notes"],
|
||||
@ -81,6 +84,7 @@ class OrderItemRequest {
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"product_id": productId,
|
||||
"product_variant_id": productVariantId,
|
||||
"quantity": quantity,
|
||||
"unit_price": unitPrice,
|
||||
"notes": notes,
|
||||
|
||||
@ -5,12 +5,14 @@ import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||
|
||||
class ProductQuantity {
|
||||
final Product product;
|
||||
ProductVariant? variant;
|
||||
int quantity;
|
||||
String notes;
|
||||
ProductQuantity({
|
||||
required this.product,
|
||||
required this.quantity,
|
||||
this.notes = '',
|
||||
this.variant,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -20,17 +22,20 @@ class ProductQuantity {
|
||||
return other is ProductQuantity &&
|
||||
other.product == product &&
|
||||
other.quantity == quantity &&
|
||||
other.variant == variant &&
|
||||
other.notes == notes;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => product.hashCode ^ quantity.hashCode ^ notes.hashCode;
|
||||
int get hashCode =>
|
||||
product.hashCode ^ quantity.hashCode ^ variant.hashCode ^ notes.hashCode;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'product': product.toMap(),
|
||||
'quantity': quantity,
|
||||
'notes': notes,
|
||||
'variant': variant?.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -43,6 +48,7 @@ class ProductQuantity {
|
||||
'quantity': quantity,
|
||||
'price': product.price,
|
||||
'notes': notes,
|
||||
'variant': variant?.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,6 +61,7 @@ class ProductQuantity {
|
||||
'quantity': quantity,
|
||||
'price': product.price,
|
||||
'notes': notes,
|
||||
'variant': variant?.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,6 +70,9 @@ class ProductQuantity {
|
||||
product: Product.fromMap(map['product']),
|
||||
quantity: map['quantity']?.toInt() ?? 0,
|
||||
notes: map['notes'] ?? '',
|
||||
variant: map['variant'] != null
|
||||
? ProductVariant.fromMap(map['variant'])
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
@ -72,6 +82,9 @@ class ProductQuantity {
|
||||
product: Product.fromOrderMap(map),
|
||||
quantity: map['quantity']?.toInt() ?? 0,
|
||||
notes: map['notes'] ?? '',
|
||||
variant: map['variant'] != null
|
||||
? ProductVariant.fromMap(map['variant'])
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
@ -89,6 +102,7 @@ class ProductQuantity {
|
||||
product: product ?? this.product,
|
||||
quantity: quantity ?? this.quantity,
|
||||
notes: notes ?? this.notes,
|
||||
variant: variant,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -883,6 +883,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
||||
customerName: customerController.text,
|
||||
items: items,
|
||||
orderType: orderType,
|
||||
customer: selectedCustomer,
|
||||
),
|
||||
),
|
||||
label: 'Simpan',
|
||||
@ -921,6 +922,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
||||
.text,
|
||||
orderType: orderType,
|
||||
table: widget.table!,
|
||||
customer:
|
||||
selectedCustomer,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@ -95,7 +95,11 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(widget.data.product.price!.currencyFormatRp),
|
||||
Text((widget.data.product.price! +
|
||||
(widget.data.variant?.priceModifier ?? 0))
|
||||
.currencyFormatRp),
|
||||
if (widget.data.variant != null)
|
||||
Text(widget.data.variant?.name ?? ""),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -104,9 +108,8 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.removeItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(CheckoutEvent.removeItem(
|
||||
widget.data.product, widget.data.variant));
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
@ -127,9 +130,12 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.addItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.addItem(
|
||||
widget.data.product,
|
||||
widget.data.variant,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
@ -147,7 +153,8 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
SizedBox(
|
||||
width: 80.0,
|
||||
child: Text(
|
||||
(widget.data.product.price! * widget.data.quantity)
|
||||
(widget.data.product.price! * widget.data.quantity +
|
||||
(widget.data.variant?.priceModifier ?? 0))
|
||||
.currencyFormatRp,
|
||||
textAlign: TextAlign.right,
|
||||
style: const TextStyle(
|
||||
@ -179,9 +186,12 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
const SpaceWidth(16.0),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context
|
||||
.read<CheckoutBloc>()
|
||||
.add(CheckoutEvent.deleteItem(widget.data.product));
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.deleteItem(
|
||||
widget.data.product,
|
||||
widget.data.variant,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||
import 'package:enaklo_pos/presentation/home/dialog/variant_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/core/constants/variables.dart';
|
||||
@ -22,7 +23,16 @@ class ProductCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
context.read<CheckoutBloc>().add(CheckoutEvent.addItem(data));
|
||||
if (data.variants!.isEmpty) {
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.addItem(data, null),
|
||||
);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => VariantDialog(product: data),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
@ -114,40 +124,36 @@ class ProductCard extends StatelessWidget {
|
||||
totalPrice,
|
||||
draftName,
|
||||
orderType) {
|
||||
return products.any((element) => element.product == data)
|
||||
? products
|
||||
.firstWhere(
|
||||
(element) => element.product == data)
|
||||
.quantity >
|
||||
0
|
||||
? Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(9.0)),
|
||||
color: AppColors.primary,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
products
|
||||
.firstWhere((element) =>
|
||||
element.product == data)
|
||||
.quantity
|
||||
.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink()
|
||||
: SizedBox.shrink();
|
||||
final totalQuantity = products
|
||||
.where((item) => item.product.id == data.id)
|
||||
.map((item) => item.quantity)
|
||||
.fold(0, (sum, qty) => sum + qty);
|
||||
|
||||
if (totalQuantity == 0) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(9.0)),
|
||||
color: AppColors.primary,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
totalQuantity.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@ -135,12 +135,21 @@ class SalesListOrder extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (product.productVariantName != null)
|
||||
Text(
|
||||
product.productVariantName ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
(product.unitPrice ?? 0)
|
||||
.toString()
|
||||
.currencyFormatRpV2,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user