change table
This commit is contained in:
parent
08bbfc393b
commit
e8fd683077
@ -7,6 +7,7 @@ import 'package:injectable/injectable.dart';
|
||||
import '../../../common/types/order_type.dart';
|
||||
import '../../../domain/delivery/delivery.dart';
|
||||
import '../../../domain/product/product.dart';
|
||||
import '../../../domain/table/table.dart';
|
||||
|
||||
part 'checkout_form_event.dart';
|
||||
part 'checkout_form_state.dart';
|
||||
@ -172,6 +173,9 @@ class CheckoutFormBloc extends Bloc<CheckoutFormEvent, CheckoutFormState> {
|
||||
updateDelivery: (e) async {
|
||||
emit(state.copyWith(delivery: e.delivery));
|
||||
},
|
||||
updateTable: (e) async {
|
||||
emit(state.copyWith(table: e.table));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ mixin _$CheckoutFormEvent {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
@ -35,6 +36,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
@ -44,6 +46,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -54,6 +57,7 @@ mixin _$CheckoutFormEvent {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
@ -63,6 +67,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
@ -72,6 +77,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -181,6 +187,7 @@ class _$StartedImpl implements _Started {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return started(items);
|
||||
}
|
||||
@ -194,6 +201,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return started?.call(items);
|
||||
}
|
||||
@ -207,6 +215,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -224,6 +233,7 @@ class _$StartedImpl implements _Started {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
@ -237,6 +247,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
@ -250,6 +261,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -382,6 +394,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return addItem(product, variant);
|
||||
}
|
||||
@ -395,6 +408,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return addItem?.call(product, variant);
|
||||
}
|
||||
@ -408,6 +422,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -425,6 +440,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return addItem(this);
|
||||
}
|
||||
@ -438,6 +454,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return addItem?.call(this);
|
||||
}
|
||||
@ -451,6 +468,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -585,6 +603,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return removeItem(product, variant);
|
||||
}
|
||||
@ -598,6 +617,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return removeItem?.call(product, variant);
|
||||
}
|
||||
@ -611,6 +631,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -628,6 +649,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return removeItem(this);
|
||||
}
|
||||
@ -641,6 +663,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return removeItem?.call(this);
|
||||
}
|
||||
@ -654,6 +677,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -778,6 +802,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return updateItemNotes(product, notes);
|
||||
}
|
||||
@ -791,6 +816,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return updateItemNotes?.call(product, notes);
|
||||
}
|
||||
@ -804,6 +830,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -821,6 +848,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return updateItemNotes(this);
|
||||
}
|
||||
@ -834,6 +862,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return updateItemNotes?.call(this);
|
||||
}
|
||||
@ -847,6 +876,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -951,6 +981,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return updateOrderType(orderType);
|
||||
}
|
||||
@ -964,6 +995,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return updateOrderType?.call(orderType);
|
||||
}
|
||||
@ -977,6 +1009,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -994,6 +1027,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return updateOrderType(this);
|
||||
}
|
||||
@ -1007,6 +1041,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return updateOrderType?.call(this);
|
||||
}
|
||||
@ -1020,6 +1055,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -1123,6 +1159,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
required TResult Function(Product product, String notes) updateItemNotes,
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return updateDelivery(delivery);
|
||||
}
|
||||
@ -1136,6 +1173,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult? Function(Product product, String notes)? updateItemNotes,
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return updateDelivery?.call(delivery);
|
||||
}
|
||||
@ -1149,6 +1187,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult Function(Product product, String notes)? updateItemNotes,
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
@ -1166,6 +1205,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
required TResult Function(_UpdateItemNotes value) updateItemNotes,
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return updateDelivery(this);
|
||||
}
|
||||
@ -1179,6 +1219,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult? Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return updateDelivery?.call(this);
|
||||
}
|
||||
@ -1192,6 +1233,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult Function(_UpdateItemNotes value)? updateItemNotes,
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
@ -1213,6 +1255,195 @@ abstract class _UpdateDelivery implements CheckoutFormEvent {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UpdateTableImplCopyWith<$Res> {
|
||||
factory _$$UpdateTableImplCopyWith(
|
||||
_$UpdateTableImpl value,
|
||||
$Res Function(_$UpdateTableImpl) then,
|
||||
) = __$$UpdateTableImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Table? table});
|
||||
|
||||
$TableCopyWith<$Res>? get table;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UpdateTableImplCopyWithImpl<$Res>
|
||||
extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateTableImpl>
|
||||
implements _$$UpdateTableImplCopyWith<$Res> {
|
||||
__$$UpdateTableImplCopyWithImpl(
|
||||
_$UpdateTableImpl _value,
|
||||
$Res Function(_$UpdateTableImpl) _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? table = freezed}) {
|
||||
return _then(
|
||||
_$UpdateTableImpl(
|
||||
freezed == table
|
||||
? _value.table
|
||||
: table // ignore: cast_nullable_to_non_nullable
|
||||
as Table?,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of CheckoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$TableCopyWith<$Res>? get table {
|
||||
if (_value.table == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $TableCopyWith<$Res>(_value.table!, (value) {
|
||||
return _then(_value.copyWith(table: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UpdateTableImpl implements _UpdateTable {
|
||||
const _$UpdateTableImpl(this.table);
|
||||
|
||||
@override
|
||||
final Table? table;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutFormEvent.updateTable(table: $table)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UpdateTableImpl &&
|
||||
(identical(other.table, table) || other.table == table));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, table);
|
||||
|
||||
/// 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')
|
||||
_$$UpdateTableImplCopyWith<_$UpdateTableImpl> get copyWith =>
|
||||
__$$UpdateTableImplCopyWithImpl<_$UpdateTableImpl>(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,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
}) {
|
||||
return updateTable(table);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
}) {
|
||||
return updateTable?.call(table);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateTable != null) {
|
||||
return updateTable(table);
|
||||
}
|
||||
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,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
}) {
|
||||
return updateTable(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,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
}) {
|
||||
return updateTable?.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,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateTable != null) {
|
||||
return updateTable(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UpdateTable implements CheckoutFormEvent {
|
||||
const factory _UpdateTable(final Table? table) = _$UpdateTableImpl;
|
||||
|
||||
Table? get table;
|
||||
|
||||
/// Create a copy of CheckoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UpdateTableImplCopyWith<_$UpdateTableImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CheckoutFormState {
|
||||
List<ProductQuantity> get items => throw _privateConstructorUsedError;
|
||||
@ -1225,6 +1456,7 @@ mixin _$CheckoutFormState {
|
||||
String get draftName => throw _privateConstructorUsedError;
|
||||
OrderType get orderType => throw _privateConstructorUsedError;
|
||||
Delivery? get delivery => throw _privateConstructorUsedError;
|
||||
Table? get table => throw _privateConstructorUsedError;
|
||||
bool get isLoading => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CheckoutFormState
|
||||
@ -1252,8 +1484,11 @@ abstract class $CheckoutFormStateCopyWith<$Res> {
|
||||
String draftName,
|
||||
OrderType orderType,
|
||||
Delivery? delivery,
|
||||
Table? table,
|
||||
bool isLoading,
|
||||
});
|
||||
|
||||
$TableCopyWith<$Res>? get table;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1281,6 +1516,7 @@ class _$CheckoutFormStateCopyWithImpl<$Res, $Val extends CheckoutFormState>
|
||||
Object? draftName = null,
|
||||
Object? orderType = null,
|
||||
Object? delivery = freezed,
|
||||
Object? table = freezed,
|
||||
Object? isLoading = null,
|
||||
}) {
|
||||
return _then(
|
||||
@ -1325,6 +1561,10 @@ class _$CheckoutFormStateCopyWithImpl<$Res, $Val extends CheckoutFormState>
|
||||
? _value.delivery
|
||||
: delivery // ignore: cast_nullable_to_non_nullable
|
||||
as Delivery?,
|
||||
table: freezed == table
|
||||
? _value.table
|
||||
: table // ignore: cast_nullable_to_non_nullable
|
||||
as Table?,
|
||||
isLoading: null == isLoading
|
||||
? _value.isLoading
|
||||
: isLoading // ignore: cast_nullable_to_non_nullable
|
||||
@ -1333,6 +1573,20 @@ class _$CheckoutFormStateCopyWithImpl<$Res, $Val extends CheckoutFormState>
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of CheckoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$TableCopyWith<$Res>? get table {
|
||||
if (_value.table == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $TableCopyWith<$Res>(_value.table!, (value) {
|
||||
return _then(_value.copyWith(table: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1355,8 +1609,12 @@ abstract class _$$CheckoutFormStateImplCopyWith<$Res>
|
||||
String draftName,
|
||||
OrderType orderType,
|
||||
Delivery? delivery,
|
||||
Table? table,
|
||||
bool isLoading,
|
||||
});
|
||||
|
||||
@override
|
||||
$TableCopyWith<$Res>? get table;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1383,6 +1641,7 @@ class __$$CheckoutFormStateImplCopyWithImpl<$Res>
|
||||
Object? draftName = null,
|
||||
Object? orderType = null,
|
||||
Object? delivery = freezed,
|
||||
Object? table = freezed,
|
||||
Object? isLoading = null,
|
||||
}) {
|
||||
return _then(
|
||||
@ -1427,6 +1686,10 @@ class __$$CheckoutFormStateImplCopyWithImpl<$Res>
|
||||
? _value.delivery
|
||||
: delivery // ignore: cast_nullable_to_non_nullable
|
||||
as Delivery?,
|
||||
table: freezed == table
|
||||
? _value.table
|
||||
: table // ignore: cast_nullable_to_non_nullable
|
||||
as Table?,
|
||||
isLoading: null == isLoading
|
||||
? _value.isLoading
|
||||
: isLoading // ignore: cast_nullable_to_non_nullable
|
||||
@ -1450,6 +1713,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
required this.draftName,
|
||||
required this.orderType,
|
||||
this.delivery,
|
||||
this.table,
|
||||
this.isLoading = false,
|
||||
}) : _items = items;
|
||||
|
||||
@ -1480,12 +1744,14 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
@override
|
||||
final Delivery? delivery;
|
||||
@override
|
||||
final Table? table;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isLoading;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutFormState(items: $items, discount: $discount, discountAmount: $discountAmount, tax: $tax, serviceCharge: $serviceCharge, totalQuantity: $totalQuantity, totalPrice: $totalPrice, draftName: $draftName, orderType: $orderType, delivery: $delivery, isLoading: $isLoading)';
|
||||
return 'CheckoutFormState(items: $items, discount: $discount, discountAmount: $discountAmount, tax: $tax, serviceCharge: $serviceCharge, totalQuantity: $totalQuantity, totalPrice: $totalPrice, draftName: $draftName, orderType: $orderType, delivery: $delivery, table: $table, isLoading: $isLoading)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1511,6 +1777,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
other.orderType == orderType) &&
|
||||
(identical(other.delivery, delivery) ||
|
||||
other.delivery == delivery) &&
|
||||
(identical(other.table, table) || other.table == table) &&
|
||||
(identical(other.isLoading, isLoading) ||
|
||||
other.isLoading == isLoading));
|
||||
}
|
||||
@ -1528,6 +1795,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
draftName,
|
||||
orderType,
|
||||
delivery,
|
||||
table,
|
||||
isLoading,
|
||||
);
|
||||
|
||||
@ -1555,6 +1823,7 @@ abstract class _CheckoutFormState implements CheckoutFormState {
|
||||
required final String draftName,
|
||||
required final OrderType orderType,
|
||||
final Delivery? delivery,
|
||||
final Table? table,
|
||||
final bool isLoading,
|
||||
}) = _$CheckoutFormStateImpl;
|
||||
|
||||
@ -1579,6 +1848,8 @@ abstract class _CheckoutFormState implements CheckoutFormState {
|
||||
@override
|
||||
Delivery? get delivery;
|
||||
@override
|
||||
Table? get table;
|
||||
@override
|
||||
bool get isLoading;
|
||||
|
||||
/// Create a copy of CheckoutFormState
|
||||
|
||||
@ -25,4 +25,6 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
|
||||
|
||||
const factory CheckoutFormEvent.updateDelivery(Delivery delivery) =
|
||||
_UpdateDelivery;
|
||||
|
||||
const factory CheckoutFormEvent.updateTable(Table? table) = _UpdateTable;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ class CheckoutFormState with _$CheckoutFormState {
|
||||
required String draftName,
|
||||
required OrderType orderType,
|
||||
Delivery? delivery,
|
||||
Table? table,
|
||||
@Default(false) bool isLoading,
|
||||
}) = _CheckoutFormState;
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -7,6 +8,7 @@ import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../common/types/order_type.dart';
|
||||
import '../../../../../components/button/button.dart';
|
||||
import '../../../../../components/dialog/dialog.dart';
|
||||
import '../../../../../router/app_router.gr.dart';
|
||||
|
||||
class HomeRightTitle extends StatelessWidget {
|
||||
// final TableModel? table;
|
||||
@ -48,9 +50,17 @@ class HomeRightTitle extends StatelessWidget {
|
||||
),
|
||||
switch (state.orderType) {
|
||||
OrderType.dineIn => _buildButton(
|
||||
'Pilih Meja',
|
||||
state.table == null
|
||||
? 'Pilih Meja'
|
||||
: (state.table?.tableName ?? '-'),
|
||||
Icons.table_restaurant_outlined,
|
||||
() {},
|
||||
() {
|
||||
if (state.table != null) return;
|
||||
|
||||
context.router.navigate(
|
||||
const MainRoute(children: [TableRoute()]),
|
||||
);
|
||||
},
|
||||
),
|
||||
OrderType.takeAway => SizedBox.shrink(),
|
||||
OrderType.delivery => _buildButton(
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../application/table/table_loader/table_loader_bloc.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../../domain/table/table.dart' as t;
|
||||
import '../../../../../router/app_router.gr.dart';
|
||||
|
||||
class TableFloatingBottomNavbar extends StatelessWidget {
|
||||
final t.Table? selectedTable;
|
||||
@ -115,13 +118,16 @@ class TableFloatingBottomNavbar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (selectedTable?.status.isAvailable ?? false) {
|
||||
// context.pushReplacement(
|
||||
// DashboardPage(
|
||||
// table: selectedTable!,
|
||||
// items: widget.items,
|
||||
// ),
|
||||
// );
|
||||
if (selectedTable?.status.isAvailable ?? true) {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.updateTable(selectedTable),
|
||||
);
|
||||
context.read<TableLoaderBloc>().add(
|
||||
TableLoaderEvent.setSelectedTable(null),
|
||||
);
|
||||
context.router.navigate(
|
||||
const MainRoute(children: [HomeRoute()]),
|
||||
);
|
||||
} else {}
|
||||
},
|
||||
child: const Text(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user