delivery dialog
This commit is contained in:
parent
8fec9c8cd0
commit
08bbfc393b
@ -169,6 +169,9 @@ class CheckoutFormBloc extends Bloc<CheckoutFormEvent, CheckoutFormState> {
|
||||
updateOrderType: (e) async {
|
||||
emit(state.copyWith(orderType: e.orderType));
|
||||
},
|
||||
updateDelivery: (e) async {
|
||||
emit(state.copyWith(delivery: e.delivery));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ mixin _$CheckoutFormEvent {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
@ -33,6 +34,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
@ -41,6 +43,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -50,6 +53,7 @@ mixin _$CheckoutFormEvent {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
@ -58,6 +62,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
@ -66,6 +71,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -174,6 +180,7 @@ class _$StartedImpl implements _Started {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return started(items);
|
||||
}
|
||||
@ -186,6 +193,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return started?.call(items);
|
||||
}
|
||||
@ -198,6 +206,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -214,6 +223,7 @@ class _$StartedImpl implements _Started {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
@ -226,6 +236,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
@ -238,6 +249,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -369,6 +381,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return addItem(product, variant);
|
||||
}
|
||||
@ -381,6 +394,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return addItem?.call(product, variant);
|
||||
}
|
||||
@ -393,6 +407,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -409,6 +424,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return addItem(this);
|
||||
}
|
||||
@ -421,6 +437,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return addItem?.call(this);
|
||||
}
|
||||
@ -433,6 +450,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -566,6 +584,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return removeItem(product, variant);
|
||||
}
|
||||
@ -578,6 +597,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return removeItem?.call(product, variant);
|
||||
}
|
||||
@ -590,6 +610,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -606,6 +627,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return removeItem(this);
|
||||
}
|
||||
@ -618,6 +640,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return removeItem?.call(this);
|
||||
}
|
||||
@ -630,6 +653,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -753,6 +777,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return updateItemNotes(product, notes);
|
||||
}
|
||||
@ -765,6 +790,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return updateItemNotes?.call(product, notes);
|
||||
}
|
||||
@ -777,6 +803,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -793,6 +820,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return updateItemNotes(this);
|
||||
}
|
||||
@ -805,6 +833,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return updateItemNotes?.call(this);
|
||||
}
|
||||
@ -817,6 +846,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -920,6 +950,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
removeItem,
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return updateOrderType(orderType);
|
||||
}
|
||||
@ -932,6 +963,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return updateOrderType?.call(orderType);
|
||||
}
|
||||
@ -944,6 +976,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(Product product, ProductVariant? variant)? removeItem,
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -960,6 +993,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
required TResult Function(_RemoveItem value) removeItem,
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return updateOrderType(this);
|
||||
}
|
||||
@ -972,6 +1006,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(_RemoveItem value)? removeItem,
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return updateOrderType?.call(this);
|
||||
}
|
||||
@ -984,6 +1019,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(_RemoveItem value)? removeItem,
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -1006,6 +1042,177 @@ abstract class _UpdateOrderType implements CheckoutFormEvent {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UpdateDeliveryImplCopyWith<$Res> {
|
||||
factory _$$UpdateDeliveryImplCopyWith(
|
||||
_$UpdateDeliveryImpl value,
|
||||
$Res Function(_$UpdateDeliveryImpl) then,
|
||||
) = __$$UpdateDeliveryImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Delivery delivery});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UpdateDeliveryImplCopyWithImpl<$Res>
|
||||
extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateDeliveryImpl>
|
||||
implements _$$UpdateDeliveryImplCopyWith<$Res> {
|
||||
__$$UpdateDeliveryImplCopyWithImpl(
|
||||
_$UpdateDeliveryImpl _value,
|
||||
$Res Function(_$UpdateDeliveryImpl) _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? delivery = null}) {
|
||||
return _then(
|
||||
_$UpdateDeliveryImpl(
|
||||
null == delivery
|
||||
? _value.delivery
|
||||
: delivery // ignore: cast_nullable_to_non_nullable
|
||||
as Delivery,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
const _$UpdateDeliveryImpl(this.delivery);
|
||||
|
||||
@override
|
||||
final Delivery delivery;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutFormEvent.updateDelivery(delivery: $delivery)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UpdateDeliveryImpl &&
|
||||
(identical(other.delivery, delivery) ||
|
||||
other.delivery == delivery));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, delivery);
|
||||
|
||||
/// 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')
|
||||
_$$UpdateDeliveryImplCopyWith<_$UpdateDeliveryImpl> get copyWith =>
|
||||
__$$UpdateDeliveryImplCopyWithImpl<_$UpdateDeliveryImpl>(
|
||||
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,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
}) {
|
||||
return updateDelivery(delivery);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
}) {
|
||||
return updateDelivery?.call(delivery);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
return updateDelivery(delivery);
|
||||
}
|
||||
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,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
}) {
|
||||
return updateDelivery(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,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
}) {
|
||||
return updateDelivery?.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,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
return updateDelivery(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UpdateDelivery implements CheckoutFormEvent {
|
||||
const factory _UpdateDelivery(final Delivery delivery) = _$UpdateDeliveryImpl;
|
||||
|
||||
Delivery get delivery;
|
||||
|
||||
/// Create a copy of CheckoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UpdateDeliveryImplCopyWith<_$UpdateDeliveryImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CheckoutFormState {
|
||||
List<ProductQuantity> get items => throw _privateConstructorUsedError;
|
||||
|
||||
@ -22,4 +22,7 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
|
||||
|
||||
const factory CheckoutFormEvent.updateOrderType(OrderType orderType) =
|
||||
_UpdateOrderType;
|
||||
|
||||
const factory CheckoutFormEvent.updateDelivery(Delivery delivery) =
|
||||
_UpdateDelivery;
|
||||
}
|
||||
|
||||
98
lib/presentation/components/dialog/delivery_dialog.dart
Normal file
98
lib/presentation/components/dialog/delivery_dialog.dart
Normal file
@ -0,0 +1,98 @@
|
||||
part of 'dialog.dart';
|
||||
|
||||
class DeliveryDialog extends StatefulWidget {
|
||||
const DeliveryDialog({super.key});
|
||||
|
||||
@override
|
||||
State<DeliveryDialog> createState() => _DeliveryDialogState();
|
||||
}
|
||||
|
||||
class _DeliveryDialogState extends State<DeliveryDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomModalDialog(
|
||||
title: 'Pilih Pengiriman',
|
||||
subtitle: 'Silahkan pilih pengiriman yang sesuai',
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 24.0,
|
||||
),
|
||||
child: BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: List.generate(deliveries.length, (index) {
|
||||
return _buildItem(
|
||||
context,
|
||||
deliveries[index],
|
||||
selectedType: state.delivery,
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItem(
|
||||
BuildContext context,
|
||||
Delivery delivery, {
|
||||
Delivery? selectedType,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.updateDelivery(delivery),
|
||||
);
|
||||
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?.id == delivery.id
|
||||
? AppColor.primary
|
||||
: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
border: Border.all(
|
||||
color: selectedType?.id == delivery.id
|
||||
? AppColor.primary
|
||||
: AppColor.textSecondary,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
delivery.imageUrl,
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
delivery.name,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: selectedType?.id == delivery.id
|
||||
? AppColor.white
|
||||
: AppColor.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: selectedType?.id == delivery.id
|
||||
? AppColor.success
|
||||
: Colors.transparent,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,8 @@ import '../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../application/outlet/outlet_loader/outlet_loader_bloc.dart';
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../common/types/order_type.dart';
|
||||
import '../../../domain/delivery/delivery.dart';
|
||||
import '../../../domain/product/product.dart';
|
||||
import '../button/button.dart';
|
||||
import '../card/outlet_card.dart';
|
||||
@ -15,3 +17,5 @@ import '../spaces/space.dart';
|
||||
part 'custom_modal_dialog.dart';
|
||||
part 'outlet_dialog.dart';
|
||||
part 'variant_dialog.dart';
|
||||
part 'delivery_dialog.dart';
|
||||
part 'order_type_dialog.dart';
|
||||
|
||||
@ -1,12 +1,4 @@
|
||||
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';
|
||||
part of 'dialog.dart';
|
||||
|
||||
class OrderTypeDialog extends StatelessWidget {
|
||||
const OrderTypeDialog({super.key});
|
||||
|
||||
@ -4,8 +4,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../common/types/order_type.dart';
|
||||
import '../../../../../components/button/button.dart';
|
||||
import '../../../../../components/dialog/order_type_dialog.dart';
|
||||
import '../../../../../components/dialog/dialog.dart';
|
||||
|
||||
class HomeRightTitle extends StatelessWidget {
|
||||
// final TableModel? table;
|
||||
@ -27,31 +28,16 @@ class HomeRightTitle extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: () {},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(Icons.list, color: Colors.white, size: 24),
|
||||
label: 'Daftar Pesanan',
|
||||
),
|
||||
),
|
||||
],
|
||||
children: [_buildButton('Daftar Pesanan', Icons.list, () {})],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: () {
|
||||
_buildButton(
|
||||
state.orderType.value.toTitleCase(),
|
||||
state.orderType.icon,
|
||||
() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
@ -59,39 +45,30 @@ class HomeRightTitle extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(
|
||||
state.orderType.icon,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
label: state.orderType.value.toTitleCase(),
|
||||
switch (state.orderType) {
|
||||
OrderType.dineIn => _buildButton(
|
||||
'Pilih Meja',
|
||||
Icons.table_restaurant_outlined,
|
||||
() {},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
icon: Icon(
|
||||
OrderType.takeAway => SizedBox.shrink(),
|
||||
OrderType.delivery => _buildButton(
|
||||
state.delivery == null
|
||||
? 'Pilih Pengiriman'
|
||||
: (state.delivery?.name ?? "-"),
|
||||
Icons.motorcycle_outlined,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return DeliveryDialog();
|
||||
// },
|
||||
// );
|
||||
() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DeliveryDialog();
|
||||
},
|
||||
);
|
||||
},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
label: 'Pilih Pengiriman',
|
||||
),
|
||||
),
|
||||
OrderType.freeTable => SizedBox.shrink(),
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -101,4 +78,19 @@ class HomeRightTitle extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Expanded _buildButton(String label, IconData icon, Function() onPressed) {
|
||||
return Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
width: 180.0,
|
||||
height: 40,
|
||||
elevation: 0,
|
||||
onPressed: onPressed,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
icon: Icon(icon, color: Colors.white, size: 24),
|
||||
label: label,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user