Success Split Bill Page
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart' hide Order;
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@@ -89,6 +91,8 @@ class PaymentFormBloc extends Bloc<PaymentFormEvent, PaymentFormState> {
|
||||
.toList(),
|
||||
);
|
||||
|
||||
log(request.toString());
|
||||
|
||||
failureOrPayment = await _repository.createSplitBill(request);
|
||||
|
||||
emit(
|
||||
|
||||
@@ -20,7 +20,7 @@ mixin _$SplitBillFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -29,7 +29,7 @@ mixin _$SplitBillFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -38,7 +38,7 @@ mixin _$SplitBillFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -180,7 +180,7 @@ class _$SetOrderImpl implements _SetOrder {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -193,7 +193,7 @@ class _$SetOrderImpl implements _SetOrder {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -206,7 +206,7 @@ class _$SetOrderImpl implements _SetOrder {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -282,9 +282,9 @@ abstract class _$$CustomerChangedImplCopyWith<$Res> {
|
||||
$Res Function(_$CustomerChangedImpl) then,
|
||||
) = __$$CustomerChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Customer customer});
|
||||
$Res call({Customer? customer});
|
||||
|
||||
$CustomerCopyWith<$Res> get customer;
|
||||
$CustomerCopyWith<$Res>? get customer;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -300,13 +300,13 @@ class __$$CustomerChangedImplCopyWithImpl<$Res>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? customer = null}) {
|
||||
$Res call({Object? customer = freezed}) {
|
||||
return _then(
|
||||
_$CustomerChangedImpl(
|
||||
null == customer
|
||||
freezed == customer
|
||||
? _value.customer
|
||||
: customer // ignore: cast_nullable_to_non_nullable
|
||||
as Customer,
|
||||
as Customer?,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -315,8 +315,12 @@ class __$$CustomerChangedImplCopyWithImpl<$Res>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$CustomerCopyWith<$Res> get customer {
|
||||
return $CustomerCopyWith<$Res>(_value.customer, (value) {
|
||||
$CustomerCopyWith<$Res>? get customer {
|
||||
if (_value.customer == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $CustomerCopyWith<$Res>(_value.customer!, (value) {
|
||||
return _then(_value.copyWith(customer: value));
|
||||
});
|
||||
}
|
||||
@@ -328,7 +332,7 @@ class _$CustomerChangedImpl implements _CustomerChanged {
|
||||
const _$CustomerChangedImpl(this.customer);
|
||||
|
||||
@override
|
||||
final Customer customer;
|
||||
final Customer? customer;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -362,7 +366,7 @@ class _$CustomerChangedImpl implements _CustomerChanged {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -375,7 +379,7 @@ class _$CustomerChangedImpl implements _CustomerChanged {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -388,7 +392,7 @@ class _$CustomerChangedImpl implements _CustomerChanged {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -446,10 +450,10 @@ class _$CustomerChangedImpl implements _CustomerChanged {
|
||||
}
|
||||
|
||||
abstract class _CustomerChanged implements SplitBillFormEvent {
|
||||
const factory _CustomerChanged(final Customer customer) =
|
||||
const factory _CustomerChanged(final Customer? customer) =
|
||||
_$CustomerChangedImpl;
|
||||
|
||||
Customer get customer;
|
||||
Customer? get customer;
|
||||
|
||||
/// Create a copy of SplitBillFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -533,7 +537,7 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -546,7 +550,7 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -559,7 +563,7 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -704,7 +708,7 @@ class _$SplitTypeChangedImpl implements _SplitTypeChanged {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -717,7 +721,7 @@ class _$SplitTypeChangedImpl implements _SplitTypeChanged {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -730,7 +734,7 @@ class _$SplitTypeChangedImpl implements _SplitTypeChanged {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -885,7 +889,7 @@ class _$ItemQuantityChangedImpl implements _ItemQuantityChanged {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -898,7 +902,7 @@ class _$ItemQuantityChangedImpl implements _ItemQuantityChanged {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -911,7 +915,7 @@ class _$ItemQuantityChangedImpl implements _ItemQuantityChanged {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -1055,7 +1059,7 @@ class _$AmountChangedImpl implements _AmountChanged {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(Order order) setOrder,
|
||||
required TResult Function(Customer customer) customerChanged,
|
||||
required TResult Function(Customer? customer) customerChanged,
|
||||
required TResult Function(String customerName) customerNameChanged,
|
||||
required TResult Function(SplitType splitType) splitTypeChanged,
|
||||
required TResult Function(String itemId, int quantity) itemQuantityChanged,
|
||||
@@ -1068,7 +1072,7 @@ class _$AmountChangedImpl implements _AmountChanged {
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(Order order)? setOrder,
|
||||
TResult? Function(Customer customer)? customerChanged,
|
||||
TResult? Function(Customer? customer)? customerChanged,
|
||||
TResult? Function(String customerName)? customerNameChanged,
|
||||
TResult? Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult? Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
@@ -1081,7 +1085,7 @@ class _$AmountChangedImpl implements _AmountChanged {
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(Order order)? setOrder,
|
||||
TResult Function(Customer customer)? customerChanged,
|
||||
TResult Function(Customer? customer)? customerChanged,
|
||||
TResult Function(String customerName)? customerNameChanged,
|
||||
TResult Function(SplitType splitType)? splitTypeChanged,
|
||||
TResult Function(String itemId, int quantity)? itemQuantityChanged,
|
||||
|
||||
@@ -3,7 +3,7 @@ part of 'split_bill_form_bloc.dart';
|
||||
@freezed
|
||||
class SplitBillFormEvent with _$SplitBillFormEvent {
|
||||
const factory SplitBillFormEvent.setOrder(Order order) = _SetOrder;
|
||||
const factory SplitBillFormEvent.customerChanged(Customer customer) =
|
||||
const factory SplitBillFormEvent.customerChanged(Customer? customer) =
|
||||
_CustomerChanged;
|
||||
const factory SplitBillFormEvent.customerNameChanged(String customerName) =
|
||||
_CustomerNameChanged;
|
||||
|
||||
Reference in New Issue
Block a user