EnakPoint & EnakCoin wallet, PIN, outlet, order, community, reward
- Wallet EnakPoint & EnakCoin: beranda, riwayat, saldo kedaluwarsa, kode bayar, tukar EnakCoin, transfer - PIN (buat, ganti, lupa), outlet, riwayat order, game spin - Halaman community, webview, coming soon, dan ikon menu beranda baru - Redesign Reward Saya: kartu tiket, filter chip, detail kode + QR - Hapus customer point loader, menu, dan checkout lama - Base URL ke enaklo-pos-api.altru.id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5954510b93
commit
f5e3075205
@@ -0,0 +1,44 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/wallet/wallet.dart';
|
||||
|
||||
part 'payment_code_form_event.dart';
|
||||
part 'payment_code_form_state.dart';
|
||||
part 'payment_code_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class PaymentCodeFormBloc
|
||||
extends Bloc<PaymentCodeFormEvent, PaymentCodeFormState> {
|
||||
final IWalletRepository _repository;
|
||||
|
||||
PaymentCodeFormBloc(this._repository)
|
||||
: super(PaymentCodeFormState.initial()) {
|
||||
on<PaymentCodeFormEvent>(_onPaymentCodeFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onPaymentCodeFormEvent(
|
||||
PaymentCodeFormEvent event,
|
||||
Emitter<PaymentCodeFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
submitted: (e) async {
|
||||
emit(state.copyWith(isSubmitting: true, failureOption: none()));
|
||||
|
||||
final result = await _repository.createPaymentCode(pin: e.pin);
|
||||
|
||||
emit(
|
||||
result
|
||||
.fold(
|
||||
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||
(code) => state.copyWith(paymentCode: code),
|
||||
)
|
||||
.copyWith(isSubmitting: false),
|
||||
);
|
||||
},
|
||||
expired: (e) async => emit(state.copyWith(paymentCode: null)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,575 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package
|
||||
// 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 'payment_code_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PaymentCodeFormEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentCodeFormEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentCodeFormEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $PaymentCodeFormEventCopyWith<$Res> {
|
||||
$PaymentCodeFormEventCopyWith(PaymentCodeFormEvent _, $Res Function(PaymentCodeFormEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentCodeFormEvent].
|
||||
extension PaymentCodeFormEventPatterns on PaymentCodeFormEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Submitted value)? submitted,TResult Function( _Expired value)? expired,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted() when submitted != null:
|
||||
return submitted(_that);case _Expired() when expired != null:
|
||||
return expired(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Submitted value) submitted,required TResult Function( _Expired value) expired,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted():
|
||||
return submitted(_that);case _Expired():
|
||||
return expired(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Submitted value)? submitted,TResult? Function( _Expired value)? expired,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted() when submitted != null:
|
||||
return submitted(_that);case _Expired() when expired != null:
|
||||
return expired(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( String pin)? submitted,TResult Function()? expired,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted() when submitted != null:
|
||||
return submitted(_that.pin);case _Expired() when expired != null:
|
||||
return expired();case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( String pin) submitted,required TResult Function() expired,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted():
|
||||
return submitted(_that.pin);case _Expired():
|
||||
return expired();case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( String pin)? submitted,TResult? Function()? expired,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Submitted() when submitted != null:
|
||||
return submitted(_that.pin);case _Expired() when expired != null:
|
||||
return expired();case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Submitted implements PaymentCodeFormEvent {
|
||||
const _Submitted(this.pin);
|
||||
|
||||
|
||||
final String pin;
|
||||
|
||||
/// Create a copy of PaymentCodeFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SubmittedCopyWith<_Submitted> get copyWith => __$SubmittedCopyWithImpl<_Submitted>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Submitted&&(identical(other.pin, pin) || other.pin == pin));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(runtimeType,pin);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentCodeFormEvent.submitted(pin: $pin)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SubmittedCopyWith<$Res> implements $PaymentCodeFormEventCopyWith<$Res> {
|
||||
factory _$SubmittedCopyWith(_Submitted value, $Res Function(_Submitted) _then) = __$SubmittedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String pin
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$SubmittedCopyWithImpl<$Res>
|
||||
implements _$SubmittedCopyWith<$Res> {
|
||||
__$SubmittedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Submitted _self;
|
||||
final $Res Function(_Submitted) _then;
|
||||
|
||||
/// Create a copy of PaymentCodeFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? pin = null,}) {
|
||||
return _then(_Submitted(
|
||||
null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Expired implements PaymentCodeFormEvent {
|
||||
const _Expired();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Expired);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentCodeFormEvent.expired()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentCodeFormState {
|
||||
|
||||
PaymentCode? get paymentCode; Option<WalletFailure> get failureOption; bool get isSubmitting;
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentCodeFormStateCopyWith<PaymentCodeFormState> get copyWith => _$PaymentCodeFormStateCopyWithImpl<PaymentCodeFormState>(this as PaymentCodeFormState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
final _this = this as PaymentCodeFormState;
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentCodeFormState&&(identical(other.paymentCode, _this.paymentCode) || other.paymentCode == _this.paymentCode)&&(identical(other.failureOption, _this.failureOption) || other.failureOption == _this.failureOption)&&(identical(other.isSubmitting, _this.isSubmitting) || other.isSubmitting == _this.isSubmitting));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
final _this = this as PaymentCodeFormState;
|
||||
return Object.hash(runtimeType,_this.paymentCode,_this.failureOption,_this.isSubmitting);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final _this = this as PaymentCodeFormState;
|
||||
return 'PaymentCodeFormState(paymentCode: ${_this.paymentCode}, failureOption: ${_this.failureOption}, isSubmitting: ${_this.isSubmitting})';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentCodeFormStateCopyWith<$Res> {
|
||||
factory $PaymentCodeFormStateCopyWith(PaymentCodeFormState value, $Res Function(PaymentCodeFormState) _then) = _$PaymentCodeFormStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
PaymentCode? paymentCode, Option<WalletFailure> failureOption, bool isSubmitting
|
||||
});
|
||||
|
||||
|
||||
$PaymentCodeCopyWith<$Res>? get paymentCode;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentCodeFormStateCopyWithImpl<$Res>
|
||||
implements $PaymentCodeFormStateCopyWith<$Res> {
|
||||
_$PaymentCodeFormStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentCodeFormState _self;
|
||||
final $Res Function(PaymentCodeFormState) _then;
|
||||
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? paymentCode = freezed,Object? failureOption = null,Object? isSubmitting = null,}) {
|
||||
return _then(PaymentCodeFormState(
|
||||
paymentCode: freezed == paymentCode ? _self.paymentCode : paymentCode // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentCode?,failureOption: null == failureOption ? _self.failureOption : failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<WalletFailure>,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentCodeCopyWith<$Res>? get paymentCode {
|
||||
if (_self.paymentCode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $PaymentCodeCopyWith<$Res>(_self.paymentCode!, (value) {
|
||||
return _then(_self.copyWith(paymentCode: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentCodeFormState].
|
||||
extension PaymentCodeFormStatePatterns on PaymentCodeFormState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _PaymentCodeFormState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _PaymentCodeFormState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _PaymentCodeFormState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( PaymentCode? paymentCode, Option<WalletFailure> failureOption, bool isSubmitting)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState() when $default != null:
|
||||
return $default(_that.paymentCode,_that.failureOption,_that.isSubmitting);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( PaymentCode? paymentCode, Option<WalletFailure> failureOption, bool isSubmitting) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState():
|
||||
return $default(_that.paymentCode,_that.failureOption,_that.isSubmitting);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( PaymentCode? paymentCode, Option<WalletFailure> failureOption, bool isSubmitting)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentCodeFormState() when $default != null:
|
||||
return $default(_that.paymentCode,_that.failureOption,_that.isSubmitting);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PaymentCodeFormState implements PaymentCodeFormState {
|
||||
const _PaymentCodeFormState({this.paymentCode, required this.failureOption, this.isSubmitting = false});
|
||||
|
||||
|
||||
@override final PaymentCode? paymentCode;
|
||||
@override final Option<WalletFailure> failureOption;
|
||||
@override@JsonKey() final bool isSubmitting;
|
||||
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentCodeFormStateCopyWith<_PaymentCodeFormState> get copyWith => __$PaymentCodeFormStateCopyWithImpl<_PaymentCodeFormState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentCodeFormState&&(identical(other.paymentCode, paymentCode) || other.paymentCode == paymentCode)&&(identical(other.failureOption, failureOption) || other.failureOption == failureOption)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(runtimeType,paymentCode,failureOption,isSubmitting);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentCodeFormState(paymentCode: $paymentCode, failureOption: $failureOption, isSubmitting: $isSubmitting)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentCodeFormStateCopyWith<$Res> implements $PaymentCodeFormStateCopyWith<$Res> {
|
||||
factory _$PaymentCodeFormStateCopyWith(_PaymentCodeFormState value, $Res Function(_PaymentCodeFormState) _then) = __$PaymentCodeFormStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
PaymentCode? paymentCode, Option<WalletFailure> failureOption, bool isSubmitting
|
||||
});
|
||||
|
||||
|
||||
@override $PaymentCodeCopyWith<$Res>? get paymentCode;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentCodeFormStateCopyWithImpl<$Res>
|
||||
implements _$PaymentCodeFormStateCopyWith<$Res> {
|
||||
__$PaymentCodeFormStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentCodeFormState _self;
|
||||
final $Res Function(_PaymentCodeFormState) _then;
|
||||
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? paymentCode = freezed,Object? failureOption = null,Object? isSubmitting = null,}) {
|
||||
return _then(_PaymentCodeFormState(
|
||||
paymentCode: freezed == paymentCode ? _self.paymentCode : paymentCode // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentCode?,failureOption: null == failureOption ? _self.failureOption : failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<WalletFailure>,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of PaymentCodeFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentCodeCopyWith<$Res>? get paymentCode {
|
||||
if (_self.paymentCode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $PaymentCodeCopyWith<$Res>(_self.paymentCode!, (value) {
|
||||
return _then(_self.copyWith(paymentCode: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,9 @@
|
||||
part of 'payment_code_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PaymentCodeFormEvent with _$PaymentCodeFormEvent {
|
||||
/// [pin] hanya diteruskan ke API, tidak disimpan di state.
|
||||
const factory PaymentCodeFormEvent.submitted(String pin) = _Submitted;
|
||||
|
||||
const factory PaymentCodeFormEvent.expired() = _Expired;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
part of 'payment_code_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PaymentCodeFormState with _$PaymentCodeFormState {
|
||||
const factory PaymentCodeFormState({
|
||||
PaymentCode? paymentCode,
|
||||
required Option<WalletFailure> failureOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
}) = _PaymentCodeFormState;
|
||||
|
||||
factory PaymentCodeFormState.initial() =>
|
||||
PaymentCodeFormState(failureOption: none());
|
||||
}
|
||||
Reference in New Issue
Block a user