add items order
This commit is contained in:
parent
0693411cf7
commit
adc90a90a0
@ -2,10 +2,11 @@ import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:injectable/injectable.dart' hide Order;
|
||||
|
||||
import '../../../common/types/order_type.dart';
|
||||
import '../../../domain/delivery/delivery.dart';
|
||||
import '../../../domain/order/order.dart';
|
||||
import '../../../domain/product/product.dart';
|
||||
import '../../../domain/table/table.dart';
|
||||
|
||||
@ -176,6 +177,9 @@ class CheckoutFormBloc extends Bloc<CheckoutFormEvent, CheckoutFormState> {
|
||||
updateTable: (e) async {
|
||||
emit(state.copyWith(table: e.table));
|
||||
},
|
||||
orderAddedItems: (e) async {
|
||||
emit(state.copyWith(orderAdded: e.order));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ mixin _$CheckoutFormEvent {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
@ -37,6 +38,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
@ -47,6 +49,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -58,6 +61,7 @@ mixin _$CheckoutFormEvent {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
@ -68,6 +72,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
@ -78,6 +83,7 @@ mixin _$CheckoutFormEvent {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -188,6 +194,7 @@ class _$StartedImpl implements _Started {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return started(items);
|
||||
}
|
||||
@ -202,6 +209,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return started?.call(items);
|
||||
}
|
||||
@ -216,6 +224,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -234,6 +243,7 @@ class _$StartedImpl implements _Started {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
@ -248,6 +258,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
@ -262,6 +273,7 @@ class _$StartedImpl implements _Started {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
@ -395,6 +407,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return addItem(product, variant);
|
||||
}
|
||||
@ -409,6 +422,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return addItem?.call(product, variant);
|
||||
}
|
||||
@ -423,6 +437,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -441,6 +456,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return addItem(this);
|
||||
}
|
||||
@ -455,6 +471,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return addItem?.call(this);
|
||||
}
|
||||
@ -469,6 +486,7 @@ class _$AddItemImpl implements _AddItem {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItem != null) {
|
||||
@ -604,6 +622,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return removeItem(product, variant);
|
||||
}
|
||||
@ -618,6 +637,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return removeItem?.call(product, variant);
|
||||
}
|
||||
@ -632,6 +652,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -650,6 +671,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return removeItem(this);
|
||||
}
|
||||
@ -664,6 +686,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return removeItem?.call(this);
|
||||
}
|
||||
@ -678,6 +701,7 @@ class _$RemoveItemImpl implements _RemoveItem {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (removeItem != null) {
|
||||
@ -803,6 +827,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return updateItemNotes(product, notes);
|
||||
}
|
||||
@ -817,6 +842,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return updateItemNotes?.call(product, notes);
|
||||
}
|
||||
@ -831,6 +857,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -849,6 +876,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return updateItemNotes(this);
|
||||
}
|
||||
@ -863,6 +891,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return updateItemNotes?.call(this);
|
||||
}
|
||||
@ -877,6 +906,7 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateItemNotes != null) {
|
||||
@ -982,6 +1012,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return updateOrderType(orderType);
|
||||
}
|
||||
@ -996,6 +1027,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return updateOrderType?.call(orderType);
|
||||
}
|
||||
@ -1010,6 +1042,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -1028,6 +1061,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return updateOrderType(this);
|
||||
}
|
||||
@ -1042,6 +1076,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return updateOrderType?.call(this);
|
||||
}
|
||||
@ -1056,6 +1091,7 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateOrderType != null) {
|
||||
@ -1160,6 +1196,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return updateDelivery(delivery);
|
||||
}
|
||||
@ -1174,6 +1211,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return updateDelivery?.call(delivery);
|
||||
}
|
||||
@ -1188,6 +1226,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
@ -1206,6 +1245,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return updateDelivery(this);
|
||||
}
|
||||
@ -1220,6 +1260,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return updateDelivery?.call(this);
|
||||
}
|
||||
@ -1234,6 +1275,7 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateDelivery != null) {
|
||||
@ -1349,6 +1391,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
required TResult Function(OrderType orderType) updateOrderType,
|
||||
required TResult Function(Delivery delivery) updateDelivery,
|
||||
required TResult Function(Table? table) updateTable,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return updateTable(table);
|
||||
}
|
||||
@ -1363,6 +1406,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
TResult? Function(OrderType orderType)? updateOrderType,
|
||||
TResult? Function(Delivery delivery)? updateDelivery,
|
||||
TResult? Function(Table? table)? updateTable,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return updateTable?.call(table);
|
||||
}
|
||||
@ -1377,6 +1421,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
TResult Function(OrderType orderType)? updateOrderType,
|
||||
TResult Function(Delivery delivery)? updateDelivery,
|
||||
TResult Function(Table? table)? updateTable,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateTable != null) {
|
||||
@ -1395,6 +1440,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
required TResult Function(_UpdateOrderType value) updateOrderType,
|
||||
required TResult Function(_UpdateDelivery value) updateDelivery,
|
||||
required TResult Function(_UpdateTable value) updateTable,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return updateTable(this);
|
||||
}
|
||||
@ -1409,6 +1455,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
TResult? Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult? Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult? Function(_UpdateTable value)? updateTable,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return updateTable?.call(this);
|
||||
}
|
||||
@ -1423,6 +1470,7 @@ class _$UpdateTableImpl implements _UpdateTable {
|
||||
TResult Function(_UpdateOrderType value)? updateOrderType,
|
||||
TResult Function(_UpdateDelivery value)? updateDelivery,
|
||||
TResult Function(_UpdateTable value)? updateTable,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (updateTable != null) {
|
||||
@ -1444,8 +1492,191 @@ abstract class _UpdateTable implements CheckoutFormEvent {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$OrderAddedItemsImplCopyWith<$Res> {
|
||||
factory _$$OrderAddedItemsImplCopyWith(
|
||||
_$OrderAddedItemsImpl value,
|
||||
$Res Function(_$OrderAddedItemsImpl) then,
|
||||
) = __$$OrderAddedItemsImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Order? order});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$OrderAddedItemsImplCopyWithImpl<$Res>
|
||||
extends _$CheckoutFormEventCopyWithImpl<$Res, _$OrderAddedItemsImpl>
|
||||
implements _$$OrderAddedItemsImplCopyWith<$Res> {
|
||||
__$$OrderAddedItemsImplCopyWithImpl(
|
||||
_$OrderAddedItemsImpl _value,
|
||||
$Res Function(_$OrderAddedItemsImpl) _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? order = freezed}) {
|
||||
return _then(
|
||||
_$OrderAddedItemsImpl(
|
||||
freezed == order
|
||||
? _value.order
|
||||
: order // ignore: cast_nullable_to_non_nullable
|
||||
as Order?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$OrderAddedItemsImpl implements _OrderAddedItems {
|
||||
const _$OrderAddedItemsImpl(this.order);
|
||||
|
||||
@override
|
||||
final Order? order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckoutFormEvent.orderAddedItems(order: $order)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$OrderAddedItemsImpl &&
|
||||
(identical(other.order, order) || other.order == order));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, order);
|
||||
|
||||
/// 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')
|
||||
_$$OrderAddedItemsImplCopyWith<_$OrderAddedItemsImpl> get copyWith =>
|
||||
__$$OrderAddedItemsImplCopyWithImpl<_$OrderAddedItemsImpl>(
|
||||
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,
|
||||
required TResult Function(Order? order) orderAddedItems,
|
||||
}) {
|
||||
return orderAddedItems(order);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult? Function(Order? order)? orderAddedItems,
|
||||
}) {
|
||||
return orderAddedItems?.call(order);
|
||||
}
|
||||
|
||||
@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,
|
||||
TResult Function(Order? order)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (orderAddedItems != null) {
|
||||
return orderAddedItems(order);
|
||||
}
|
||||
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,
|
||||
required TResult Function(_OrderAddedItems value) orderAddedItems,
|
||||
}) {
|
||||
return orderAddedItems(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,
|
||||
TResult? Function(_OrderAddedItems value)? orderAddedItems,
|
||||
}) {
|
||||
return orderAddedItems?.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,
|
||||
TResult Function(_OrderAddedItems value)? orderAddedItems,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (orderAddedItems != null) {
|
||||
return orderAddedItems(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _OrderAddedItems implements CheckoutFormEvent {
|
||||
const factory _OrderAddedItems(final Order? order) = _$OrderAddedItemsImpl;
|
||||
|
||||
Order? get order;
|
||||
|
||||
/// Create a copy of CheckoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$OrderAddedItemsImplCopyWith<_$OrderAddedItemsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CheckoutFormState {
|
||||
Order? get orderAdded => throw _privateConstructorUsedError;
|
||||
List<ProductQuantity> get items => throw _privateConstructorUsedError;
|
||||
int get discount => throw _privateConstructorUsedError;
|
||||
int get discountAmount => throw _privateConstructorUsedError;
|
||||
@ -1474,6 +1705,7 @@ abstract class $CheckoutFormStateCopyWith<$Res> {
|
||||
) = _$CheckoutFormStateCopyWithImpl<$Res, CheckoutFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
Order? orderAdded,
|
||||
List<ProductQuantity> items,
|
||||
int discount,
|
||||
int discountAmount,
|
||||
@ -1506,6 +1738,7 @@ class _$CheckoutFormStateCopyWithImpl<$Res, $Val extends CheckoutFormState>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? orderAdded = freezed,
|
||||
Object? items = null,
|
||||
Object? discount = null,
|
||||
Object? discountAmount = null,
|
||||
@ -1521,6 +1754,10 @@ class _$CheckoutFormStateCopyWithImpl<$Res, $Val extends CheckoutFormState>
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
orderAdded: freezed == orderAdded
|
||||
? _value.orderAdded
|
||||
: orderAdded // ignore: cast_nullable_to_non_nullable
|
||||
as Order?,
|
||||
items: null == items
|
||||
? _value.items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
@ -1599,6 +1836,7 @@ abstract class _$$CheckoutFormStateImplCopyWith<$Res>
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
Order? orderAdded,
|
||||
List<ProductQuantity> items,
|
||||
int discount,
|
||||
int discountAmount,
|
||||
@ -1631,6 +1869,7 @@ class __$$CheckoutFormStateImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? orderAdded = freezed,
|
||||
Object? items = null,
|
||||
Object? discount = null,
|
||||
Object? discountAmount = null,
|
||||
@ -1646,6 +1885,10 @@ class __$$CheckoutFormStateImplCopyWithImpl<$Res>
|
||||
}) {
|
||||
return _then(
|
||||
_$CheckoutFormStateImpl(
|
||||
orderAdded: freezed == orderAdded
|
||||
? _value.orderAdded
|
||||
: orderAdded // ignore: cast_nullable_to_non_nullable
|
||||
as Order?,
|
||||
items: null == items
|
||||
? _value._items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
@ -1703,6 +1946,7 @@ class __$$CheckoutFormStateImplCopyWithImpl<$Res>
|
||||
|
||||
class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
_$CheckoutFormStateImpl({
|
||||
this.orderAdded,
|
||||
required final List<ProductQuantity> items,
|
||||
required this.discount,
|
||||
required this.discountAmount,
|
||||
@ -1717,6 +1961,8 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
this.isLoading = false,
|
||||
}) : _items = items;
|
||||
|
||||
@override
|
||||
final Order? orderAdded;
|
||||
final List<ProductQuantity> _items;
|
||||
@override
|
||||
List<ProductQuantity> get items {
|
||||
@ -1751,7 +1997,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
|
||||
@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, table: $table, isLoading: $isLoading)';
|
||||
return 'CheckoutFormState(orderAdded: $orderAdded, 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
|
||||
@ -1759,6 +2005,8 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CheckoutFormStateImpl &&
|
||||
(identical(other.orderAdded, orderAdded) ||
|
||||
other.orderAdded == orderAdded) &&
|
||||
const DeepCollectionEquality().equals(other._items, _items) &&
|
||||
(identical(other.discount, discount) ||
|
||||
other.discount == discount) &&
|
||||
@ -1785,6 +2033,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
orderAdded,
|
||||
const DeepCollectionEquality().hash(_items),
|
||||
discount,
|
||||
discountAmount,
|
||||
@ -1813,6 +2062,7 @@ class _$CheckoutFormStateImpl implements _CheckoutFormState {
|
||||
|
||||
abstract class _CheckoutFormState implements CheckoutFormState {
|
||||
factory _CheckoutFormState({
|
||||
final Order? orderAdded,
|
||||
required final List<ProductQuantity> items,
|
||||
required final int discount,
|
||||
required final int discountAmount,
|
||||
@ -1827,6 +2077,8 @@ abstract class _CheckoutFormState implements CheckoutFormState {
|
||||
final bool isLoading,
|
||||
}) = _$CheckoutFormStateImpl;
|
||||
|
||||
@override
|
||||
Order? get orderAdded;
|
||||
@override
|
||||
List<ProductQuantity> get items;
|
||||
@override
|
||||
|
||||
@ -27,4 +27,7 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
|
||||
_UpdateDelivery;
|
||||
|
||||
const factory CheckoutFormEvent.updateTable(Table? table) = _UpdateTable;
|
||||
|
||||
const factory CheckoutFormEvent.orderAddedItems(Order? order) =
|
||||
_OrderAddedItems;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ part of 'checkout_form_bloc.dart';
|
||||
@freezed
|
||||
class CheckoutFormState with _$CheckoutFormState {
|
||||
factory CheckoutFormState({
|
||||
Order? orderAdded,
|
||||
required List<ProductQuantity> items,
|
||||
required int discount,
|
||||
required int discountAmount,
|
||||
|
||||
@ -120,6 +120,40 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
||||
),
|
||||
);
|
||||
},
|
||||
addItemOrder: (e) async {
|
||||
Either<OrderFailure, Order> failureOrAddItemOrder;
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isAddingItemOrder: true,
|
||||
failureOrAddItemOrder: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final request = e.items
|
||||
.map(
|
||||
(item) => AddItemOrderRequest(
|
||||
productId: item.product.id,
|
||||
productVariantId: item.variant?.id ?? '',
|
||||
quantity: item.quantity,
|
||||
unitPrice: item.product.price.toInt(),
|
||||
notes: item.notes,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
failureOrAddItemOrder = await _repository.addItemOrder(
|
||||
id: e.orderId,
|
||||
request: request,
|
||||
);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isAddingItemOrder: false,
|
||||
failureOrAddItemOrder: optionOf(failureOrAddItemOrder),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,8 @@ mixin _$OrderFormEvent {
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
@ -52,6 +54,8 @@ mixin _$OrderFormEvent {
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
@ -70,6 +74,7 @@ mixin _$OrderFormEvent {
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
@ -80,6 +85,7 @@ mixin _$OrderFormEvent {
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
@ -88,6 +94,7 @@ mixin _$OrderFormEvent {
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
@ -96,6 +103,7 @@ mixin _$OrderFormEvent {
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -221,6 +229,8 @@ class _$CustomerNameChangedImpl
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return customerNameChanged(customerName);
|
||||
}
|
||||
@ -243,6 +253,8 @@ class _$CustomerNameChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return customerNameChanged?.call(customerName);
|
||||
}
|
||||
@ -265,6 +277,7 @@ class _$CustomerNameChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (customerNameChanged != null) {
|
||||
@ -282,6 +295,7 @@ class _$CustomerNameChangedImpl
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return customerNameChanged(this);
|
||||
}
|
||||
@ -294,6 +308,7 @@ class _$CustomerNameChangedImpl
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return customerNameChanged?.call(this);
|
||||
}
|
||||
@ -306,6 +321,7 @@ class _$CustomerNameChangedImpl
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (customerNameChanged != null) {
|
||||
@ -439,6 +455,8 @@ class _$PaymentMethodChangedImpl
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return paymentMethodChanged(payment);
|
||||
}
|
||||
@ -461,6 +479,8 @@ class _$PaymentMethodChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return paymentMethodChanged?.call(payment);
|
||||
}
|
||||
@ -483,6 +503,7 @@ class _$PaymentMethodChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (paymentMethodChanged != null) {
|
||||
@ -500,6 +521,7 @@ class _$PaymentMethodChangedImpl
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return paymentMethodChanged(this);
|
||||
}
|
||||
@ -512,6 +534,7 @@ class _$PaymentMethodChangedImpl
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return paymentMethodChanged?.call(this);
|
||||
}
|
||||
@ -524,6 +547,7 @@ class _$PaymentMethodChangedImpl
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (paymentMethodChanged != null) {
|
||||
@ -661,6 +685,8 @@ class _$CustomerChangedImpl
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return customerChanged(customer);
|
||||
}
|
||||
@ -683,6 +709,8 @@ class _$CustomerChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return customerChanged?.call(customer);
|
||||
}
|
||||
@ -705,6 +733,7 @@ class _$CustomerChangedImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (customerChanged != null) {
|
||||
@ -722,6 +751,7 @@ class _$CustomerChangedImpl
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return customerChanged(this);
|
||||
}
|
||||
@ -734,6 +764,7 @@ class _$CustomerChangedImpl
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return customerChanged?.call(this);
|
||||
}
|
||||
@ -746,6 +777,7 @@ class _$CustomerChangedImpl
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (customerChanged != null) {
|
||||
@ -921,6 +953,8 @@ class _$CreateOrderWithPaymentImpl
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return createOrderWithPayment(items, orderType, table);
|
||||
}
|
||||
@ -943,6 +977,8 @@ class _$CreateOrderWithPaymentImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return createOrderWithPayment?.call(items, orderType, table);
|
||||
}
|
||||
@ -965,6 +1001,7 @@ class _$CreateOrderWithPaymentImpl
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (createOrderWithPayment != null) {
|
||||
@ -982,6 +1019,7 @@ class _$CreateOrderWithPaymentImpl
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return createOrderWithPayment(this);
|
||||
}
|
||||
@ -994,6 +1032,7 @@ class _$CreateOrderWithPaymentImpl
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return createOrderWithPayment?.call(this);
|
||||
}
|
||||
@ -1006,6 +1045,7 @@ class _$CreateOrderWithPaymentImpl
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (createOrderWithPayment != null) {
|
||||
@ -1178,6 +1218,8 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return createOrder(items, orderType, table);
|
||||
}
|
||||
@ -1200,6 +1242,8 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return createOrder?.call(items, orderType, table);
|
||||
}
|
||||
@ -1222,6 +1266,7 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (createOrder != null) {
|
||||
@ -1239,6 +1284,7 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return createOrder(this);
|
||||
}
|
||||
@ -1251,6 +1297,7 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return createOrder?.call(this);
|
||||
}
|
||||
@ -1263,6 +1310,7 @@ class _$CreateOrderImpl with DiagnosticableTreeMixin implements _CreateOrder {
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (createOrder != null) {
|
||||
@ -1290,6 +1338,237 @@ abstract class _CreateOrder implements OrderFormEvent {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AddItemOrderImplCopyWith<$Res> {
|
||||
factory _$$AddItemOrderImplCopyWith(
|
||||
_$AddItemOrderImpl value,
|
||||
$Res Function(_$AddItemOrderImpl) then,
|
||||
) = __$$AddItemOrderImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String orderId, List<ProductQuantity> items});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AddItemOrderImplCopyWithImpl<$Res>
|
||||
extends _$OrderFormEventCopyWithImpl<$Res, _$AddItemOrderImpl>
|
||||
implements _$$AddItemOrderImplCopyWith<$Res> {
|
||||
__$$AddItemOrderImplCopyWithImpl(
|
||||
_$AddItemOrderImpl _value,
|
||||
$Res Function(_$AddItemOrderImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of OrderFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? orderId = null, Object? items = null}) {
|
||||
return _then(
|
||||
_$AddItemOrderImpl(
|
||||
orderId: null == orderId
|
||||
? _value.orderId
|
||||
: orderId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
items: null == items
|
||||
? _value._items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<ProductQuantity>,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AddItemOrderImpl with DiagnosticableTreeMixin implements _AddItemOrder {
|
||||
const _$AddItemOrderImpl({
|
||||
required this.orderId,
|
||||
required final List<ProductQuantity> items,
|
||||
}) : _items = items;
|
||||
|
||||
@override
|
||||
final String orderId;
|
||||
final List<ProductQuantity> _items;
|
||||
@override
|
||||
List<ProductQuantity> get items {
|
||||
if (_items is EqualUnmodifiableListView) return _items;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'OrderFormEvent.addItemOrder(orderId: $orderId, items: $items)';
|
||||
}
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'OrderFormEvent.addItemOrder'))
|
||||
..add(DiagnosticsProperty('orderId', orderId))
|
||||
..add(DiagnosticsProperty('items', items));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AddItemOrderImpl &&
|
||||
(identical(other.orderId, orderId) || other.orderId == orderId) &&
|
||||
const DeepCollectionEquality().equals(other._items, _items));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
orderId,
|
||||
const DeepCollectionEquality().hash(_items),
|
||||
);
|
||||
|
||||
/// Create a copy of OrderFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AddItemOrderImplCopyWith<_$AddItemOrderImpl> get copyWith =>
|
||||
__$$AddItemOrderImplCopyWithImpl<_$AddItemOrderImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(PaymentMethod payment) paymentMethodChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)
|
||||
createOrder,
|
||||
required TResult Function(String orderId, List<ProductQuantity> items)
|
||||
addItemOrder,
|
||||
}) {
|
||||
return addItemOrder(orderId, items);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(PaymentMethod payment)? paymentMethodChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)?
|
||||
createOrderWithPayment,
|
||||
TResult? Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult? Function(String orderId, List<ProductQuantity> items)?
|
||||
addItemOrder,
|
||||
}) {
|
||||
return addItemOrder?.call(orderId, items);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(PaymentMethod payment)? paymentMethodChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)?
|
||||
createOrderWithPayment,
|
||||
TResult Function(
|
||||
List<ProductQuantity> items,
|
||||
OrderType orderType,
|
||||
Table? table,
|
||||
)?
|
||||
createOrder,
|
||||
TResult Function(String orderId, List<ProductQuantity> items)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItemOrder != null) {
|
||||
return addItemOrder(orderId, items);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_CustomerNameChanged value) customerNameChanged,
|
||||
required TResult Function(_PaymentMethodChanged value) paymentMethodChanged,
|
||||
required TResult Function(_CustomerChanged value) customerChanged,
|
||||
required TResult Function(_CreateOrderWithPayment value)
|
||||
createOrderWithPayment,
|
||||
required TResult Function(_CreateOrder value) createOrder,
|
||||
required TResult Function(_AddItemOrder value) addItemOrder,
|
||||
}) {
|
||||
return addItemOrder(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
|
||||
TResult? Function(_PaymentMethodChanged value)? paymentMethodChanged,
|
||||
TResult? Function(_CustomerChanged value)? customerChanged,
|
||||
TResult? Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult? Function(_CreateOrder value)? createOrder,
|
||||
TResult? Function(_AddItemOrder value)? addItemOrder,
|
||||
}) {
|
||||
return addItemOrder?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_CustomerNameChanged value)? customerNameChanged,
|
||||
TResult Function(_PaymentMethodChanged value)? paymentMethodChanged,
|
||||
TResult Function(_CustomerChanged value)? customerChanged,
|
||||
TResult Function(_CreateOrderWithPayment value)? createOrderWithPayment,
|
||||
TResult Function(_CreateOrder value)? createOrder,
|
||||
TResult Function(_AddItemOrder value)? addItemOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (addItemOrder != null) {
|
||||
return addItemOrder(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AddItemOrder implements OrderFormEvent {
|
||||
const factory _AddItemOrder({
|
||||
required final String orderId,
|
||||
required final List<ProductQuantity> items,
|
||||
}) = _$AddItemOrderImpl;
|
||||
|
||||
String get orderId;
|
||||
List<ProductQuantity> get items;
|
||||
|
||||
/// Create a copy of OrderFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AddItemOrderImplCopyWith<_$AddItemOrderImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$OrderFormState {
|
||||
PaymentMethod? get paymentMethod => throw _privateConstructorUsedError;
|
||||
@ -1299,8 +1578,11 @@ mixin _$OrderFormState {
|
||||
throw _privateConstructorUsedError;
|
||||
Option<Either<OrderFailure, Order>> get failureOrCreateOrderWithPayment =>
|
||||
throw _privateConstructorUsedError;
|
||||
Option<Either<OrderFailure, Order>> get failureOrAddItemOrder =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isCreating => throw _privateConstructorUsedError;
|
||||
bool get isCreatingWithPayment => throw _privateConstructorUsedError;
|
||||
bool get isAddingItemOrder => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of OrderFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -1322,8 +1604,10 @@ abstract class $OrderFormStateCopyWith<$Res> {
|
||||
Customer? customer,
|
||||
Option<Either<OrderFailure, Order>> failureOrCreateOrder,
|
||||
Option<Either<OrderFailure, Order>> failureOrCreateOrderWithPayment,
|
||||
Option<Either<OrderFailure, Order>> failureOrAddItemOrder,
|
||||
bool isCreating,
|
||||
bool isCreatingWithPayment,
|
||||
bool isAddingItemOrder,
|
||||
});
|
||||
|
||||
$PaymentMethodCopyWith<$Res>? get paymentMethod;
|
||||
@ -1350,8 +1634,10 @@ class _$OrderFormStateCopyWithImpl<$Res, $Val extends OrderFormState>
|
||||
Object? customer = freezed,
|
||||
Object? failureOrCreateOrder = null,
|
||||
Object? failureOrCreateOrderWithPayment = null,
|
||||
Object? failureOrAddItemOrder = null,
|
||||
Object? isCreating = null,
|
||||
Object? isCreatingWithPayment = null,
|
||||
Object? isAddingItemOrder = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
@ -1376,6 +1662,10 @@ class _$OrderFormStateCopyWithImpl<$Res, $Val extends OrderFormState>
|
||||
? _value.failureOrCreateOrderWithPayment
|
||||
: failureOrCreateOrderWithPayment // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<OrderFailure, Order>>,
|
||||
failureOrAddItemOrder: null == failureOrAddItemOrder
|
||||
? _value.failureOrAddItemOrder
|
||||
: failureOrAddItemOrder // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<OrderFailure, Order>>,
|
||||
isCreating: null == isCreating
|
||||
? _value.isCreating
|
||||
: isCreating // ignore: cast_nullable_to_non_nullable
|
||||
@ -1384,6 +1674,10 @@ class _$OrderFormStateCopyWithImpl<$Res, $Val extends OrderFormState>
|
||||
? _value.isCreatingWithPayment
|
||||
: isCreatingWithPayment // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isAddingItemOrder: null == isAddingItemOrder
|
||||
? _value.isAddingItemOrder
|
||||
: isAddingItemOrder // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
@ -1433,8 +1727,10 @@ abstract class _$$OrderFormStateImplCopyWith<$Res>
|
||||
Customer? customer,
|
||||
Option<Either<OrderFailure, Order>> failureOrCreateOrder,
|
||||
Option<Either<OrderFailure, Order>> failureOrCreateOrderWithPayment,
|
||||
Option<Either<OrderFailure, Order>> failureOrAddItemOrder,
|
||||
bool isCreating,
|
||||
bool isCreatingWithPayment,
|
||||
bool isAddingItemOrder,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -1462,8 +1758,10 @@ class __$$OrderFormStateImplCopyWithImpl<$Res>
|
||||
Object? customer = freezed,
|
||||
Object? failureOrCreateOrder = null,
|
||||
Object? failureOrCreateOrderWithPayment = null,
|
||||
Object? failureOrAddItemOrder = null,
|
||||
Object? isCreating = null,
|
||||
Object? isCreatingWithPayment = null,
|
||||
Object? isAddingItemOrder = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$OrderFormStateImpl(
|
||||
@ -1487,6 +1785,10 @@ class __$$OrderFormStateImplCopyWithImpl<$Res>
|
||||
? _value.failureOrCreateOrderWithPayment
|
||||
: failureOrCreateOrderWithPayment // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<OrderFailure, Order>>,
|
||||
failureOrAddItemOrder: null == failureOrAddItemOrder
|
||||
? _value.failureOrAddItemOrder
|
||||
: failureOrAddItemOrder // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<OrderFailure, Order>>,
|
||||
isCreating: null == isCreating
|
||||
? _value.isCreating
|
||||
: isCreating // ignore: cast_nullable_to_non_nullable
|
||||
@ -1495,6 +1797,10 @@ class __$$OrderFormStateImplCopyWithImpl<$Res>
|
||||
? _value.isCreatingWithPayment
|
||||
: isCreatingWithPayment // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isAddingItemOrder: null == isAddingItemOrder
|
||||
? _value.isAddingItemOrder
|
||||
: isAddingItemOrder // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1511,8 +1817,10 @@ class _$OrderFormStateImpl
|
||||
this.customer,
|
||||
required this.failureOrCreateOrder,
|
||||
required this.failureOrCreateOrderWithPayment,
|
||||
required this.failureOrAddItemOrder,
|
||||
this.isCreating = false,
|
||||
this.isCreatingWithPayment = false,
|
||||
this.isAddingItemOrder = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -1526,15 +1834,20 @@ class _$OrderFormStateImpl
|
||||
@override
|
||||
final Option<Either<OrderFailure, Order>> failureOrCreateOrderWithPayment;
|
||||
@override
|
||||
final Option<Either<OrderFailure, Order>> failureOrAddItemOrder;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isCreating;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isCreatingWithPayment;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isAddingItemOrder;
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'OrderFormState(paymentMethod: $paymentMethod, customerName: $customerName, customer: $customer, failureOrCreateOrder: $failureOrCreateOrder, failureOrCreateOrderWithPayment: $failureOrCreateOrderWithPayment, isCreating: $isCreating, isCreatingWithPayment: $isCreatingWithPayment)';
|
||||
return 'OrderFormState(paymentMethod: $paymentMethod, customerName: $customerName, customer: $customer, failureOrCreateOrder: $failureOrCreateOrder, failureOrCreateOrderWithPayment: $failureOrCreateOrderWithPayment, failureOrAddItemOrder: $failureOrAddItemOrder, isCreating: $isCreating, isCreatingWithPayment: $isCreatingWithPayment, isAddingItemOrder: $isAddingItemOrder)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1552,10 +1865,10 @@ class _$OrderFormStateImpl
|
||||
failureOrCreateOrderWithPayment,
|
||||
),
|
||||
)
|
||||
..add(DiagnosticsProperty('failureOrAddItemOrder', failureOrAddItemOrder))
|
||||
..add(DiagnosticsProperty('isCreating', isCreating))
|
||||
..add(
|
||||
DiagnosticsProperty('isCreatingWithPayment', isCreatingWithPayment),
|
||||
);
|
||||
..add(DiagnosticsProperty('isCreatingWithPayment', isCreatingWithPayment))
|
||||
..add(DiagnosticsProperty('isAddingItemOrder', isAddingItemOrder));
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1577,10 +1890,14 @@ class _$OrderFormStateImpl
|
||||
) ||
|
||||
other.failureOrCreateOrderWithPayment ==
|
||||
failureOrCreateOrderWithPayment) &&
|
||||
(identical(other.failureOrAddItemOrder, failureOrAddItemOrder) ||
|
||||
other.failureOrAddItemOrder == failureOrAddItemOrder) &&
|
||||
(identical(other.isCreating, isCreating) ||
|
||||
other.isCreating == isCreating) &&
|
||||
(identical(other.isCreatingWithPayment, isCreatingWithPayment) ||
|
||||
other.isCreatingWithPayment == isCreatingWithPayment));
|
||||
other.isCreatingWithPayment == isCreatingWithPayment) &&
|
||||
(identical(other.isAddingItemOrder, isAddingItemOrder) ||
|
||||
other.isAddingItemOrder == isAddingItemOrder));
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1591,8 +1908,10 @@ class _$OrderFormStateImpl
|
||||
customer,
|
||||
failureOrCreateOrder,
|
||||
failureOrCreateOrderWithPayment,
|
||||
failureOrAddItemOrder,
|
||||
isCreating,
|
||||
isCreatingWithPayment,
|
||||
isAddingItemOrder,
|
||||
);
|
||||
|
||||
/// Create a copy of OrderFormState
|
||||
@ -1615,8 +1934,10 @@ abstract class _OrderFormState implements OrderFormState {
|
||||
required final Option<Either<OrderFailure, Order>> failureOrCreateOrder,
|
||||
required final Option<Either<OrderFailure, Order>>
|
||||
failureOrCreateOrderWithPayment,
|
||||
required final Option<Either<OrderFailure, Order>> failureOrAddItemOrder,
|
||||
final bool isCreating,
|
||||
final bool isCreatingWithPayment,
|
||||
final bool isAddingItemOrder,
|
||||
}) = _$OrderFormStateImpl;
|
||||
|
||||
@override
|
||||
@ -1630,9 +1951,13 @@ abstract class _OrderFormState implements OrderFormState {
|
||||
@override
|
||||
Option<Either<OrderFailure, Order>> get failureOrCreateOrderWithPayment;
|
||||
@override
|
||||
Option<Either<OrderFailure, Order>> get failureOrAddItemOrder;
|
||||
@override
|
||||
bool get isCreating;
|
||||
@override
|
||||
bool get isCreatingWithPayment;
|
||||
@override
|
||||
bool get isAddingItemOrder;
|
||||
|
||||
/// Create a copy of OrderFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@ -19,4 +19,9 @@ class OrderFormEvent with _$OrderFormEvent {
|
||||
required OrderType orderType,
|
||||
Table? table,
|
||||
}) = _CreateOrder;
|
||||
|
||||
const factory OrderFormEvent.addItemOrder({
|
||||
required String orderId,
|
||||
required List<ProductQuantity> items,
|
||||
}) = _AddItemOrder;
|
||||
}
|
||||
|
||||
@ -9,12 +9,15 @@ class OrderFormState with _$OrderFormState {
|
||||
required Option<Either<OrderFailure, Order>> failureOrCreateOrder,
|
||||
required Option<Either<OrderFailure, Order>>
|
||||
failureOrCreateOrderWithPayment,
|
||||
required Option<Either<OrderFailure, Order>> failureOrAddItemOrder,
|
||||
@Default(false) bool isCreating,
|
||||
@Default(false) bool isCreatingWithPayment,
|
||||
@Default(false) bool isAddingItemOrder,
|
||||
}) = _OrderFormState;
|
||||
|
||||
factory OrderFormState.initial() => OrderFormState(
|
||||
failureOrCreateOrder: none(),
|
||||
failureOrCreateOrderWithPayment: none(),
|
||||
failureOrAddItemOrder: none(),
|
||||
);
|
||||
}
|
||||
|
||||
20
lib/domain/order/entities/add_item_order_request_entity.dart
Normal file
20
lib/domain/order/entities/add_item_order_request_entity.dart
Normal file
@ -0,0 +1,20 @@
|
||||
part of '../order.dart';
|
||||
|
||||
@freezed
|
||||
class AddItemOrderRequest with _$AddItemOrderRequest {
|
||||
const factory AddItemOrderRequest({
|
||||
required String productId,
|
||||
required String productVariantId,
|
||||
required int quantity,
|
||||
required int unitPrice,
|
||||
required String notes,
|
||||
}) = _AddItemOrderRequest;
|
||||
|
||||
factory AddItemOrderRequest.empty() => AddItemOrderRequest(
|
||||
productId: '',
|
||||
productVariantId: '',
|
||||
quantity: 0,
|
||||
unitPrice: 0,
|
||||
notes: '',
|
||||
);
|
||||
}
|
||||
@ -9,5 +9,6 @@ part 'entities/order_entity.dart';
|
||||
part 'entities/order_request_entity.dart';
|
||||
part 'entities/payment_request_entity.dart';
|
||||
part 'entities/payment_entity.dart';
|
||||
part 'entities/add_item_order_request_entity.dart';
|
||||
part 'failures/order_failure.dart';
|
||||
part 'repositories/i_order_repository.dart';
|
||||
|
||||
@ -2886,6 +2886,244 @@ abstract class _Payment implements Payment {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AddItemOrderRequest {
|
||||
String get productId => throw _privateConstructorUsedError;
|
||||
String get productVariantId => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
int get unitPrice => throw _privateConstructorUsedError;
|
||||
String get notes => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of AddItemOrderRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$AddItemOrderRequestCopyWith<AddItemOrderRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AddItemOrderRequestCopyWith<$Res> {
|
||||
factory $AddItemOrderRequestCopyWith(
|
||||
AddItemOrderRequest value,
|
||||
$Res Function(AddItemOrderRequest) then,
|
||||
) = _$AddItemOrderRequestCopyWithImpl<$Res, AddItemOrderRequest>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String productId,
|
||||
String productVariantId,
|
||||
int quantity,
|
||||
int unitPrice,
|
||||
String notes,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AddItemOrderRequestCopyWithImpl<$Res, $Val extends AddItemOrderRequest>
|
||||
implements $AddItemOrderRequestCopyWith<$Res> {
|
||||
_$AddItemOrderRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AddItemOrderRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productId = null,
|
||||
Object? productVariantId = null,
|
||||
Object? quantity = null,
|
||||
Object? unitPrice = null,
|
||||
Object? notes = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
productId: null == productId
|
||||
? _value.productId
|
||||
: productId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
productVariantId: null == productVariantId
|
||||
? _value.productVariantId
|
||||
: productVariantId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
unitPrice: null == unitPrice
|
||||
? _value.unitPrice
|
||||
: unitPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
notes: null == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AddItemOrderRequestImplCopyWith<$Res>
|
||||
implements $AddItemOrderRequestCopyWith<$Res> {
|
||||
factory _$$AddItemOrderRequestImplCopyWith(
|
||||
_$AddItemOrderRequestImpl value,
|
||||
$Res Function(_$AddItemOrderRequestImpl) then,
|
||||
) = __$$AddItemOrderRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String productId,
|
||||
String productVariantId,
|
||||
int quantity,
|
||||
int unitPrice,
|
||||
String notes,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AddItemOrderRequestImplCopyWithImpl<$Res>
|
||||
extends _$AddItemOrderRequestCopyWithImpl<$Res, _$AddItemOrderRequestImpl>
|
||||
implements _$$AddItemOrderRequestImplCopyWith<$Res> {
|
||||
__$$AddItemOrderRequestImplCopyWithImpl(
|
||||
_$AddItemOrderRequestImpl _value,
|
||||
$Res Function(_$AddItemOrderRequestImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AddItemOrderRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productId = null,
|
||||
Object? productVariantId = null,
|
||||
Object? quantity = null,
|
||||
Object? unitPrice = null,
|
||||
Object? notes = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$AddItemOrderRequestImpl(
|
||||
productId: null == productId
|
||||
? _value.productId
|
||||
: productId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
productVariantId: null == productVariantId
|
||||
? _value.productVariantId
|
||||
: productVariantId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
unitPrice: null == unitPrice
|
||||
? _value.unitPrice
|
||||
: unitPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
notes: null == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AddItemOrderRequestImpl implements _AddItemOrderRequest {
|
||||
const _$AddItemOrderRequestImpl({
|
||||
required this.productId,
|
||||
required this.productVariantId,
|
||||
required this.quantity,
|
||||
required this.unitPrice,
|
||||
required this.notes,
|
||||
});
|
||||
|
||||
@override
|
||||
final String productId;
|
||||
@override
|
||||
final String productVariantId;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final int unitPrice;
|
||||
@override
|
||||
final String notes;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AddItemOrderRequest(productId: $productId, productVariantId: $productVariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AddItemOrderRequestImpl &&
|
||||
(identical(other.productId, productId) ||
|
||||
other.productId == productId) &&
|
||||
(identical(other.productVariantId, productVariantId) ||
|
||||
other.productVariantId == productVariantId) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.unitPrice, unitPrice) ||
|
||||
other.unitPrice == unitPrice) &&
|
||||
(identical(other.notes, notes) || other.notes == notes));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
productId,
|
||||
productVariantId,
|
||||
quantity,
|
||||
unitPrice,
|
||||
notes,
|
||||
);
|
||||
|
||||
/// Create a copy of AddItemOrderRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AddItemOrderRequestImplCopyWith<_$AddItemOrderRequestImpl> get copyWith =>
|
||||
__$$AddItemOrderRequestImplCopyWithImpl<_$AddItemOrderRequestImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _AddItemOrderRequest implements AddItemOrderRequest {
|
||||
const factory _AddItemOrderRequest({
|
||||
required final String productId,
|
||||
required final String productVariantId,
|
||||
required final int quantity,
|
||||
required final int unitPrice,
|
||||
required final String notes,
|
||||
}) = _$AddItemOrderRequestImpl;
|
||||
|
||||
@override
|
||||
String get productId;
|
||||
@override
|
||||
String get productVariantId;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
int get unitPrice;
|
||||
@override
|
||||
String get notes;
|
||||
|
||||
/// Create a copy of AddItemOrderRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AddItemOrderRequestImplCopyWith<_$AddItemOrderRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$OrderFailure {
|
||||
@optionalTypeArgs
|
||||
|
||||
@ -20,4 +20,9 @@ abstract class IOrderRepository {
|
||||
required OrderRequest request,
|
||||
required String paymentMethodId,
|
||||
});
|
||||
|
||||
Future<Either<OrderFailure, Order>> addItemOrder({
|
||||
required String id,
|
||||
required List<AddItemOrderRequest> request,
|
||||
});
|
||||
}
|
||||
|
||||
@ -173,4 +173,33 @@ class OrderRemoteDataProvider {
|
||||
return DC.error(OrderFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
|
||||
Future<DC<OrderFailure, OrderDto>> addItemOrder({
|
||||
required String id,
|
||||
required List<AddItemOrderRequestDto> request,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
'${ApiPath.orders}/$id/add-items',
|
||||
data: {
|
||||
'notes': '',
|
||||
'order_items': request.map((e) => e.toRequest()).toList(),
|
||||
},
|
||||
headers: getAuthorizationHeader(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final order = OrderDto.fromJson(
|
||||
response.data['data'] as Map<String, dynamic>,
|
||||
);
|
||||
|
||||
return DC.data(order);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('addItemOrderError', name: _logName, error: e, stackTrace: s);
|
||||
return DC.error(OrderFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
part of '../order_dtos.dart';
|
||||
|
||||
@freezed
|
||||
class AddItemOrderRequestDto with _$AddItemOrderRequestDto {
|
||||
const AddItemOrderRequestDto._();
|
||||
|
||||
const factory AddItemOrderRequestDto({
|
||||
@JsonKey(name: 'product_id') String? productId,
|
||||
@JsonKey(name: 'product_variant_id') String? productvariantId,
|
||||
@JsonKey(name: 'quantity') int? quantity,
|
||||
@JsonKey(name: 'unit_price') int? unitPrice,
|
||||
@JsonKey(name: 'notes') String? notes,
|
||||
}) = _AddItemOrderRequestDto;
|
||||
|
||||
factory AddItemOrderRequestDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$AddItemOrderRequestDtoFromJson(json);
|
||||
|
||||
AddItemOrderRequest toDomain() => AddItemOrderRequest(
|
||||
productId: productId ?? '',
|
||||
productVariantId: productvariantId ?? '',
|
||||
quantity: quantity ?? 0,
|
||||
unitPrice: unitPrice ?? 0,
|
||||
notes: notes ?? '',
|
||||
);
|
||||
|
||||
factory AddItemOrderRequestDto.fromDomain(
|
||||
AddItemOrderRequest addItemOrderRequest,
|
||||
) => AddItemOrderRequestDto(
|
||||
productId: addItemOrderRequest.productId,
|
||||
productvariantId: addItemOrderRequest.productVariantId,
|
||||
quantity: addItemOrderRequest.quantity,
|
||||
unitPrice: addItemOrderRequest.unitPrice,
|
||||
notes: addItemOrderRequest.notes,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toRequest() {
|
||||
Map<String, dynamic> data = {
|
||||
'product_id': productId,
|
||||
'quantity': quantity,
|
||||
'unit_price': unitPrice,
|
||||
'notes': notes,
|
||||
};
|
||||
|
||||
if (productvariantId != null && productvariantId != '') {
|
||||
data['product_variant_id'] = productvariantId;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -9,3 +9,4 @@ part 'dtos/order_dto.dart';
|
||||
part 'dtos/order_request_dto.dart';
|
||||
part 'dtos/payment_request_dto.dart';
|
||||
part 'dtos/payment_dto.dart';
|
||||
part 'dtos/add_item_order_request_dto.dart';
|
||||
|
||||
@ -3353,3 +3353,283 @@ abstract class _PaymentOrderDto extends PaymentDto {
|
||||
_$$PaymentOrderDtoImplCopyWith<_$PaymentOrderDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
AddItemOrderRequestDto _$AddItemOrderRequestDtoFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) {
|
||||
return _AddItemOrderRequestDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AddItemOrderRequestDto {
|
||||
@JsonKey(name: 'product_id')
|
||||
String? get productId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'product_variant_id')
|
||||
String? get productvariantId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'quantity')
|
||||
int? get quantity => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'unit_price')
|
||||
int? get unitPrice => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'notes')
|
||||
String? get notes => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this AddItemOrderRequestDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of AddItemOrderRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$AddItemOrderRequestDtoCopyWith<AddItemOrderRequestDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AddItemOrderRequestDtoCopyWith<$Res> {
|
||||
factory $AddItemOrderRequestDtoCopyWith(
|
||||
AddItemOrderRequestDto value,
|
||||
$Res Function(AddItemOrderRequestDto) then,
|
||||
) = _$AddItemOrderRequestDtoCopyWithImpl<$Res, AddItemOrderRequestDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'product_id') String? productId,
|
||||
@JsonKey(name: 'product_variant_id') String? productvariantId,
|
||||
@JsonKey(name: 'quantity') int? quantity,
|
||||
@JsonKey(name: 'unit_price') int? unitPrice,
|
||||
@JsonKey(name: 'notes') String? notes,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AddItemOrderRequestDtoCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends AddItemOrderRequestDto
|
||||
>
|
||||
implements $AddItemOrderRequestDtoCopyWith<$Res> {
|
||||
_$AddItemOrderRequestDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AddItemOrderRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productId = freezed,
|
||||
Object? productvariantId = freezed,
|
||||
Object? quantity = freezed,
|
||||
Object? unitPrice = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
productId: freezed == productId
|
||||
? _value.productId
|
||||
: productId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
productvariantId: freezed == productvariantId
|
||||
? _value.productvariantId
|
||||
: productvariantId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
quantity: freezed == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
unitPrice: freezed == unitPrice
|
||||
? _value.unitPrice
|
||||
: unitPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AddItemOrderRequestDtoImplCopyWith<$Res>
|
||||
implements $AddItemOrderRequestDtoCopyWith<$Res> {
|
||||
factory _$$AddItemOrderRequestDtoImplCopyWith(
|
||||
_$AddItemOrderRequestDtoImpl value,
|
||||
$Res Function(_$AddItemOrderRequestDtoImpl) then,
|
||||
) = __$$AddItemOrderRequestDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'product_id') String? productId,
|
||||
@JsonKey(name: 'product_variant_id') String? productvariantId,
|
||||
@JsonKey(name: 'quantity') int? quantity,
|
||||
@JsonKey(name: 'unit_price') int? unitPrice,
|
||||
@JsonKey(name: 'notes') String? notes,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AddItemOrderRequestDtoImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$AddItemOrderRequestDtoCopyWithImpl<$Res, _$AddItemOrderRequestDtoImpl>
|
||||
implements _$$AddItemOrderRequestDtoImplCopyWith<$Res> {
|
||||
__$$AddItemOrderRequestDtoImplCopyWithImpl(
|
||||
_$AddItemOrderRequestDtoImpl _value,
|
||||
$Res Function(_$AddItemOrderRequestDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AddItemOrderRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productId = freezed,
|
||||
Object? productvariantId = freezed,
|
||||
Object? quantity = freezed,
|
||||
Object? unitPrice = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$AddItemOrderRequestDtoImpl(
|
||||
productId: freezed == productId
|
||||
? _value.productId
|
||||
: productId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
productvariantId: freezed == productvariantId
|
||||
? _value.productvariantId
|
||||
: productvariantId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
quantity: freezed == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
unitPrice: freezed == unitPrice
|
||||
? _value.unitPrice
|
||||
: unitPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AddItemOrderRequestDtoImpl extends _AddItemOrderRequestDto {
|
||||
const _$AddItemOrderRequestDtoImpl({
|
||||
@JsonKey(name: 'product_id') this.productId,
|
||||
@JsonKey(name: 'product_variant_id') this.productvariantId,
|
||||
@JsonKey(name: 'quantity') this.quantity,
|
||||
@JsonKey(name: 'unit_price') this.unitPrice,
|
||||
@JsonKey(name: 'notes') this.notes,
|
||||
}) : super._();
|
||||
|
||||
factory _$AddItemOrderRequestDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AddItemOrderRequestDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'product_id')
|
||||
final String? productId;
|
||||
@override
|
||||
@JsonKey(name: 'product_variant_id')
|
||||
final String? productvariantId;
|
||||
@override
|
||||
@JsonKey(name: 'quantity')
|
||||
final int? quantity;
|
||||
@override
|
||||
@JsonKey(name: 'unit_price')
|
||||
final int? unitPrice;
|
||||
@override
|
||||
@JsonKey(name: 'notes')
|
||||
final String? notes;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AddItemOrderRequestDto(productId: $productId, productvariantId: $productvariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AddItemOrderRequestDtoImpl &&
|
||||
(identical(other.productId, productId) ||
|
||||
other.productId == productId) &&
|
||||
(identical(other.productvariantId, productvariantId) ||
|
||||
other.productvariantId == productvariantId) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.unitPrice, unitPrice) ||
|
||||
other.unitPrice == unitPrice) &&
|
||||
(identical(other.notes, notes) || other.notes == notes));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
productId,
|
||||
productvariantId,
|
||||
quantity,
|
||||
unitPrice,
|
||||
notes,
|
||||
);
|
||||
|
||||
/// Create a copy of AddItemOrderRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AddItemOrderRequestDtoImplCopyWith<_$AddItemOrderRequestDtoImpl>
|
||||
get copyWith =>
|
||||
__$$AddItemOrderRequestDtoImplCopyWithImpl<_$AddItemOrderRequestDtoImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AddItemOrderRequestDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AddItemOrderRequestDto extends AddItemOrderRequestDto {
|
||||
const factory _AddItemOrderRequestDto({
|
||||
@JsonKey(name: 'product_id') final String? productId,
|
||||
@JsonKey(name: 'product_variant_id') final String? productvariantId,
|
||||
@JsonKey(name: 'quantity') final int? quantity,
|
||||
@JsonKey(name: 'unit_price') final int? unitPrice,
|
||||
@JsonKey(name: 'notes') final String? notes,
|
||||
}) = _$AddItemOrderRequestDtoImpl;
|
||||
const _AddItemOrderRequestDto._() : super._();
|
||||
|
||||
factory _AddItemOrderRequestDto.fromJson(Map<String, dynamic> json) =
|
||||
_$AddItemOrderRequestDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'product_id')
|
||||
String? get productId;
|
||||
@override
|
||||
@JsonKey(name: 'product_variant_id')
|
||||
String? get productvariantId;
|
||||
@override
|
||||
@JsonKey(name: 'quantity')
|
||||
int? get quantity;
|
||||
@override
|
||||
@JsonKey(name: 'unit_price')
|
||||
int? get unitPrice;
|
||||
@override
|
||||
@JsonKey(name: 'notes')
|
||||
String? get notes;
|
||||
|
||||
/// Create a copy of AddItemOrderRequestDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AddItemOrderRequestDtoImplCopyWith<_$AddItemOrderRequestDtoImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@ -257,3 +257,23 @@ Map<String, dynamic> _$$PaymentOrderDtoImplToJson(
|
||||
'created_at': instance.createdAt,
|
||||
'updated_at': instance.updatedAt,
|
||||
};
|
||||
|
||||
_$AddItemOrderRequestDtoImpl _$$AddItemOrderRequestDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$AddItemOrderRequestDtoImpl(
|
||||
productId: json['product_id'] as String?,
|
||||
productvariantId: json['product_variant_id'] as String?,
|
||||
quantity: (json['quantity'] as num?)?.toInt(),
|
||||
unitPrice: (json['unit_price'] as num?)?.toInt(),
|
||||
notes: json['notes'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AddItemOrderRequestDtoImplToJson(
|
||||
_$AddItemOrderRequestDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'product_id': instance.productId,
|
||||
'product_variant_id': instance.productvariantId,
|
||||
'quantity': instance.quantity,
|
||||
'unit_price': instance.unitPrice,
|
||||
'notes': instance.notes,
|
||||
};
|
||||
|
||||
@ -105,4 +105,29 @@ class OrderRepository implements IOrderRepository {
|
||||
return left(const OrderFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<OrderFailure, Order>> addItemOrder({
|
||||
required String id,
|
||||
required List<AddItemOrderRequest> request,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _dataProvider.addItemOrder(
|
||||
id: id,
|
||||
request: request
|
||||
.map((e) => AddItemOrderRequestDto.fromDomain(e))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final order = result.data!.toDomain();
|
||||
return right(order);
|
||||
} catch (e) {
|
||||
log('addItemOrderError', name: _logName, error: e);
|
||||
return left(const OrderFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,284 @@
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../application/order/order_form/order_form_bloc.dart';
|
||||
import '../../../../application/order/order_loader/order_loader_bloc.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/order/order.dart';
|
||||
import '../../button/button.dart';
|
||||
import '../../loader/loader_with_text.dart';
|
||||
import '../../spaces/space.dart';
|
||||
import '../dialog.dart';
|
||||
|
||||
class OrderAddItemDialog extends StatefulWidget {
|
||||
final CheckoutFormState checkoutState;
|
||||
const OrderAddItemDialog({super.key, required this.checkoutState});
|
||||
|
||||
@override
|
||||
State<OrderAddItemDialog> createState() => _OrderAddItemDialogState();
|
||||
}
|
||||
|
||||
class _OrderAddItemDialogState extends State<OrderAddItemDialog> {
|
||||
Order? selectedOrder;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<OrderLoaderBloc>().add(
|
||||
OrderLoaderEvent.fetched(status: 'pending', isRefresh: true),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomModalDialog(
|
||||
title: 'Tambah Pesanan',
|
||||
subtitle: 'Silahkan tambahkan pesanan ke pesanan yang sudah ada',
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 24.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Pilih Meja yang sudah dipesan',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SpaceHeight(8.0),
|
||||
BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
|
||||
builder: (context, state) {
|
||||
if (state.isFetching) {
|
||||
return Center(child: LoaderWithText());
|
||||
}
|
||||
|
||||
final availableOrders = state.orders;
|
||||
|
||||
if (selectedOrder == null && availableOrders.isNotEmpty) {
|
||||
selectedOrder = availableOrders.first;
|
||||
}
|
||||
|
||||
if (availableOrders.isEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.warning.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColor.warning, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
'Tidak ada meja yang tersedia. Silakan pilih opsi lain.',
|
||||
style: AppStyle.md.copyWith(color: AppColor.warning),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return DropdownSearch<Order>(
|
||||
items: state.orders,
|
||||
selectedItem: selectedOrder,
|
||||
|
||||
// Dropdown properties
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
hintText: "Pilih Meja",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey.shade600,
|
||||
fontSize: 14,
|
||||
),
|
||||
prefixIcon: Icon(
|
||||
Icons.category_outlined,
|
||||
color: Colors.grey.shade500,
|
||||
size: 20,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade300,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade300,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blue.shade400,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Popup properties
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Cari meja...",
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
menuProps: MenuProps(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 8,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
itemBuilder: (context, order, isSelected) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? Colors.blue.shade50
|
||||
: Colors.transparent,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Colors.grey.shade100,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? Colors.blue.shade600
|
||||
: Colors.grey.shade400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${order.tableNumber} - ${order.metadata['customer_name']}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.w500,
|
||||
color: isSelected
|
||||
? Colors.blue.shade700
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Icon(
|
||||
Icons.check,
|
||||
color: Colors.blue.shade600,
|
||||
size: 18,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
emptyBuilder: (context, searchEntry) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.search_off,
|
||||
color: Colors.grey.shade400,
|
||||
size: 48,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
searchEntry.isEmpty
|
||||
? "Tidak ada meja tersedia"
|
||||
: "Tidak ditemukan meja dengan '$searchEntry'",
|
||||
style: TextStyle(
|
||||
color: Colors.grey.shade600,
|
||||
fontSize: 14,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// Item as string (for search functionality)
|
||||
itemAsString: (Order order) =>
|
||||
"${order.tableNumber} - ${order.metadata['customer_name']}",
|
||||
|
||||
// Comparison function
|
||||
compareFn: (Order? item1, Order? item2) {
|
||||
return item1?.id == item2?.id;
|
||||
},
|
||||
|
||||
// On changed callback
|
||||
onChanged: (Order? selectedOrder) {
|
||||
if (selectedOrder != null) {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.orderAddedItems(selectedOrder),
|
||||
);
|
||||
setState(() {
|
||||
this.selectedOrder = selectedOrder;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Validator (optional)
|
||||
validator: (Order? value) {
|
||||
if (value == null) {
|
||||
return "Meja harus dipilih";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(16),
|
||||
BlocBuilder<OrderFormBloc, OrderFormState>(
|
||||
builder: (context, state) {
|
||||
return AppElevatedButton.filled(
|
||||
isLoading: state.isAddingItemOrder,
|
||||
onPressed: state.isAddingItemOrder
|
||||
? null
|
||||
: () {
|
||||
context.read<OrderFormBloc>().add(
|
||||
OrderFormEvent.addItemOrder(
|
||||
orderId: selectedOrder?.id ?? '',
|
||||
items: widget.checkoutState.items,
|
||||
),
|
||||
);
|
||||
},
|
||||
label: 'Simpan',
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import '../../../../common/types/order_type.dart';
|
||||
import '../../../../domain/table/table.dart';
|
||||
import '../../spaces/space.dart';
|
||||
import '../dialog.dart';
|
||||
import 'order_add_item_dialog.dart';
|
||||
import 'order_pay_later_dialog.dart';
|
||||
import 'order_save_confirm_dialog.dart';
|
||||
|
||||
@ -60,7 +61,13 @@ class OrderSaveDialog extends StatelessWidget {
|
||||
icon: Icons.shopping_cart_checkout_outlined,
|
||||
title: 'Tambahkan Pesanan',
|
||||
subtitle: 'Tambah item ke daftar pesanan',
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
OrderAddItemDialog(checkoutState: checkoutState),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -61,6 +61,22 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
});
|
||||
},
|
||||
),
|
||||
BlocListener<OrderFormBloc, OrderFormState>(
|
||||
listenWhen: (previous, current) =>
|
||||
previous.failureOrAddItemOrder != current.failureOrAddItemOrder,
|
||||
listener: (context, state) {
|
||||
state.failureOrAddItemOrder.fold(() {}, (either) {
|
||||
either.fold(
|
||||
(f) => AppFlushbar.showOrderFailureToast(context, f),
|
||||
(order) {
|
||||
if (context.mounted) {
|
||||
context.router.replace(SuccessAddItemOrderRoute());
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
child: SafeArea(
|
||||
child: Hero(
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
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 '../../../../../common/theme/theme.dart';
|
||||
import '../../../../components/spaces/space.dart';
|
||||
import 'widgets/success_add_item_order_left_panel.dart';
|
||||
import 'widgets/success_add_item_order_right_panel.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SuccessAddItemOrderPage extends StatelessWidget {
|
||||
const SuccessAddItemOrderPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.background,
|
||||
body: SafeArea(
|
||||
child: BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, checkoutState) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 35,
|
||||
child: SuccessAddItemOrderLeftPanel(
|
||||
checkoutState: checkoutState,
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
Expanded(
|
||||
flex: 65,
|
||||
child: SuccessAddItemOrderRightPanel(
|
||||
checkoutState: checkoutState,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,267 @@
|
||||
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 '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../components/button/button.dart';
|
||||
import '../../../../../components/spaces/space.dart';
|
||||
import '../../../../../router/app_router.gr.dart';
|
||||
|
||||
class SuccessAddItemOrderLeftPanel extends StatelessWidget {
|
||||
final CheckoutFormState checkoutState;
|
||||
const SuccessAddItemOrderLeftPanel({super.key, required this.checkoutState});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
AppColor.primary.withOpacity(0.1),
|
||||
AppColor.primary.withOpacity(0.05),
|
||||
],
|
||||
),
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(24),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
AppColor.primary,
|
||||
AppColor.primary.withOpacity(0.8),
|
||||
],
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primary.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.check_rounded,
|
||||
size: 48,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
Text(
|
||||
'Pesanan Berhasil!',
|
||||
style: AppStyle.h4.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
Text(
|
||||
'Pesanan telah diterima dan\nsedang diproses',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Informasi Pesanan',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SpaceHeight(24),
|
||||
_buildInfoRow(
|
||||
icon: Icons.person,
|
||||
label: 'Pemesan',
|
||||
value:
|
||||
checkoutState
|
||||
.orderAdded
|
||||
?.metadata['customer_name'] ??
|
||||
"-",
|
||||
),
|
||||
if (checkoutState.orderAdded?.payments.isNotEmpty ??
|
||||
false) ...[
|
||||
const SpaceHeight(12),
|
||||
_buildInfoRow(
|
||||
icon: Icons.wallet_outlined,
|
||||
label: 'Metode Pembayaran',
|
||||
value:
|
||||
checkoutState
|
||||
.orderAdded
|
||||
?.payments
|
||||
.first
|
||||
.paymentMethodName ??
|
||||
'-',
|
||||
),
|
||||
],
|
||||
if (checkoutState.orderAdded != null &&
|
||||
checkoutState.orderAdded?.tableNumber != "") ...[
|
||||
const SpaceHeight(12),
|
||||
_buildInfoRow(
|
||||
icon: Icons.table_restaurant_outlined,
|
||||
label: 'No. Meja',
|
||||
value: checkoutState.orderAdded?.tableNumber ?? '-',
|
||||
),
|
||||
],
|
||||
const SpaceHeight(12),
|
||||
_buildInfoRow(
|
||||
icon: Icons.access_time_rounded,
|
||||
label: 'Waktu',
|
||||
value: (DateTime.now()).toFormattedDateTime(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildBottomSection(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomSection(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.grey.shade50, Colors.white],
|
||||
),
|
||||
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(24)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Action Buttons with Modern Design
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppElevatedButton.outlined(
|
||||
onPressed: () {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.started([]),
|
||||
);
|
||||
context.router.replaceAll([const MainRoute()]);
|
||||
},
|
||||
label: "Kembali",
|
||||
),
|
||||
),
|
||||
const SpaceWidth(16),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: () {
|
||||
// onPrintRecipt(
|
||||
// context,
|
||||
// order: widget.order,
|
||||
// paymentMethod: widget.paymentMethod,
|
||||
// nominalBayar: widget.paymentMethod == "Cash"
|
||||
// ? widget.nominalBayar
|
||||
// : widget.order.totalAmount ?? 0,
|
||||
// kembalian: widget.nominalBayar -
|
||||
// (widget.order.totalAmount ?? 0),
|
||||
// productQuantity: widget.productQuantity,
|
||||
// );
|
||||
// onPrint(
|
||||
// context,
|
||||
// productQuantity: widget.productQuantity,
|
||||
// order: widget.order,
|
||||
// );
|
||||
},
|
||||
label: 'Cetak Struk',
|
||||
icon: Icon(Icons.print_rounded, color: AppColor.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required String value,
|
||||
Color? valueColor,
|
||||
bool showBadge = false,
|
||||
}) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: AppColor.primary),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
),
|
||||
if (showBadge && valueColor != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: valueColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.check_circle, size: 14, color: valueColor),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
value,
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: valueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
else
|
||||
Text(
|
||||
value,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: valueColor ?? AppColor.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,371 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../components/spaces/space.dart';
|
||||
|
||||
class SuccessAddItemOrderRightPanel extends StatelessWidget {
|
||||
final CheckoutFormState checkoutState;
|
||||
const SuccessAddItemOrderRightPanel({super.key, required this.checkoutState});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_header(),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
itemCount: checkoutState.items.length,
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildProductCard(index);
|
||||
},
|
||||
),
|
||||
),
|
||||
_buildSummaryFooter(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSummaryFooter() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.grey.shade50, Colors.white],
|
||||
),
|
||||
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(24)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Decorative Divider
|
||||
Container(
|
||||
height: 1,
|
||||
margin: const EdgeInsets.only(bottom: 20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
AppColor.primary.withOpacity(0.3),
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Subtotal Row
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.shopping_cart_outlined,
|
||||
size: 16,
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Subtotal (${checkoutState.items.length} items)',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
(checkoutState.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ?? 0)) *
|
||||
element.quantity,
|
||||
)).toString().currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SpaceHeight(16),
|
||||
|
||||
// Total Payment Row with Enhanced Styling
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
AppColor.primary.withOpacity(0.1),
|
||||
AppColor.primary.withOpacity(0.05),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: AppColor.primary.withOpacity(0.2),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.payments_rounded,
|
||||
size: 16,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
Text(
|
||||
'Total Pembayaran',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primary,
|
||||
AppColor.primary.withOpacity(0.8),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primary.withOpacity(0.3),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
(checkoutState.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ??
|
||||
0)) *
|
||||
element.quantity,
|
||||
)).toString().currencyFormatRpV2,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProductCard(int index) {
|
||||
final item = checkoutState.items[index];
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
border: Border.all(color: AppColor.border, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Enhanced Product Image
|
||||
Container(
|
||||
width: 70,
|
||||
height: 70,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primaryWithOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.restaurant_rounded,
|
||||
color: AppColor.primary,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
|
||||
const SpaceWidth(16),
|
||||
|
||||
// Product Details
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.product.name,
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SpaceHeight(6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
item.product.price.currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SpaceWidth(16),
|
||||
|
||||
// Quantity and Total
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primary,
|
||||
AppColor.primary.withOpacity(0.8),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${item.quantity}x',
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SpaceHeight(8),
|
||||
Text(
|
||||
((item.product.price.toInt() +
|
||||
(item.variant?.priceModifier.toInt() ?? 0)) *
|
||||
item.quantity)
|
||||
.toString()
|
||||
.currencyFormatRpV2,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container _header() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColor.border)),
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primary.withOpacity(0.2),
|
||||
AppColor.primary.withOpacity(0.1),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.receipt_long_rounded,
|
||||
color: AppColor.primary,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Detail Pesanan',
|
||||
style: AppStyle.xxl.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
Text(
|
||||
'Ringkasan item yang dipesan',
|
||||
style: AppStyle.md.copyWith(color: Colors.grey.shade600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColor.primary, AppColor.primary.withOpacity(0.8)],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primary.withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
'${checkoutState.items.length} Items',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ class SuccessOrderLeftPanel extends StatelessWidget {
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
SpaceWidth(24),
|
||||
SpaceHeight(16),
|
||||
Text(
|
||||
'Pesanan Berhasil!',
|
||||
style: AppStyle.h4.copyWith(
|
||||
@ -77,7 +77,7 @@ class SuccessOrderLeftPanel extends StatelessWidget {
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
SpaceHeight(12),
|
||||
Text(
|
||||
'Pesanan telah diterima dan\nsedang diproses',
|
||||
style: AppStyle.md.copyWith(
|
||||
|
||||
@ -32,5 +32,6 @@ class AppRouter extends RootStackRouter {
|
||||
// Order
|
||||
AutoRoute(page: OrderRoute.page),
|
||||
AutoRoute(page: SuccessOrderRoute.page),
|
||||
AutoRoute(page: SuccessAddItemOrderRoute.page),
|
||||
];
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:apskel_pos_flutter_v2/domain/order/order.dart' as _i15;
|
||||
import 'package:apskel_pos_flutter_v2/domain/order/order.dart' as _i16;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/auth/login/login_page.dart'
|
||||
as _i4;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/checkout/checkout_page.dart'
|
||||
@ -25,91 +25,93 @@ import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/report/repor
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/setting/setting_page.dart'
|
||||
as _i8;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/main/pages/table/table_page.dart'
|
||||
as _i12;
|
||||
as _i13;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/order_page.dart'
|
||||
as _i6;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_order/success_order_page.dart'
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_add_item_order/success_add_item_order_page.dart'
|
||||
as _i10;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/order/pages/success_order/success_order_page.dart'
|
||||
as _i11;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/splash/splash_page.dart'
|
||||
as _i9;
|
||||
import 'package:apskel_pos_flutter_v2/presentation/pages/sync/sync_page.dart'
|
||||
as _i11;
|
||||
import 'package:auto_route/auto_route.dart' as _i13;
|
||||
import 'package:flutter/material.dart' as _i14;
|
||||
as _i12;
|
||||
import 'package:auto_route/auto_route.dart' as _i14;
|
||||
import 'package:flutter/material.dart' as _i15;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.CheckoutPage]
|
||||
class CheckoutRoute extends _i13.PageRouteInfo<void> {
|
||||
const CheckoutRoute({List<_i13.PageRouteInfo>? children})
|
||||
class CheckoutRoute extends _i14.PageRouteInfo<void> {
|
||||
const CheckoutRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(CheckoutRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CheckoutRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i1.CheckoutPage());
|
||||
return _i14.WrappedRoute(child: const _i1.CheckoutPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.CustomerPage]
|
||||
class CustomerRoute extends _i13.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i13.PageRouteInfo>? children})
|
||||
class CustomerRoute extends _i14.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(CustomerRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CustomerRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i2.CustomerPage());
|
||||
return _i14.WrappedRoute(child: const _i2.CustomerPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i3.HomePage]
|
||||
class HomeRoute extends _i13.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i13.PageRouteInfo>? children})
|
||||
class HomeRoute extends _i14.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i3.HomePage());
|
||||
return _i14.WrappedRoute(child: const _i3.HomePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.LoginPage]
|
||||
class LoginRoute extends _i13.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i13.PageRouteInfo>? children})
|
||||
class LoginRoute extends _i14.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(LoginRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i4.LoginPage());
|
||||
return _i14.WrappedRoute(child: const _i4.LoginPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i5.MainPage]
|
||||
class MainRoute extends _i13.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i13.PageRouteInfo>? children})
|
||||
class MainRoute extends _i14.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(MainRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'MainRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.MainPage();
|
||||
@ -119,11 +121,11 @@ class MainRoute extends _i13.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.OrderPage]
|
||||
class OrderRoute extends _i13.PageRouteInfo<OrderRouteArgs> {
|
||||
class OrderRoute extends _i14.PageRouteInfo<OrderRouteArgs> {
|
||||
OrderRoute({
|
||||
_i14.Key? key,
|
||||
_i15.Key? key,
|
||||
required String status,
|
||||
List<_i13.PageRouteInfo>? children,
|
||||
List<_i14.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
OrderRoute.name,
|
||||
args: OrderRouteArgs(key: key, status: status),
|
||||
@ -132,11 +134,11 @@ class OrderRoute extends _i13.PageRouteInfo<OrderRouteArgs> {
|
||||
|
||||
static const String name = 'OrderRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<OrderRouteArgs>();
|
||||
return _i13.WrappedRoute(
|
||||
return _i14.WrappedRoute(
|
||||
child: _i6.OrderPage(key: args.key, status: args.status),
|
||||
);
|
||||
},
|
||||
@ -146,7 +148,7 @@ class OrderRoute extends _i13.PageRouteInfo<OrderRouteArgs> {
|
||||
class OrderRouteArgs {
|
||||
const OrderRouteArgs({this.key, required this.status});
|
||||
|
||||
final _i14.Key? key;
|
||||
final _i15.Key? key;
|
||||
|
||||
final String status;
|
||||
|
||||
@ -158,13 +160,13 @@ class OrderRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i7.ReportPage]
|
||||
class ReportRoute extends _i13.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i13.PageRouteInfo>? children})
|
||||
class ReportRoute extends _i14.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(ReportRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ReportRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i7.ReportPage();
|
||||
@ -174,13 +176,13 @@ class ReportRoute extends _i13.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i8.SettingPage]
|
||||
class SettingRoute extends _i13.PageRouteInfo<void> {
|
||||
const SettingRoute({List<_i13.PageRouteInfo>? children})
|
||||
class SettingRoute extends _i14.PageRouteInfo<void> {
|
||||
const SettingRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(SettingRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SettingRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i8.SettingPage();
|
||||
@ -190,13 +192,13 @@ class SettingRoute extends _i13.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i9.SplashPage]
|
||||
class SplashRoute extends _i13.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i13.PageRouteInfo>? children})
|
||||
class SplashRoute extends _i14.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(SplashRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.SplashPage();
|
||||
@ -205,12 +207,28 @@ class SplashRoute extends _i13.PageRouteInfo<void> {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i10.SuccessOrderPage]
|
||||
class SuccessOrderRoute extends _i13.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
/// [_i10.SuccessAddItemOrderPage]
|
||||
class SuccessAddItemOrderRoute extends _i14.PageRouteInfo<void> {
|
||||
const SuccessAddItemOrderRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(SuccessAddItemOrderRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SuccessAddItemOrderRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i10.SuccessAddItemOrderPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.SuccessOrderPage]
|
||||
class SuccessOrderRoute extends _i14.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
SuccessOrderRoute({
|
||||
_i14.Key? key,
|
||||
required _i15.Order order,
|
||||
List<_i13.PageRouteInfo>? children,
|
||||
_i15.Key? key,
|
||||
required _i16.Order order,
|
||||
List<_i14.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
SuccessOrderRoute.name,
|
||||
args: SuccessOrderRouteArgs(key: key, order: order),
|
||||
@ -219,12 +237,12 @@ class SuccessOrderRoute extends _i13.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
|
||||
static const String name = 'SuccessOrderRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<SuccessOrderRouteArgs>();
|
||||
return _i13.WrappedRoute(
|
||||
child: _i10.SuccessOrderPage(key: args.key, order: args.order),
|
||||
return _i14.WrappedRoute(
|
||||
child: _i11.SuccessOrderPage(key: args.key, order: args.order),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -233,9 +251,9 @@ class SuccessOrderRoute extends _i13.PageRouteInfo<SuccessOrderRouteArgs> {
|
||||
class SuccessOrderRouteArgs {
|
||||
const SuccessOrderRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i14.Key? key;
|
||||
final _i15.Key? key;
|
||||
|
||||
final _i15.Order order;
|
||||
final _i16.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -244,33 +262,33 @@ class SuccessOrderRouteArgs {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.SyncPage]
|
||||
class SyncRoute extends _i13.PageRouteInfo<void> {
|
||||
const SyncRoute({List<_i13.PageRouteInfo>? children})
|
||||
/// [_i12.SyncPage]
|
||||
class SyncRoute extends _i14.PageRouteInfo<void> {
|
||||
const SyncRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(SyncRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SyncRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i11.SyncPage());
|
||||
return _i14.WrappedRoute(child: const _i12.SyncPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.TablePage]
|
||||
class TableRoute extends _i13.PageRouteInfo<void> {
|
||||
const TableRoute({List<_i13.PageRouteInfo>? children})
|
||||
/// [_i13.TablePage]
|
||||
class TableRoute extends _i14.PageRouteInfo<void> {
|
||||
const TableRoute({List<_i14.PageRouteInfo>? children})
|
||||
: super(TableRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'TableRoute';
|
||||
|
||||
static _i13.PageInfo page = _i13.PageInfo(
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i13.WrappedRoute(child: const _i12.TablePage());
|
||||
return _i14.WrappedRoute(child: const _i13.TablePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user