order type
This commit is contained in:
parent
0bffd92a08
commit
8fec9c8cd0
@ -166,6 +166,9 @@ class CheckoutFormBloc extends Bloc<CheckoutFormEvent, CheckoutFormState> {
|
|||||||
|
|
||||||
emit(currentState.copyWith(items: items, isLoading: false));
|
emit(currentState.copyWith(items: items, isLoading: false));
|
||||||
},
|
},
|
||||||
|
updateOrderType: (e) async {
|
||||||
|
emit(state.copyWith(orderType: e.orderType));
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
required TResult Function(Product product, ProductVariant? variant)
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
removeItem,
|
removeItem,
|
||||||
required TResult Function(Product product, String notes) updateItemNotes,
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
@ -31,6 +32,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
@ -38,6 +40,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult Function(Product product, String notes)? updateItemNotes,
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -46,6 +49,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
required TResult Function(_AddItem value) addItem,
|
required TResult Function(_AddItem value) addItem,
|
||||||
required TResult Function(_RemoveItem value) removeItem,
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
@ -53,6 +57,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
TResult? Function(_AddItem value)? addItem,
|
TResult? Function(_AddItem value)? addItem,
|
||||||
TResult? Function(_RemoveItem value)? removeItem,
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
@ -60,6 +65,7 @@ mixin _$CheckoutFormEvent {
|
|||||||
TResult Function(_AddItem value)? addItem,
|
TResult Function(_AddItem value)? addItem,
|
||||||
TResult Function(_RemoveItem value)? removeItem,
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
@ -167,6 +173,7 @@ class _$StartedImpl implements _Started {
|
|||||||
required TResult Function(Product product, ProductVariant? variant)
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
removeItem,
|
removeItem,
|
||||||
required TResult Function(Product product, String notes) updateItemNotes,
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return started(items);
|
return started(items);
|
||||||
}
|
}
|
||||||
@ -178,6 +185,7 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return started?.call(items);
|
return started?.call(items);
|
||||||
}
|
}
|
||||||
@ -189,6 +197,7 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult Function(Product product, String notes)? updateItemNotes,
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (started != null) {
|
if (started != null) {
|
||||||
@ -204,6 +213,7 @@ class _$StartedImpl implements _Started {
|
|||||||
required TResult Function(_AddItem value) addItem,
|
required TResult Function(_AddItem value) addItem,
|
||||||
required TResult Function(_RemoveItem value) removeItem,
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return started(this);
|
return started(this);
|
||||||
}
|
}
|
||||||
@ -215,6 +225,7 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult? Function(_AddItem value)? addItem,
|
TResult? Function(_AddItem value)? addItem,
|
||||||
TResult? Function(_RemoveItem value)? removeItem,
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return started?.call(this);
|
return started?.call(this);
|
||||||
}
|
}
|
||||||
@ -226,6 +237,7 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult Function(_AddItem value)? addItem,
|
TResult Function(_AddItem value)? addItem,
|
||||||
TResult Function(_RemoveItem value)? removeItem,
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (started != null) {
|
if (started != null) {
|
||||||
@ -356,6 +368,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
required TResult Function(Product product, ProductVariant? variant)
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
removeItem,
|
removeItem,
|
||||||
required TResult Function(Product product, String notes) updateItemNotes,
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return addItem(product, variant);
|
return addItem(product, variant);
|
||||||
}
|
}
|
||||||
@ -367,6 +380,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return addItem?.call(product, variant);
|
return addItem?.call(product, variant);
|
||||||
}
|
}
|
||||||
@ -378,6 +392,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult Function(Product product, String notes)? updateItemNotes,
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (addItem != null) {
|
if (addItem != null) {
|
||||||
@ -393,6 +408,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
required TResult Function(_AddItem value) addItem,
|
required TResult Function(_AddItem value) addItem,
|
||||||
required TResult Function(_RemoveItem value) removeItem,
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return addItem(this);
|
return addItem(this);
|
||||||
}
|
}
|
||||||
@ -404,6 +420,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
TResult? Function(_AddItem value)? addItem,
|
TResult? Function(_AddItem value)? addItem,
|
||||||
TResult? Function(_RemoveItem value)? removeItem,
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return addItem?.call(this);
|
return addItem?.call(this);
|
||||||
}
|
}
|
||||||
@ -415,6 +432,7 @@ class _$AddItemImpl implements _AddItem {
|
|||||||
TResult Function(_AddItem value)? addItem,
|
TResult Function(_AddItem value)? addItem,
|
||||||
TResult Function(_RemoveItem value)? removeItem,
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (addItem != null) {
|
if (addItem != null) {
|
||||||
@ -547,6 +565,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
required TResult Function(Product product, ProductVariant? variant)
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
removeItem,
|
removeItem,
|
||||||
required TResult Function(Product product, String notes) updateItemNotes,
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return removeItem(product, variant);
|
return removeItem(product, variant);
|
||||||
}
|
}
|
||||||
@ -558,6 +577,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return removeItem?.call(product, variant);
|
return removeItem?.call(product, variant);
|
||||||
}
|
}
|
||||||
@ -569,6 +589,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult Function(Product product, String notes)? updateItemNotes,
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (removeItem != null) {
|
if (removeItem != null) {
|
||||||
@ -584,6 +605,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
required TResult Function(_AddItem value) addItem,
|
required TResult Function(_AddItem value) addItem,
|
||||||
required TResult Function(_RemoveItem value) removeItem,
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return removeItem(this);
|
return removeItem(this);
|
||||||
}
|
}
|
||||||
@ -595,6 +617,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
TResult? Function(_AddItem value)? addItem,
|
TResult? Function(_AddItem value)? addItem,
|
||||||
TResult? Function(_RemoveItem value)? removeItem,
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return removeItem?.call(this);
|
return removeItem?.call(this);
|
||||||
}
|
}
|
||||||
@ -606,6 +629,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
|||||||
TResult Function(_AddItem value)? addItem,
|
TResult Function(_AddItem value)? addItem,
|
||||||
TResult Function(_RemoveItem value)? removeItem,
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (removeItem != null) {
|
if (removeItem != null) {
|
||||||
@ -728,6 +752,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
required TResult Function(Product product, ProductVariant? variant)
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
removeItem,
|
removeItem,
|
||||||
required TResult Function(Product product, String notes) updateItemNotes,
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return updateItemNotes(product, notes);
|
return updateItemNotes(product, notes);
|
||||||
}
|
}
|
||||||
@ -739,6 +764,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return updateItemNotes?.call(product, notes);
|
return updateItemNotes?.call(product, notes);
|
||||||
}
|
}
|
||||||
@ -750,6 +776,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
TResult Function(Product product, ProductVariant? variant)? addItem,
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
TResult Function(Product product, String notes)? updateItemNotes,
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (updateItemNotes != null) {
|
if (updateItemNotes != null) {
|
||||||
@ -765,6 +792,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
required TResult Function(_AddItem value) addItem,
|
required TResult Function(_AddItem value) addItem,
|
||||||
required TResult Function(_RemoveItem value) removeItem,
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return updateItemNotes(this);
|
return updateItemNotes(this);
|
||||||
}
|
}
|
||||||
@ -776,6 +804,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
TResult? Function(_AddItem value)? addItem,
|
TResult? Function(_AddItem value)? addItem,
|
||||||
TResult? Function(_RemoveItem value)? removeItem,
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
}) {
|
}) {
|
||||||
return updateItemNotes?.call(this);
|
return updateItemNotes?.call(this);
|
||||||
}
|
}
|
||||||
@ -787,6 +816,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
|||||||
TResult Function(_AddItem value)? addItem,
|
TResult Function(_AddItem value)? addItem,
|
||||||
TResult Function(_RemoveItem value)? removeItem,
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (updateItemNotes != null) {
|
if (updateItemNotes != null) {
|
||||||
@ -810,6 +840,172 @@ abstract class _UpdateItemNotes implements CheckoutFormEvent {
|
|||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$UpdateOrderTypeImplCopyWith<$Res> {
|
||||||
|
factory _$$UpdateOrderTypeImplCopyWith(
|
||||||
|
_$UpdateOrderTypeImpl value,
|
||||||
|
$Res Function(_$UpdateOrderTypeImpl) then,
|
||||||
|
) = __$$UpdateOrderTypeImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({OrderType orderType});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$UpdateOrderTypeImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateOrderTypeImpl>
|
||||||
|
implements _$$UpdateOrderTypeImplCopyWith<$Res> {
|
||||||
|
__$$UpdateOrderTypeImplCopyWithImpl(
|
||||||
|
_$UpdateOrderTypeImpl _value,
|
||||||
|
$Res Function(_$UpdateOrderTypeImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckoutFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? orderType = null}) {
|
||||||
|
return _then(
|
||||||
|
_$UpdateOrderTypeImpl(
|
||||||
|
null == orderType
|
||||||
|
? _value.orderType
|
||||||
|
: orderType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as OrderType,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||||
|
const _$UpdateOrderTypeImpl(this.orderType);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final OrderType orderType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckoutFormEvent.updateOrderType(orderType: $orderType)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$UpdateOrderTypeImpl &&
|
||||||
|
(identical(other.orderType, orderType) ||
|
||||||
|
other.orderType == orderType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, orderType);
|
||||||
|
|
||||||
|
/// Create a copy of CheckoutFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$UpdateOrderTypeImplCopyWith<_$UpdateOrderTypeImpl> get copyWith =>
|
||||||
|
__$$UpdateOrderTypeImplCopyWithImpl<_$UpdateOrderTypeImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(List<ProductQuantity> items) started,
|
||||||
|
required TResult Function(Product product, ProductVariant? variant) addItem,
|
||||||
|
required TResult Function(Product product, ProductVariant? variant)
|
||||||
|
removeItem,
|
||||||
|
required TResult Function(Product product, String notes) updateItemNotes,
|
||||||
|
required TResult Function(OrderType orderType) updateOrderType,
|
||||||
|
}) {
|
||||||
|
return updateOrderType(orderType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(List<ProductQuantity> items)? started,
|
||||||
|
TResult? Function(Product product, ProductVariant? variant)? addItem,
|
||||||
|
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
|
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult? Function(OrderType orderType)? updateOrderType,
|
||||||
|
}) {
|
||||||
|
return updateOrderType?.call(orderType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(List<ProductQuantity> items)? started,
|
||||||
|
TResult Function(Product product, ProductVariant? variant)? addItem,
|
||||||
|
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||||
|
TResult Function(Product product, String notes)? updateItemNotes,
|
||||||
|
TResult Function(OrderType orderType)? updateOrderType,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (updateOrderType != null) {
|
||||||
|
return updateOrderType(orderType);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Started value) started,
|
||||||
|
required TResult Function(_AddItem value) addItem,
|
||||||
|
required TResult Function(_RemoveItem value) removeItem,
|
||||||
|
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||||
|
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||||
|
}) {
|
||||||
|
return updateOrderType(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Started value)? started,
|
||||||
|
TResult? Function(_AddItem value)? addItem,
|
||||||
|
TResult? Function(_RemoveItem value)? removeItem,
|
||||||
|
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||||
|
}) {
|
||||||
|
return updateOrderType?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Started value)? started,
|
||||||
|
TResult Function(_AddItem value)? addItem,
|
||||||
|
TResult Function(_RemoveItem value)? removeItem,
|
||||||
|
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||||
|
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (updateOrderType != null) {
|
||||||
|
return updateOrderType(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _UpdateOrderType implements CheckoutFormEvent {
|
||||||
|
const factory _UpdateOrderType(final OrderType orderType) =
|
||||||
|
_$UpdateOrderTypeImpl;
|
||||||
|
|
||||||
|
OrderType get orderType;
|
||||||
|
|
||||||
|
/// Create a copy of CheckoutFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$UpdateOrderTypeImplCopyWith<_$UpdateOrderTypeImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$CheckoutFormState {
|
mixin _$CheckoutFormState {
|
||||||
List<ProductQuantity> get items => throw _privateConstructorUsedError;
|
List<ProductQuantity> get items => throw _privateConstructorUsedError;
|
||||||
|
|||||||
@ -19,4 +19,7 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
|
|||||||
Product product,
|
Product product,
|
||||||
String notes,
|
String notes,
|
||||||
) = _UpdateItemNotes;
|
) = _UpdateItemNotes;
|
||||||
|
|
||||||
|
const factory CheckoutFormEvent.updateOrderType(OrderType orderType) =
|
||||||
|
_UpdateOrderType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,16 @@
|
|||||||
part of 'extension.dart';
|
part of 'extension.dart';
|
||||||
|
|
||||||
extension StringX on String {
|
extension StringX on String {
|
||||||
|
String toTitleCase() {
|
||||||
|
if (isEmpty) return '';
|
||||||
|
return split(' ')
|
||||||
|
.map((word) {
|
||||||
|
if (word.isEmpty) return '';
|
||||||
|
return word[0].toUpperCase() + word.substring(1).toLowerCase();
|
||||||
|
})
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
TableStatusType toTableStatusType() {
|
TableStatusType toTableStatusType() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case 'available':
|
case 'available':
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
enum OrderType {
|
enum OrderType {
|
||||||
dineIn('DINE IN'),
|
dineIn('DINE IN'),
|
||||||
takeAway('TAKE AWAY'),
|
takeAway('TAKE AWAY'),
|
||||||
@ -13,4 +15,17 @@ enum OrderType {
|
|||||||
orElse: () => OrderType.dineIn,
|
orElse: () => OrderType.dineIn,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconData get icon {
|
||||||
|
switch (this) {
|
||||||
|
case OrderType.dineIn:
|
||||||
|
return Icons.dinner_dining_outlined;
|
||||||
|
case OrderType.takeAway:
|
||||||
|
return Icons.takeout_dining_outlined;
|
||||||
|
case OrderType.delivery:
|
||||||
|
return Icons.delivery_dining_outlined;
|
||||||
|
case OrderType.freeTable:
|
||||||
|
return Icons.table_bar_outlined;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
126
lib/presentation/components/dialog/order_type_dialog.dart
Normal file
126
lib/presentation/components/dialog/order_type_dialog.dart
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||||
|
import '../../../common/theme/theme.dart';
|
||||||
|
import '../../../common/types/order_type.dart';
|
||||||
|
import '../spaces/space.dart';
|
||||||
|
import 'dialog.dart';
|
||||||
|
|
||||||
|
class OrderTypeDialog extends StatelessWidget {
|
||||||
|
const OrderTypeDialog({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<Map<String, dynamic>> types = [
|
||||||
|
{
|
||||||
|
'value': 'dine_in',
|
||||||
|
'label': 'Dine In',
|
||||||
|
'icon': Icons.restaurant_outlined,
|
||||||
|
'type': OrderType.dineIn,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': 'take_away',
|
||||||
|
'label': 'Take Away',
|
||||||
|
'icon': Icons.takeout_dining_outlined,
|
||||||
|
'type': OrderType.takeAway,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': 'delivery',
|
||||||
|
'label': 'Delivery',
|
||||||
|
'icon': Icons.delivery_dining_outlined,
|
||||||
|
'type': OrderType.delivery,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': 'free_table',
|
||||||
|
'label': 'Free Table',
|
||||||
|
'icon': Icons.table_bar_outlined,
|
||||||
|
'type': OrderType.freeTable,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return CustomModalDialog(
|
||||||
|
title: 'Pilih Tipe',
|
||||||
|
subtitle: 'Silahkan pilih tipe yang sesuai',
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16.0,
|
||||||
|
vertical: 24.0,
|
||||||
|
),
|
||||||
|
child: BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
return Column(
|
||||||
|
children: List.generate(types.length, (index) {
|
||||||
|
return _buildItem(
|
||||||
|
context,
|
||||||
|
types[index],
|
||||||
|
selectedType: state.orderType,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildItem(
|
||||||
|
BuildContext context,
|
||||||
|
Map<String, dynamic> type, {
|
||||||
|
required OrderType selectedType,
|
||||||
|
}) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
context.read<CheckoutFormBloc>().add(
|
||||||
|
CheckoutFormEvent.updateOrderType(type['type']),
|
||||||
|
);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
|
||||||
|
margin: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: selectedType == type['type']
|
||||||
|
? AppColor.primary
|
||||||
|
: AppColor.white,
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: selectedType == type['type']
|
||||||
|
? AppColor.primary
|
||||||
|
: AppColor.textSecondary,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
type['icon'],
|
||||||
|
color: selectedType == type['type']
|
||||||
|
? AppColor.white
|
||||||
|
: AppColor.black,
|
||||||
|
),
|
||||||
|
SpaceWidth(12.0),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
type['label']!,
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
color: selectedType == type['type']
|
||||||
|
? AppColor.white
|
||||||
|
: AppColor.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SpaceWidth(12.0),
|
||||||
|
Icon(
|
||||||
|
Icons.check_circle,
|
||||||
|
color: selectedType == type['value']
|
||||||
|
? AppColor.success
|
||||||
|
: Colors.transparent,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||||
import '../../../../../../common/extension/extension.dart';
|
import '../../../../../../common/extension/extension.dart';
|
||||||
import '../../../../../../common/theme/theme.dart';
|
import '../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../components/button/button.dart';
|
import '../../../../../components/button/button.dart';
|
||||||
|
import '../../../../../components/dialog/order_type_dialog.dart';
|
||||||
|
|
||||||
class HomeRightTitle extends StatelessWidget {
|
class HomeRightTitle extends StatelessWidget {
|
||||||
// final TableModel? table;
|
// final TableModel? table;
|
||||||
@ -10,6 +13,8 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||||
|
builder: (context, state) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.only(top: 20),
|
||||||
height: context.deviceHeight * 0.15,
|
height: context.deviceHeight * 0.15,
|
||||||
@ -47,21 +52,21 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
height: 40,
|
height: 40,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// showDialog(
|
showDialog(
|
||||||
// context: context,
|
context: context,
|
||||||
// builder: (context) {
|
builder: (context) {
|
||||||
// return TypeDialog();
|
return OrderTypeDialog();
|
||||||
// },
|
},
|
||||||
// );
|
);
|
||||||
},
|
},
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.dinner_dining_outlined,
|
state.orderType.icon,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 24,
|
size: 24,
|
||||||
),
|
),
|
||||||
label: 'Dine In',
|
label: state.orderType.value.toTitleCase(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -93,5 +98,7 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user