checkout form

This commit is contained in:
efrilm
2025-10-25 02:09:47 +07:00
parent e85138f27e
commit 013f313e35
13 changed files with 1719 additions and 4 deletions
@@ -0,0 +1,14 @@
part of '../product.dart';
@freezed
class ProductQuantity with _$ProductQuantity {
const factory ProductQuantity({
required Product product,
ProductVariant? variant,
required int quantity,
String? notes,
}) = _ProductQuantity;
factory ProductQuantity.empty() =>
ProductQuantity(product: Product.empty(), quantity: 0);
}
+1
View File
@@ -7,5 +7,6 @@ import '../../common/api/api_failure.dart';
part 'product.freezed.dart';
part 'entities/product_entity.dart';
part 'entities/product_quantity_entity.dart';
part 'failures/product_failure.dart';
part 'repositories/i_product_repository.dart';
+254
View File
@@ -1092,6 +1092,260 @@ abstract class _ProductVariant implements ProductVariant {
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProductQuantity {
Product get product => throw _privateConstructorUsedError;
ProductVariant? get variant => throw _privateConstructorUsedError;
int get quantity => throw _privateConstructorUsedError;
String? get notes => throw _privateConstructorUsedError;
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProductQuantityCopyWith<ProductQuantity> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProductQuantityCopyWith<$Res> {
factory $ProductQuantityCopyWith(
ProductQuantity value,
$Res Function(ProductQuantity) then,
) = _$ProductQuantityCopyWithImpl<$Res, ProductQuantity>;
@useResult
$Res call({
Product product,
ProductVariant? variant,
int quantity,
String? notes,
});
$ProductCopyWith<$Res> get product;
$ProductVariantCopyWith<$Res>? get variant;
}
/// @nodoc
class _$ProductQuantityCopyWithImpl<$Res, $Val extends ProductQuantity>
implements $ProductQuantityCopyWith<$Res> {
_$ProductQuantityCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? product = null,
Object? variant = freezed,
Object? quantity = null,
Object? notes = freezed,
}) {
return _then(
_value.copyWith(
product: null == product
? _value.product
: product // ignore: cast_nullable_to_non_nullable
as Product,
variant: freezed == variant
? _value.variant
: variant // ignore: cast_nullable_to_non_nullable
as ProductVariant?,
quantity: null == quantity
? _value.quantity
: quantity // ignore: cast_nullable_to_non_nullable
as int,
notes: freezed == notes
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
}
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ProductCopyWith<$Res> get product {
return $ProductCopyWith<$Res>(_value.product, (value) {
return _then(_value.copyWith(product: value) as $Val);
});
}
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ProductVariantCopyWith<$Res>? get variant {
if (_value.variant == null) {
return null;
}
return $ProductVariantCopyWith<$Res>(_value.variant!, (value) {
return _then(_value.copyWith(variant: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$ProductQuantityImplCopyWith<$Res>
implements $ProductQuantityCopyWith<$Res> {
factory _$$ProductQuantityImplCopyWith(
_$ProductQuantityImpl value,
$Res Function(_$ProductQuantityImpl) then,
) = __$$ProductQuantityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
Product product,
ProductVariant? variant,
int quantity,
String? notes,
});
@override
$ProductCopyWith<$Res> get product;
@override
$ProductVariantCopyWith<$Res>? get variant;
}
/// @nodoc
class __$$ProductQuantityImplCopyWithImpl<$Res>
extends _$ProductQuantityCopyWithImpl<$Res, _$ProductQuantityImpl>
implements _$$ProductQuantityImplCopyWith<$Res> {
__$$ProductQuantityImplCopyWithImpl(
_$ProductQuantityImpl _value,
$Res Function(_$ProductQuantityImpl) _then,
) : super(_value, _then);
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? product = null,
Object? variant = freezed,
Object? quantity = null,
Object? notes = freezed,
}) {
return _then(
_$ProductQuantityImpl(
product: null == product
? _value.product
: product // ignore: cast_nullable_to_non_nullable
as Product,
variant: freezed == variant
? _value.variant
: variant // ignore: cast_nullable_to_non_nullable
as ProductVariant?,
quantity: null == quantity
? _value.quantity
: quantity // ignore: cast_nullable_to_non_nullable
as int,
notes: freezed == notes
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
class _$ProductQuantityImpl
with DiagnosticableTreeMixin
implements _ProductQuantity {
const _$ProductQuantityImpl({
required this.product,
this.variant,
required this.quantity,
this.notes,
});
@override
final Product product;
@override
final ProductVariant? variant;
@override
final int quantity;
@override
final String? notes;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'ProductQuantity(product: $product, variant: $variant, quantity: $quantity, notes: $notes)';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'ProductQuantity'))
..add(DiagnosticsProperty('product', product))
..add(DiagnosticsProperty('variant', variant))
..add(DiagnosticsProperty('quantity', quantity))
..add(DiagnosticsProperty('notes', notes));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProductQuantityImpl &&
(identical(other.product, product) || other.product == product) &&
(identical(other.variant, variant) || other.variant == variant) &&
(identical(other.quantity, quantity) ||
other.quantity == quantity) &&
(identical(other.notes, notes) || other.notes == notes));
}
@override
int get hashCode =>
Object.hash(runtimeType, product, variant, quantity, notes);
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProductQuantityImplCopyWith<_$ProductQuantityImpl> get copyWith =>
__$$ProductQuantityImplCopyWithImpl<_$ProductQuantityImpl>(
this,
_$identity,
);
}
abstract class _ProductQuantity implements ProductQuantity {
const factory _ProductQuantity({
required final Product product,
final ProductVariant? variant,
required final int quantity,
final String? notes,
}) = _$ProductQuantityImpl;
@override
Product get product;
@override
ProductVariant? get variant;
@override
int get quantity;
@override
String? get notes;
/// Create a copy of ProductQuantity
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProductQuantityImplCopyWith<_$ProductQuantityImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProductFailure {
@optionalTypeArgs