checkout page

This commit is contained in:
efrilm
2025-10-27 15:27:21 +07:00
parent 9e5a6cc7ae
commit b8eefcbac0
11 changed files with 1234 additions and 77 deletions
@@ -0,0 +1,34 @@
import 'package:bloc/bloc.dart';
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/customer/customer.dart';
import '../../../domain/payment_method/payment_method.dart';
part 'order_form_event.dart';
part 'order_form_state.dart';
part 'order_form_bloc.freezed.dart';
@injectable
class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
OrderFormBloc() : super(OrderFormState.initial()) {
on<OrderFormEvent>(_onOrderFormBloc);
}
Future<void> _onOrderFormBloc(
OrderFormEvent event,
Emitter<OrderFormState> emit,
) {
return event.map(
customerNameChanged: (e) async {
emit(state.copyWith(customerName: e.customerName));
},
paymentMethodChanged: (e) async {
emit(state.copyWith(paymentMethod: e.payment));
},
customerChanged: (e) async {
emit(state.copyWith(customer: e.customer));
},
);
}
}
@@ -0,0 +1,832 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'order_form_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$OrderFormEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String customerName) customerNameChanged,
required TResult Function(PaymentMethod payment) paymentMethodChanged,
required TResult Function(Customer? customer) customerChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String customerName)? customerNameChanged,
TResult? Function(PaymentMethod payment)? paymentMethodChanged,
TResult? Function(Customer? customer)? customerChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String customerName)? customerNameChanged,
TResult Function(PaymentMethod payment)? paymentMethodChanged,
TResult Function(Customer? customer)? customerChanged,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_CustomerNameChanged value) customerNameChanged,
required TResult Function(_PaymentMethodChanged value) paymentMethodChanged,
required TResult Function(_CustomeChanged value) customerChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
TResult? Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult? Function(_CustomeChanged value)? customerChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_CustomerNameChanged value)? customerNameChanged,
TResult Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult Function(_CustomeChanged value)? customerChanged,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OrderFormEventCopyWith<$Res> {
factory $OrderFormEventCopyWith(
OrderFormEvent value,
$Res Function(OrderFormEvent) then,
) = _$OrderFormEventCopyWithImpl<$Res, OrderFormEvent>;
}
/// @nodoc
class _$OrderFormEventCopyWithImpl<$Res, $Val extends OrderFormEvent>
implements $OrderFormEventCopyWith<$Res> {
_$OrderFormEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$CustomerNameChangedImplCopyWith<$Res> {
factory _$$CustomerNameChangedImplCopyWith(
_$CustomerNameChangedImpl value,
$Res Function(_$CustomerNameChangedImpl) then,
) = __$$CustomerNameChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String customerName});
}
/// @nodoc
class __$$CustomerNameChangedImplCopyWithImpl<$Res>
extends _$OrderFormEventCopyWithImpl<$Res, _$CustomerNameChangedImpl>
implements _$$CustomerNameChangedImplCopyWith<$Res> {
__$$CustomerNameChangedImplCopyWithImpl(
_$CustomerNameChangedImpl _value,
$Res Function(_$CustomerNameChangedImpl) _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? customerName = null}) {
return _then(
_$CustomerNameChangedImpl(
null == customerName
? _value.customerName
: customerName // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
}
/// @nodoc
class _$CustomerNameChangedImpl
with DiagnosticableTreeMixin
implements _CustomerNameChanged {
const _$CustomerNameChangedImpl(this.customerName);
@override
final String customerName;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'OrderFormEvent.customerNameChanged(customerName: $customerName)';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'OrderFormEvent.customerNameChanged'))
..add(DiagnosticsProperty('customerName', customerName));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CustomerNameChangedImpl &&
(identical(other.customerName, customerName) ||
other.customerName == customerName));
}
@override
int get hashCode => Object.hash(runtimeType, customerName);
/// 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')
_$$CustomerNameChangedImplCopyWith<_$CustomerNameChangedImpl> get copyWith =>
__$$CustomerNameChangedImplCopyWithImpl<_$CustomerNameChangedImpl>(
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,
}) {
return customerNameChanged(customerName);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String customerName)? customerNameChanged,
TResult? Function(PaymentMethod payment)? paymentMethodChanged,
TResult? Function(Customer? customer)? customerChanged,
}) {
return customerNameChanged?.call(customerName);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String customerName)? customerNameChanged,
TResult Function(PaymentMethod payment)? paymentMethodChanged,
TResult Function(Customer? customer)? customerChanged,
required TResult orElse(),
}) {
if (customerNameChanged != null) {
return customerNameChanged(customerName);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_CustomerNameChanged value) customerNameChanged,
required TResult Function(_PaymentMethodChanged value) paymentMethodChanged,
required TResult Function(_CustomeChanged value) customerChanged,
}) {
return customerNameChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
TResult? Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult? Function(_CustomeChanged value)? customerChanged,
}) {
return customerNameChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_CustomerNameChanged value)? customerNameChanged,
TResult Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult Function(_CustomeChanged value)? customerChanged,
required TResult orElse(),
}) {
if (customerNameChanged != null) {
return customerNameChanged(this);
}
return orElse();
}
}
abstract class _CustomerNameChanged implements OrderFormEvent {
const factory _CustomerNameChanged(final String customerName) =
_$CustomerNameChangedImpl;
String get customerName;
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CustomerNameChangedImplCopyWith<_$CustomerNameChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentMethodChangedImplCopyWith<$Res> {
factory _$$PaymentMethodChangedImplCopyWith(
_$PaymentMethodChangedImpl value,
$Res Function(_$PaymentMethodChangedImpl) then,
) = __$$PaymentMethodChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({PaymentMethod payment});
$PaymentMethodCopyWith<$Res> get payment;
}
/// @nodoc
class __$$PaymentMethodChangedImplCopyWithImpl<$Res>
extends _$OrderFormEventCopyWithImpl<$Res, _$PaymentMethodChangedImpl>
implements _$$PaymentMethodChangedImplCopyWith<$Res> {
__$$PaymentMethodChangedImplCopyWithImpl(
_$PaymentMethodChangedImpl _value,
$Res Function(_$PaymentMethodChangedImpl) _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? payment = null}) {
return _then(
_$PaymentMethodChangedImpl(
null == payment
? _value.payment
: payment // ignore: cast_nullable_to_non_nullable
as PaymentMethod,
),
);
}
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PaymentMethodCopyWith<$Res> get payment {
return $PaymentMethodCopyWith<$Res>(_value.payment, (value) {
return _then(_value.copyWith(payment: value));
});
}
}
/// @nodoc
class _$PaymentMethodChangedImpl
with DiagnosticableTreeMixin
implements _PaymentMethodChanged {
const _$PaymentMethodChangedImpl(this.payment);
@override
final PaymentMethod payment;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'OrderFormEvent.paymentMethodChanged(payment: $payment)';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'OrderFormEvent.paymentMethodChanged'))
..add(DiagnosticsProperty('payment', payment));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentMethodChangedImpl &&
(identical(other.payment, payment) || other.payment == payment));
}
@override
int get hashCode => Object.hash(runtimeType, payment);
/// 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')
_$$PaymentMethodChangedImplCopyWith<_$PaymentMethodChangedImpl>
get copyWith =>
__$$PaymentMethodChangedImplCopyWithImpl<_$PaymentMethodChangedImpl>(
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,
}) {
return paymentMethodChanged(payment);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String customerName)? customerNameChanged,
TResult? Function(PaymentMethod payment)? paymentMethodChanged,
TResult? Function(Customer? customer)? customerChanged,
}) {
return paymentMethodChanged?.call(payment);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String customerName)? customerNameChanged,
TResult Function(PaymentMethod payment)? paymentMethodChanged,
TResult Function(Customer? customer)? customerChanged,
required TResult orElse(),
}) {
if (paymentMethodChanged != null) {
return paymentMethodChanged(payment);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_CustomerNameChanged value) customerNameChanged,
required TResult Function(_PaymentMethodChanged value) paymentMethodChanged,
required TResult Function(_CustomeChanged value) customerChanged,
}) {
return paymentMethodChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
TResult? Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult? Function(_CustomeChanged value)? customerChanged,
}) {
return paymentMethodChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_CustomerNameChanged value)? customerNameChanged,
TResult Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult Function(_CustomeChanged value)? customerChanged,
required TResult orElse(),
}) {
if (paymentMethodChanged != null) {
return paymentMethodChanged(this);
}
return orElse();
}
}
abstract class _PaymentMethodChanged implements OrderFormEvent {
const factory _PaymentMethodChanged(final PaymentMethod payment) =
_$PaymentMethodChangedImpl;
PaymentMethod get payment;
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PaymentMethodChangedImplCopyWith<_$PaymentMethodChangedImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$CustomeChangedImplCopyWith<$Res> {
factory _$$CustomeChangedImplCopyWith(
_$CustomeChangedImpl value,
$Res Function(_$CustomeChangedImpl) then,
) = __$$CustomeChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({Customer? customer});
$CustomerCopyWith<$Res>? get customer;
}
/// @nodoc
class __$$CustomeChangedImplCopyWithImpl<$Res>
extends _$OrderFormEventCopyWithImpl<$Res, _$CustomeChangedImpl>
implements _$$CustomeChangedImplCopyWith<$Res> {
__$$CustomeChangedImplCopyWithImpl(
_$CustomeChangedImpl _value,
$Res Function(_$CustomeChangedImpl) _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? customer = freezed}) {
return _then(
_$CustomeChangedImpl(
freezed == customer
? _value.customer
: customer // ignore: cast_nullable_to_non_nullable
as Customer?,
),
);
}
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$CustomerCopyWith<$Res>? get customer {
if (_value.customer == null) {
return null;
}
return $CustomerCopyWith<$Res>(_value.customer!, (value) {
return _then(_value.copyWith(customer: value));
});
}
}
/// @nodoc
class _$CustomeChangedImpl
with DiagnosticableTreeMixin
implements _CustomeChanged {
const _$CustomeChangedImpl(this.customer);
@override
final Customer? customer;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'OrderFormEvent.customerChanged(customer: $customer)';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'OrderFormEvent.customerChanged'))
..add(DiagnosticsProperty('customer', customer));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CustomeChangedImpl &&
(identical(other.customer, customer) ||
other.customer == customer));
}
@override
int get hashCode => Object.hash(runtimeType, customer);
/// 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')
_$$CustomeChangedImplCopyWith<_$CustomeChangedImpl> get copyWith =>
__$$CustomeChangedImplCopyWithImpl<_$CustomeChangedImpl>(
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,
}) {
return customerChanged(customer);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String customerName)? customerNameChanged,
TResult? Function(PaymentMethod payment)? paymentMethodChanged,
TResult? Function(Customer? customer)? customerChanged,
}) {
return customerChanged?.call(customer);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String customerName)? customerNameChanged,
TResult Function(PaymentMethod payment)? paymentMethodChanged,
TResult Function(Customer? customer)? customerChanged,
required TResult orElse(),
}) {
if (customerChanged != null) {
return customerChanged(customer);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_CustomerNameChanged value) customerNameChanged,
required TResult Function(_PaymentMethodChanged value) paymentMethodChanged,
required TResult Function(_CustomeChanged value) customerChanged,
}) {
return customerChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
TResult? Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult? Function(_CustomeChanged value)? customerChanged,
}) {
return customerChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_CustomerNameChanged value)? customerNameChanged,
TResult Function(_PaymentMethodChanged value)? paymentMethodChanged,
TResult Function(_CustomeChanged value)? customerChanged,
required TResult orElse(),
}) {
if (customerChanged != null) {
return customerChanged(this);
}
return orElse();
}
}
abstract class _CustomeChanged implements OrderFormEvent {
const factory _CustomeChanged(final Customer? customer) =
_$CustomeChangedImpl;
Customer? get customer;
/// Create a copy of OrderFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CustomeChangedImplCopyWith<_$CustomeChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$OrderFormState {
PaymentMethod? get paymentMethod => throw _privateConstructorUsedError;
String? get customerName => throw _privateConstructorUsedError;
Customer? get customer => throw _privateConstructorUsedError;
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OrderFormStateCopyWith<OrderFormState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OrderFormStateCopyWith<$Res> {
factory $OrderFormStateCopyWith(
OrderFormState value,
$Res Function(OrderFormState) then,
) = _$OrderFormStateCopyWithImpl<$Res, OrderFormState>;
@useResult
$Res call({
PaymentMethod? paymentMethod,
String? customerName,
Customer? customer,
});
$PaymentMethodCopyWith<$Res>? get paymentMethod;
$CustomerCopyWith<$Res>? get customer;
}
/// @nodoc
class _$OrderFormStateCopyWithImpl<$Res, $Val extends OrderFormState>
implements $OrderFormStateCopyWith<$Res> {
_$OrderFormStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentMethod = freezed,
Object? customerName = freezed,
Object? customer = freezed,
}) {
return _then(
_value.copyWith(
paymentMethod: freezed == paymentMethod
? _value.paymentMethod
: paymentMethod // ignore: cast_nullable_to_non_nullable
as PaymentMethod?,
customerName: freezed == customerName
? _value.customerName
: customerName // ignore: cast_nullable_to_non_nullable
as String?,
customer: freezed == customer
? _value.customer
: customer // ignore: cast_nullable_to_non_nullable
as Customer?,
)
as $Val,
);
}
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PaymentMethodCopyWith<$Res>? get paymentMethod {
if (_value.paymentMethod == null) {
return null;
}
return $PaymentMethodCopyWith<$Res>(_value.paymentMethod!, (value) {
return _then(_value.copyWith(paymentMethod: value) as $Val);
});
}
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$CustomerCopyWith<$Res>? get customer {
if (_value.customer == null) {
return null;
}
return $CustomerCopyWith<$Res>(_value.customer!, (value) {
return _then(_value.copyWith(customer: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$OrderFormStateImplCopyWith<$Res>
implements $OrderFormStateCopyWith<$Res> {
factory _$$OrderFormStateImplCopyWith(
_$OrderFormStateImpl value,
$Res Function(_$OrderFormStateImpl) then,
) = __$$OrderFormStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
PaymentMethod? paymentMethod,
String? customerName,
Customer? customer,
});
@override
$PaymentMethodCopyWith<$Res>? get paymentMethod;
@override
$CustomerCopyWith<$Res>? get customer;
}
/// @nodoc
class __$$OrderFormStateImplCopyWithImpl<$Res>
extends _$OrderFormStateCopyWithImpl<$Res, _$OrderFormStateImpl>
implements _$$OrderFormStateImplCopyWith<$Res> {
__$$OrderFormStateImplCopyWithImpl(
_$OrderFormStateImpl _value,
$Res Function(_$OrderFormStateImpl) _then,
) : super(_value, _then);
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? paymentMethod = freezed,
Object? customerName = freezed,
Object? customer = freezed,
}) {
return _then(
_$OrderFormStateImpl(
paymentMethod: freezed == paymentMethod
? _value.paymentMethod
: paymentMethod // ignore: cast_nullable_to_non_nullable
as PaymentMethod?,
customerName: freezed == customerName
? _value.customerName
: customerName // ignore: cast_nullable_to_non_nullable
as String?,
customer: freezed == customer
? _value.customer
: customer // ignore: cast_nullable_to_non_nullable
as Customer?,
),
);
}
}
/// @nodoc
class _$OrderFormStateImpl
with DiagnosticableTreeMixin
implements _OrderFormState {
_$OrderFormStateImpl({this.paymentMethod, this.customerName, this.customer});
@override
final PaymentMethod? paymentMethod;
@override
final String? customerName;
@override
final Customer? customer;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'OrderFormState(paymentMethod: $paymentMethod, customerName: $customerName, customer: $customer)';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'OrderFormState'))
..add(DiagnosticsProperty('paymentMethod', paymentMethod))
..add(DiagnosticsProperty('customerName', customerName))
..add(DiagnosticsProperty('customer', customer));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OrderFormStateImpl &&
(identical(other.paymentMethod, paymentMethod) ||
other.paymentMethod == paymentMethod) &&
(identical(other.customerName, customerName) ||
other.customerName == customerName) &&
(identical(other.customer, customer) ||
other.customer == customer));
}
@override
int get hashCode =>
Object.hash(runtimeType, paymentMethod, customerName, customer);
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OrderFormStateImplCopyWith<_$OrderFormStateImpl> get copyWith =>
__$$OrderFormStateImplCopyWithImpl<_$OrderFormStateImpl>(
this,
_$identity,
);
}
abstract class _OrderFormState implements OrderFormState {
factory _OrderFormState({
final PaymentMethod? paymentMethod,
final String? customerName,
final Customer? customer,
}) = _$OrderFormStateImpl;
@override
PaymentMethod? get paymentMethod;
@override
String? get customerName;
@override
Customer? get customer;
/// Create a copy of OrderFormState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OrderFormStateImplCopyWith<_$OrderFormStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,11 @@
part of 'order_form_bloc.dart';
@freezed
class OrderFormEvent with _$OrderFormEvent {
const factory OrderFormEvent.customerNameChanged(String customerName) =
_CustomerNameChanged;
const factory OrderFormEvent.paymentMethodChanged(PaymentMethod payment) =
_PaymentMethodChanged;
const factory OrderFormEvent.customerChanged(Customer? customer) =
_CustomeChanged;
}
@@ -0,0 +1,12 @@
part of 'order_form_bloc.dart';
@freezed
class OrderFormState with _$OrderFormState {
factory OrderFormState({
PaymentMethod? paymentMethod,
String? customerName,
Customer? customer,
}) = _OrderFormState;
factory OrderFormState.initial() => OrderFormState();
}