Compare commits
No commits in common. "73918430b28bd8aef04113c12d3e335a46f944db" and "006486bc2a22f754b581c44d7a98993583253bd7" have entirely different histories.
73918430b2
...
006486bc2a
@ -1,37 +0,0 @@
|
|||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../domain/auth/auth.dart';
|
|
||||||
|
|
||||||
part 'logout_form_event.dart';
|
|
||||||
part 'logout_form_state.dart';
|
|
||||||
part 'logout_form_bloc.freezed.dart';
|
|
||||||
|
|
||||||
@injectable
|
|
||||||
class LogoutFormBloc extends Bloc<LogoutFormEvent, LogoutFormState> {
|
|
||||||
final IAuthRepository _repository;
|
|
||||||
|
|
||||||
LogoutFormBloc(this._repository) : super(LogoutFormState.initial()) {
|
|
||||||
on<LogoutFormEvent>(_onLogoutFormEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onLogoutFormEvent(
|
|
||||||
LogoutFormEvent event,
|
|
||||||
Emitter<LogoutFormState> emit,
|
|
||||||
) {
|
|
||||||
return event.map(
|
|
||||||
submitted: (e) async {
|
|
||||||
emit(state.copyWith(isSubmitting: true, failureOrAuthOption: none()));
|
|
||||||
final failureOrAuth = await _repository.logout();
|
|
||||||
emit(
|
|
||||||
state.copyWith(
|
|
||||||
isSubmitting: false,
|
|
||||||
failureOrAuthOption: optionOf(failureOrAuth),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,335 +0,0 @@
|
|||||||
// 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 'logout_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 _$LogoutFormEvent {
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() submitted,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? submitted,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? submitted,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Submitted value) submitted,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Submitted value)? submitted,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Submitted value)? submitted,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $LogoutFormEventCopyWith<$Res> {
|
|
||||||
factory $LogoutFormEventCopyWith(
|
|
||||||
LogoutFormEvent value,
|
|
||||||
$Res Function(LogoutFormEvent) then,
|
|
||||||
) = _$LogoutFormEventCopyWithImpl<$Res, LogoutFormEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$LogoutFormEventCopyWithImpl<$Res, $Val extends LogoutFormEvent>
|
|
||||||
implements $LogoutFormEventCopyWith<$Res> {
|
|
||||||
_$LogoutFormEventCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
|
||||||
factory _$$SubmittedImplCopyWith(
|
|
||||||
_$SubmittedImpl value,
|
|
||||||
$Res Function(_$SubmittedImpl) then,
|
|
||||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
|
||||||
extends _$LogoutFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
|
||||||
implements _$$SubmittedImplCopyWith<$Res> {
|
|
||||||
__$$SubmittedImplCopyWithImpl(
|
|
||||||
_$SubmittedImpl _value,
|
|
||||||
$Res Function(_$SubmittedImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$SubmittedImpl implements _Submitted {
|
|
||||||
const _$SubmittedImpl();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'LogoutFormEvent.submitted()';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => runtimeType.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() submitted,
|
|
||||||
}) {
|
|
||||||
return submitted();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? submitted,
|
|
||||||
}) {
|
|
||||||
return submitted?.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? submitted,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (submitted != null) {
|
|
||||||
return submitted();
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Submitted value) submitted,
|
|
||||||
}) {
|
|
||||||
return submitted(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Submitted value)? submitted,
|
|
||||||
}) {
|
|
||||||
return submitted?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Submitted value)? submitted,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (submitted != null) {
|
|
||||||
return submitted(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Submitted implements LogoutFormEvent {
|
|
||||||
const factory _Submitted() = _$SubmittedImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$LogoutFormState {
|
|
||||||
Option<Either<AuthFailure, Unit>> get failureOrAuthOption =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$LogoutFormStateCopyWith<LogoutFormState> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $LogoutFormStateCopyWith<$Res> {
|
|
||||||
factory $LogoutFormStateCopyWith(
|
|
||||||
LogoutFormState value,
|
|
||||||
$Res Function(LogoutFormState) then,
|
|
||||||
) = _$LogoutFormStateCopyWithImpl<$Res, LogoutFormState>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
|
||||||
bool isSubmitting,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$LogoutFormStateCopyWithImpl<$Res, $Val extends LogoutFormState>
|
|
||||||
implements $LogoutFormStateCopyWith<$Res> {
|
|
||||||
_$LogoutFormStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
failureOrAuthOption: null == failureOrAuthOption
|
|
||||||
? _value.failureOrAuthOption
|
|
||||||
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<Either<AuthFailure, Unit>>,
|
|
||||||
isSubmitting: null == isSubmitting
|
|
||||||
? _value.isSubmitting
|
|
||||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$LogoutFormStateImplCopyWith<$Res>
|
|
||||||
implements $LogoutFormStateCopyWith<$Res> {
|
|
||||||
factory _$$LogoutFormStateImplCopyWith(
|
|
||||||
_$LogoutFormStateImpl value,
|
|
||||||
$Res Function(_$LogoutFormStateImpl) then,
|
|
||||||
) = __$$LogoutFormStateImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
|
||||||
bool isSubmitting,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$LogoutFormStateImplCopyWithImpl<$Res>
|
|
||||||
extends _$LogoutFormStateCopyWithImpl<$Res, _$LogoutFormStateImpl>
|
|
||||||
implements _$$LogoutFormStateImplCopyWith<$Res> {
|
|
||||||
__$$LogoutFormStateImplCopyWithImpl(
|
|
||||||
_$LogoutFormStateImpl _value,
|
|
||||||
$Res Function(_$LogoutFormStateImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
|
||||||
return _then(
|
|
||||||
_$LogoutFormStateImpl(
|
|
||||||
failureOrAuthOption: null == failureOrAuthOption
|
|
||||||
? _value.failureOrAuthOption
|
|
||||||
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<Either<AuthFailure, Unit>>,
|
|
||||||
isSubmitting: null == isSubmitting
|
|
||||||
? _value.isSubmitting
|
|
||||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$LogoutFormStateImpl implements _LogoutFormState {
|
|
||||||
const _$LogoutFormStateImpl({
|
|
||||||
required this.failureOrAuthOption,
|
|
||||||
this.isSubmitting = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
final Option<Either<AuthFailure, Unit>> failureOrAuthOption;
|
|
||||||
@override
|
|
||||||
@JsonKey()
|
|
||||||
final bool isSubmitting;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'LogoutFormState(failureOrAuthOption: $failureOrAuthOption, isSubmitting: $isSubmitting)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$LogoutFormStateImpl &&
|
|
||||||
(identical(other.failureOrAuthOption, failureOrAuthOption) ||
|
|
||||||
other.failureOrAuthOption == failureOrAuthOption) &&
|
|
||||||
(identical(other.isSubmitting, isSubmitting) ||
|
|
||||||
other.isSubmitting == isSubmitting));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode =>
|
|
||||||
Object.hash(runtimeType, failureOrAuthOption, isSubmitting);
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
|
||||||
__$$LogoutFormStateImplCopyWithImpl<_$LogoutFormStateImpl>(
|
|
||||||
this,
|
|
||||||
_$identity,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _LogoutFormState implements LogoutFormState {
|
|
||||||
const factory _LogoutFormState({
|
|
||||||
required final Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
|
||||||
final bool isSubmitting,
|
|
||||||
}) = _$LogoutFormStateImpl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Option<Either<AuthFailure, Unit>> get failureOrAuthOption;
|
|
||||||
@override
|
|
||||||
bool get isSubmitting;
|
|
||||||
|
|
||||||
/// Create a copy of LogoutFormState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
part of 'logout_form_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class LogoutFormEvent with _$LogoutFormEvent {
|
|
||||||
const factory LogoutFormEvent.submitted() = _Submitted;
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
part of 'logout_form_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class LogoutFormState with _$LogoutFormState {
|
|
||||||
const factory LogoutFormState({
|
|
||||||
required Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
|
||||||
@Default(false) bool isSubmitting,
|
|
||||||
}) = _LogoutFormState;
|
|
||||||
|
|
||||||
factory LogoutFormState.initial() =>
|
|
||||||
LogoutFormState(failureOrAuthOption: none(), isSubmitting: false);
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../domain/customer/customer.dart';
|
|
||||||
|
|
||||||
part 'customer_point_loader_event.dart';
|
|
||||||
part 'customer_point_loader_state.dart';
|
|
||||||
part 'customer_point_loader_bloc.freezed.dart';
|
|
||||||
|
|
||||||
@injectable
|
|
||||||
class CustomerPointLoaderBloc
|
|
||||||
extends Bloc<CustomerPointLoaderEvent, CustomerPointLoaderState> {
|
|
||||||
final ICustomerRepository _repository;
|
|
||||||
CustomerPointLoaderBloc(this._repository)
|
|
||||||
: super(CustomerPointLoaderState.initial()) {
|
|
||||||
on<CustomerPointLoaderEvent>(_onCustomerPointLoaderEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onCustomerPointLoaderEvent(
|
|
||||||
CustomerPointLoaderEvent event,
|
|
||||||
Emitter<CustomerPointLoaderState> emit,
|
|
||||||
) {
|
|
||||||
return event.map(
|
|
||||||
fetched: (e) async {
|
|
||||||
emit(
|
|
||||||
state.copyWith(isFetching: true, failureOptionCustomerPoint: none()),
|
|
||||||
);
|
|
||||||
|
|
||||||
final result = await _repository.getPoints();
|
|
||||||
|
|
||||||
var data = result.fold(
|
|
||||||
(f) => state.copyWith(failureOptionCustomerPoint: optionOf(f)),
|
|
||||||
(customerPoint) => state.copyWith(customerPoint: customerPoint),
|
|
||||||
);
|
|
||||||
|
|
||||||
emit(data.copyWith(isFetching: false));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,391 +0,0 @@
|
|||||||
// 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 'customer_point_loader_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 _$CustomerPointLoaderEvent {
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Fetched value) fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Fetched value)? fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Fetched value)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerPointLoaderEventCopyWith<$Res> {
|
|
||||||
factory $CustomerPointLoaderEventCopyWith(
|
|
||||||
CustomerPointLoaderEvent value,
|
|
||||||
$Res Function(CustomerPointLoaderEvent) then,
|
|
||||||
) = _$CustomerPointLoaderEventCopyWithImpl<$Res, CustomerPointLoaderEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerPointLoaderEventCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
$Val extends CustomerPointLoaderEvent
|
|
||||||
>
|
|
||||||
implements $CustomerPointLoaderEventCopyWith<$Res> {
|
|
||||||
_$CustomerPointLoaderEventCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
|
||||||
factory _$$FetchedImplCopyWith(
|
|
||||||
_$FetchedImpl value,
|
|
||||||
$Res Function(_$FetchedImpl) then,
|
|
||||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$FetchedImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerPointLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
|
||||||
implements _$$FetchedImplCopyWith<$Res> {
|
|
||||||
__$$FetchedImplCopyWithImpl(
|
|
||||||
_$FetchedImpl _value,
|
|
||||||
$Res Function(_$FetchedImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$FetchedImpl implements _Fetched {
|
|
||||||
const _$FetchedImpl();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerPointLoaderEvent.fetched()';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => runtimeType.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
|
||||||
return fetched();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
|
||||||
return fetched?.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (fetched != null) {
|
|
||||||
return fetched();
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Fetched value) fetched,
|
|
||||||
}) {
|
|
||||||
return fetched(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Fetched value)? fetched,
|
|
||||||
}) {
|
|
||||||
return fetched?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Fetched value)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (fetched != null) {
|
|
||||||
return fetched(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Fetched implements CustomerPointLoaderEvent {
|
|
||||||
const factory _Fetched() = _$FetchedImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$CustomerPointLoaderState {
|
|
||||||
CustomerPoint get customerPoint => throw _privateConstructorUsedError;
|
|
||||||
Option<CustomerFailure> get failureOptionCustomerPoint =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
bool get isFetching => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$CustomerPointLoaderStateCopyWith<CustomerPointLoaderState> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerPointLoaderStateCopyWith<$Res> {
|
|
||||||
factory $CustomerPointLoaderStateCopyWith(
|
|
||||||
CustomerPointLoaderState value,
|
|
||||||
$Res Function(CustomerPointLoaderState) then,
|
|
||||||
) = _$CustomerPointLoaderStateCopyWithImpl<$Res, CustomerPointLoaderState>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
CustomerPoint customerPoint,
|
|
||||||
Option<CustomerFailure> failureOptionCustomerPoint,
|
|
||||||
bool isFetching,
|
|
||||||
});
|
|
||||||
|
|
||||||
$CustomerPointCopyWith<$Res> get customerPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerPointLoaderStateCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
$Val extends CustomerPointLoaderState
|
|
||||||
>
|
|
||||||
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
|
||||||
_$CustomerPointLoaderStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? customerPoint = null,
|
|
||||||
Object? failureOptionCustomerPoint = null,
|
|
||||||
Object? isFetching = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
customerPoint: null == customerPoint
|
|
||||||
? _value.customerPoint
|
|
||||||
: customerPoint // ignore: cast_nullable_to_non_nullable
|
|
||||||
as CustomerPoint,
|
|
||||||
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
|
||||||
? _value.failureOptionCustomerPoint
|
|
||||||
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<CustomerFailure>,
|
|
||||||
isFetching: null == isFetching
|
|
||||||
? _value.isFetching
|
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$CustomerPointCopyWith<$Res> get customerPoint {
|
|
||||||
return $CustomerPointCopyWith<$Res>(_value.customerPoint, (value) {
|
|
||||||
return _then(_value.copyWith(customerPoint: value) as $Val);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$CustomerPointLoaderStateImplCopyWith<$Res>
|
|
||||||
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
|
||||||
factory _$$CustomerPointLoaderStateImplCopyWith(
|
|
||||||
_$CustomerPointLoaderStateImpl value,
|
|
||||||
$Res Function(_$CustomerPointLoaderStateImpl) then,
|
|
||||||
) = __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
CustomerPoint customerPoint,
|
|
||||||
Option<CustomerFailure> failureOptionCustomerPoint,
|
|
||||||
bool isFetching,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
$CustomerPointCopyWith<$Res> get customerPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>
|
|
||||||
extends
|
|
||||||
_$CustomerPointLoaderStateCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
_$CustomerPointLoaderStateImpl
|
|
||||||
>
|
|
||||||
implements _$$CustomerPointLoaderStateImplCopyWith<$Res> {
|
|
||||||
__$$CustomerPointLoaderStateImplCopyWithImpl(
|
|
||||||
_$CustomerPointLoaderStateImpl _value,
|
|
||||||
$Res Function(_$CustomerPointLoaderStateImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? customerPoint = null,
|
|
||||||
Object? failureOptionCustomerPoint = null,
|
|
||||||
Object? isFetching = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$CustomerPointLoaderStateImpl(
|
|
||||||
customerPoint: null == customerPoint
|
|
||||||
? _value.customerPoint
|
|
||||||
: customerPoint // ignore: cast_nullable_to_non_nullable
|
|
||||||
as CustomerPoint,
|
|
||||||
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
|
||||||
? _value.failureOptionCustomerPoint
|
|
||||||
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<CustomerFailure>,
|
|
||||||
isFetching: null == isFetching
|
|
||||||
? _value.isFetching
|
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$CustomerPointLoaderStateImpl implements _CustomerPointLoaderState {
|
|
||||||
const _$CustomerPointLoaderStateImpl({
|
|
||||||
required this.customerPoint,
|
|
||||||
required this.failureOptionCustomerPoint,
|
|
||||||
this.isFetching = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
final CustomerPoint customerPoint;
|
|
||||||
@override
|
|
||||||
final Option<CustomerFailure> failureOptionCustomerPoint;
|
|
||||||
@override
|
|
||||||
@JsonKey()
|
|
||||||
final bool isFetching;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerPointLoaderState(customerPoint: $customerPoint, failureOptionCustomerPoint: $failureOptionCustomerPoint, isFetching: $isFetching)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$CustomerPointLoaderStateImpl &&
|
|
||||||
(identical(other.customerPoint, customerPoint) ||
|
|
||||||
other.customerPoint == customerPoint) &&
|
|
||||||
(identical(
|
|
||||||
other.failureOptionCustomerPoint,
|
|
||||||
failureOptionCustomerPoint,
|
|
||||||
) ||
|
|
||||||
other.failureOptionCustomerPoint ==
|
|
||||||
failureOptionCustomerPoint) &&
|
|
||||||
(identical(other.isFetching, isFetching) ||
|
|
||||||
other.isFetching == isFetching));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType,
|
|
||||||
customerPoint,
|
|
||||||
failureOptionCustomerPoint,
|
|
||||||
isFetching,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
|
||||||
get copyWith =>
|
|
||||||
__$$CustomerPointLoaderStateImplCopyWithImpl<
|
|
||||||
_$CustomerPointLoaderStateImpl
|
|
||||||
>(this, _$identity);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _CustomerPointLoaderState implements CustomerPointLoaderState {
|
|
||||||
const factory _CustomerPointLoaderState({
|
|
||||||
required final CustomerPoint customerPoint,
|
|
||||||
required final Option<CustomerFailure> failureOptionCustomerPoint,
|
|
||||||
final bool isFetching,
|
|
||||||
}) = _$CustomerPointLoaderStateImpl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
CustomerPoint get customerPoint;
|
|
||||||
@override
|
|
||||||
Option<CustomerFailure> get failureOptionCustomerPoint;
|
|
||||||
@override
|
|
||||||
bool get isFetching;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
|
||||||
get copyWith => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
part of 'customer_point_loader_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class CustomerPointLoaderEvent with _$CustomerPointLoaderEvent {
|
|
||||||
const factory CustomerPointLoaderEvent.fetched() = _Fetched;
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
part of 'customer_point_loader_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class CustomerPointLoaderState with _$CustomerPointLoaderState {
|
|
||||||
const factory CustomerPointLoaderState({
|
|
||||||
required CustomerPoint customerPoint,
|
|
||||||
required Option<CustomerFailure> failureOptionCustomerPoint,
|
|
||||||
@Default(false) bool isFetching,
|
|
||||||
}) = _CustomerPointLoaderState;
|
|
||||||
|
|
||||||
factory CustomerPointLoaderState.initial() => CustomerPointLoaderState(
|
|
||||||
customerPoint: CustomerPoint.empty(),
|
|
||||||
failureOptionCustomerPoint: none(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../domain/game/game.dart';
|
|
||||||
|
|
||||||
part 'game_prize_loader_event.dart';
|
|
||||||
part 'game_prize_loader_state.dart';
|
|
||||||
part 'game_prize_loader_bloc.freezed.dart';
|
|
||||||
|
|
||||||
@injectable
|
|
||||||
class GamePrizeLoaderBloc
|
|
||||||
extends Bloc<GamePrizeLoaderEvent, GamePrizeLoaderState> {
|
|
||||||
final IGameRepository _repository;
|
|
||||||
GamePrizeLoaderBloc(this._repository)
|
|
||||||
: super(GamePrizeLoaderState.initial()) {
|
|
||||||
on<GamePrizeLoaderEvent>(_onGamePrizeLoaderEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onGamePrizeLoaderEvent(
|
|
||||||
GamePrizeLoaderEvent event,
|
|
||||||
Emitter<GamePrizeLoaderState> emit,
|
|
||||||
) {
|
|
||||||
return event.map(
|
|
||||||
fetched: (e) async {
|
|
||||||
emit(state.copyWith(isFetching: true, failureOptionGamePrize: none()));
|
|
||||||
|
|
||||||
final result = await _repository.gamePrizeByGameId(id: e.id);
|
|
||||||
|
|
||||||
var data = result.fold(
|
|
||||||
(f) => state.copyWith(failureOptionGamePrize: optionOf(f)),
|
|
||||||
(gamePrize) => state.copyWith(gamePrize: gamePrize),
|
|
||||||
);
|
|
||||||
|
|
||||||
emit(data.copyWith(isFetching: false));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,442 +0,0 @@
|
|||||||
// 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 'game_prize_loader_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 _$GamePrizeLoaderEvent {
|
|
||||||
String get id => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(String id) fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(String id)? fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(String id)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Fetched value) fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Fetched value)? fetched,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Fetched value)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$GamePrizeLoaderEventCopyWith<GamePrizeLoaderEvent> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $GamePrizeLoaderEventCopyWith<$Res> {
|
|
||||||
factory $GamePrizeLoaderEventCopyWith(
|
|
||||||
GamePrizeLoaderEvent value,
|
|
||||||
$Res Function(GamePrizeLoaderEvent) then,
|
|
||||||
) = _$GamePrizeLoaderEventCopyWithImpl<$Res, GamePrizeLoaderEvent>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String id});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$GamePrizeLoaderEventCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
$Val extends GamePrizeLoaderEvent
|
|
||||||
>
|
|
||||||
implements $GamePrizeLoaderEventCopyWith<$Res> {
|
|
||||||
_$GamePrizeLoaderEventCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? id = null}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
id: null == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$FetchedImplCopyWith<$Res>
|
|
||||||
implements $GamePrizeLoaderEventCopyWith<$Res> {
|
|
||||||
factory _$$FetchedImplCopyWith(
|
|
||||||
_$FetchedImpl value,
|
|
||||||
$Res Function(_$FetchedImpl) then,
|
|
||||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({String id});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$FetchedImplCopyWithImpl<$Res>
|
|
||||||
extends _$GamePrizeLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
|
||||||
implements _$$FetchedImplCopyWith<$Res> {
|
|
||||||
__$$FetchedImplCopyWithImpl(
|
|
||||||
_$FetchedImpl _value,
|
|
||||||
$Res Function(_$FetchedImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? id = null}) {
|
|
||||||
return _then(
|
|
||||||
_$FetchedImpl(
|
|
||||||
null == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$FetchedImpl implements _Fetched {
|
|
||||||
const _$FetchedImpl(this.id);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GamePrizeLoaderEvent.fetched(id: $id)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$FetchedImpl &&
|
|
||||||
(identical(other.id, id) || other.id == id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, id);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
|
||||||
__$$FetchedImplCopyWithImpl<_$FetchedImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(String id) fetched,
|
|
||||||
}) {
|
|
||||||
return fetched(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(String id)? fetched,
|
|
||||||
}) {
|
|
||||||
return fetched?.call(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(String id)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (fetched != null) {
|
|
||||||
return fetched(id);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Fetched value) fetched,
|
|
||||||
}) {
|
|
||||||
return fetched(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Fetched value)? fetched,
|
|
||||||
}) {
|
|
||||||
return fetched?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Fetched value)? fetched,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (fetched != null) {
|
|
||||||
return fetched(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Fetched implements GamePrizeLoaderEvent {
|
|
||||||
const factory _Fetched(final String id) = _$FetchedImpl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get id;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderEvent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$GamePrizeLoaderState {
|
|
||||||
List<GamePrize> get gamePrize => throw _privateConstructorUsedError;
|
|
||||||
Option<GameFailure> get failureOptionGamePrize =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
bool get isFetching => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$GamePrizeLoaderStateCopyWith<GamePrizeLoaderState> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $GamePrizeLoaderStateCopyWith<$Res> {
|
|
||||||
factory $GamePrizeLoaderStateCopyWith(
|
|
||||||
GamePrizeLoaderState value,
|
|
||||||
$Res Function(GamePrizeLoaderState) then,
|
|
||||||
) = _$GamePrizeLoaderStateCopyWithImpl<$Res, GamePrizeLoaderState>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
List<GamePrize> gamePrize,
|
|
||||||
Option<GameFailure> failureOptionGamePrize,
|
|
||||||
bool isFetching,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$GamePrizeLoaderStateCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
$Val extends GamePrizeLoaderState
|
|
||||||
>
|
|
||||||
implements $GamePrizeLoaderStateCopyWith<$Res> {
|
|
||||||
_$GamePrizeLoaderStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? gamePrize = null,
|
|
||||||
Object? failureOptionGamePrize = null,
|
|
||||||
Object? isFetching = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
gamePrize: null == gamePrize
|
|
||||||
? _value.gamePrize
|
|
||||||
: gamePrize // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<GamePrize>,
|
|
||||||
failureOptionGamePrize: null == failureOptionGamePrize
|
|
||||||
? _value.failureOptionGamePrize
|
|
||||||
: failureOptionGamePrize // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<GameFailure>,
|
|
||||||
isFetching: null == isFetching
|
|
||||||
? _value.isFetching
|
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$GamePrizeLoaderStateImplCopyWith<$Res>
|
|
||||||
implements $GamePrizeLoaderStateCopyWith<$Res> {
|
|
||||||
factory _$$GamePrizeLoaderStateImplCopyWith(
|
|
||||||
_$GamePrizeLoaderStateImpl value,
|
|
||||||
$Res Function(_$GamePrizeLoaderStateImpl) then,
|
|
||||||
) = __$$GamePrizeLoaderStateImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
List<GamePrize> gamePrize,
|
|
||||||
Option<GameFailure> failureOptionGamePrize,
|
|
||||||
bool isFetching,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$GamePrizeLoaderStateImplCopyWithImpl<$Res>
|
|
||||||
extends _$GamePrizeLoaderStateCopyWithImpl<$Res, _$GamePrizeLoaderStateImpl>
|
|
||||||
implements _$$GamePrizeLoaderStateImplCopyWith<$Res> {
|
|
||||||
__$$GamePrizeLoaderStateImplCopyWithImpl(
|
|
||||||
_$GamePrizeLoaderStateImpl _value,
|
|
||||||
$Res Function(_$GamePrizeLoaderStateImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? gamePrize = null,
|
|
||||||
Object? failureOptionGamePrize = null,
|
|
||||||
Object? isFetching = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$GamePrizeLoaderStateImpl(
|
|
||||||
gamePrize: null == gamePrize
|
|
||||||
? _value._gamePrize
|
|
||||||
: gamePrize // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<GamePrize>,
|
|
||||||
failureOptionGamePrize: null == failureOptionGamePrize
|
|
||||||
? _value.failureOptionGamePrize
|
|
||||||
: failureOptionGamePrize // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Option<GameFailure>,
|
|
||||||
isFetching: null == isFetching
|
|
||||||
? _value.isFetching
|
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$GamePrizeLoaderStateImpl implements _GamePrizeLoaderState {
|
|
||||||
const _$GamePrizeLoaderStateImpl({
|
|
||||||
required final List<GamePrize> gamePrize,
|
|
||||||
required this.failureOptionGamePrize,
|
|
||||||
this.isFetching = false,
|
|
||||||
}) : _gamePrize = gamePrize;
|
|
||||||
|
|
||||||
final List<GamePrize> _gamePrize;
|
|
||||||
@override
|
|
||||||
List<GamePrize> get gamePrize {
|
|
||||||
if (_gamePrize is EqualUnmodifiableListView) return _gamePrize;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableListView(_gamePrize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
final Option<GameFailure> failureOptionGamePrize;
|
|
||||||
@override
|
|
||||||
@JsonKey()
|
|
||||||
final bool isFetching;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GamePrizeLoaderState(gamePrize: $gamePrize, failureOptionGamePrize: $failureOptionGamePrize, isFetching: $isFetching)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$GamePrizeLoaderStateImpl &&
|
|
||||||
const DeepCollectionEquality().equals(
|
|
||||||
other._gamePrize,
|
|
||||||
_gamePrize,
|
|
||||||
) &&
|
|
||||||
(identical(other.failureOptionGamePrize, failureOptionGamePrize) ||
|
|
||||||
other.failureOptionGamePrize == failureOptionGamePrize) &&
|
|
||||||
(identical(other.isFetching, isFetching) ||
|
|
||||||
other.isFetching == isFetching));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType,
|
|
||||||
const DeepCollectionEquality().hash(_gamePrize),
|
|
||||||
failureOptionGamePrize,
|
|
||||||
isFetching,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$GamePrizeLoaderStateImplCopyWith<_$GamePrizeLoaderStateImpl>
|
|
||||||
get copyWith =>
|
|
||||||
__$$GamePrizeLoaderStateImplCopyWithImpl<_$GamePrizeLoaderStateImpl>(
|
|
||||||
this,
|
|
||||||
_$identity,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _GamePrizeLoaderState implements GamePrizeLoaderState {
|
|
||||||
const factory _GamePrizeLoaderState({
|
|
||||||
required final List<GamePrize> gamePrize,
|
|
||||||
required final Option<GameFailure> failureOptionGamePrize,
|
|
||||||
final bool isFetching,
|
|
||||||
}) = _$GamePrizeLoaderStateImpl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<GamePrize> get gamePrize;
|
|
||||||
@override
|
|
||||||
Option<GameFailure> get failureOptionGamePrize;
|
|
||||||
@override
|
|
||||||
bool get isFetching;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeLoaderState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$GamePrizeLoaderStateImplCopyWith<_$GamePrizeLoaderStateImpl>
|
|
||||||
get copyWith => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
part of 'game_prize_loader_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class GamePrizeLoaderEvent with _$GamePrizeLoaderEvent {
|
|
||||||
const factory GamePrizeLoaderEvent.fetched(String id) = _Fetched;
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
part of 'game_prize_loader_bloc.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class GamePrizeLoaderState with _$GamePrizeLoaderState {
|
|
||||||
const factory GamePrizeLoaderState({
|
|
||||||
required List<GamePrize> gamePrize,
|
|
||||||
required Option<GameFailure> failureOptionGamePrize,
|
|
||||||
@Default(false) bool isFetching,
|
|
||||||
}) = _GamePrizeLoaderState;
|
|
||||||
|
|
||||||
factory GamePrizeLoaderState.initial() =>
|
|
||||||
GamePrizeLoaderState(gamePrize: [], failureOptionGamePrize: none());
|
|
||||||
}
|
|
||||||
@ -1,40 +1,15 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:auto_route/auto_route.dart';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
import '../../../presentation/router/app_router.gr.dart';
|
|
||||||
import '../../constant/local_storage_key.dart';
|
|
||||||
import '../errors/unauthorized_error.dart';
|
import '../errors/unauthorized_error.dart';
|
||||||
|
|
||||||
class UnauthorizedInterceptor extends Interceptor {
|
class UnauthorizedInterceptor extends Interceptor {
|
||||||
static final GlobalKey<NavigatorState> navigatorKey =
|
|
||||||
GlobalKey<NavigatorState>();
|
|
||||||
@override
|
@override
|
||||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
void onError(DioException err, ErrorInterceptorHandler handler) {
|
||||||
if (err.response?.statusCode == 401 ||
|
if (err.response?.statusCode == 401 ||
|
||||||
err.response?.statusCode == 403 ||
|
err.response?.statusCode == 403 ||
|
||||||
err.response?.statusCode == 419) {
|
err.response?.statusCode == 419) {
|
||||||
await _handleTokenExpired();
|
|
||||||
return super.onError(UnauthorizedError(err, null), handler);
|
return super.onError(UnauthorizedError(err, null), handler);
|
||||||
}
|
}
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleTokenExpired() async {
|
|
||||||
// Clear stored token
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
await prefs.remove(LocalStorageKey.token);
|
|
||||||
await prefs.remove(LocalStorageKey.user);
|
|
||||||
await prefs.clear(); // Optional: clear all user data
|
|
||||||
log('handleTokenExpired');
|
|
||||||
// Navigate to login page
|
|
||||||
final context = navigatorKey.currentContext;
|
|
||||||
if (context != null) {
|
|
||||||
// Option 1: Navigate and remove all previous routes
|
|
||||||
context.router.replaceAll([LoginRoute()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
import '../../injection.dart';
|
|
||||||
import '../constant/local_storage_key.dart';
|
|
||||||
|
|
||||||
void dismissKeyboard(BuildContext context) {
|
void dismissKeyboard(BuildContext context) {
|
||||||
final currentFocus = FocusScope.of(context);
|
final currentFocus = FocusScope.of(context);
|
||||||
@ -17,10 +13,3 @@ String getNormalizePhone(String phoneNumber) {
|
|||||||
: phoneNumber;
|
: phoneNumber;
|
||||||
return '62$normalizedPhone';
|
return '62$normalizedPhone';
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> getAuthorizationHeader() {
|
|
||||||
return {
|
|
||||||
'Authorization':
|
|
||||||
'Bearer ${getIt<SharedPreferences>().getString(LocalStorageKey.token)}',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,22 +1,19 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../domain/game/game.dart';
|
import '../../presentation/pages/mini_games/ferris_wheel/data/model.dart';
|
||||||
import '../theme/theme.dart';
|
import '../theme/theme.dart';
|
||||||
|
|
||||||
class WheelPainter extends CustomPainter {
|
class WheelPainter extends CustomPainter {
|
||||||
final List<GamePrize> gamePrizes;
|
final List<WheelSection> sections;
|
||||||
final Color Function(GamePrize prize, int index) getPrizeColor;
|
|
||||||
|
|
||||||
WheelPainter({required this.gamePrizes, required this.getPrizeColor});
|
WheelPainter({required this.sections});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
if (gamePrizes.isEmpty) return;
|
|
||||||
|
|
||||||
final center = Offset(size.width / 2, size.height / 2);
|
final center = Offset(size.width / 2, size.height / 2);
|
||||||
final radius = size.width / 2;
|
final radius = size.width / 2;
|
||||||
final sectionAngle = 2 * math.pi / gamePrizes.length;
|
final sectionAngle = 2 * math.pi / sections.length;
|
||||||
|
|
||||||
// Draw outer white border
|
// Draw outer white border
|
||||||
final outerBorderPaint = Paint()
|
final outerBorderPaint = Paint()
|
||||||
@ -37,13 +34,12 @@ class WheelPainter extends CustomPainter {
|
|||||||
canvas.drawCircle(center, radius - 20, innerWhitePaint);
|
canvas.drawCircle(center, radius - 20, innerWhitePaint);
|
||||||
|
|
||||||
// Draw sections
|
// Draw sections
|
||||||
for (int i = 0; i < gamePrizes.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
final prize = gamePrizes[i];
|
|
||||||
final startAngle = i * sectionAngle - math.pi / 2;
|
final startAngle = i * sectionAngle - math.pi / 2;
|
||||||
|
|
||||||
// Section background
|
// Section background
|
||||||
final sectionPaint = Paint()
|
final sectionPaint = Paint()
|
||||||
..color = getPrizeColor(prize, i)
|
..color = sections[i].color
|
||||||
..style = PaintingStyle.fill;
|
..style = PaintingStyle.fill;
|
||||||
|
|
||||||
canvas.drawArc(
|
canvas.drawArc(
|
||||||
@ -71,16 +67,15 @@ class WheelPainter extends CustomPainter {
|
|||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.translate(iconPosition.dx, iconPosition.dy);
|
canvas.translate(iconPosition.dx, iconPosition.dy);
|
||||||
|
|
||||||
// Get icon from metadata or use default
|
// Draw icon using TextPainter to simulate Icon widget
|
||||||
final iconData = _getIconFromMetadata(prize.metadata);
|
final iconText = _getIconText(sections[i].icon);
|
||||||
final iconText = _getIconText(iconData);
|
|
||||||
final iconTextPainter = TextPainter(
|
final iconTextPainter = TextPainter(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: iconText,
|
text: iconText,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'MaterialIcons',
|
fontFamily: 'MaterialIcons',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: getPrizeColor(prize, i),
|
color: sections[i].color,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -108,7 +103,7 @@ class WheelPainter extends CustomPainter {
|
|||||||
|
|
||||||
final textPainter = TextPainter(
|
final textPainter = TextPainter(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: prize.name,
|
text: sections[i].prize,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
@ -124,42 +119,6 @@ class WheelPainter extends CustomPainter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
// Draw stock indicator if stock is low
|
|
||||||
if (prize.stock <= 5 && prize.stock > 0) {
|
|
||||||
final stockAngle = startAngle + sectionAngle / 2;
|
|
||||||
final stockPosition = Offset(
|
|
||||||
center.dx + (radius - 35) * math.cos(stockAngle),
|
|
||||||
center.dy + (radius - 35) * math.sin(stockAngle),
|
|
||||||
);
|
|
||||||
|
|
||||||
final stockPaint = Paint()
|
|
||||||
..color = AppColor.error
|
|
||||||
..style = PaintingStyle.fill;
|
|
||||||
canvas.drawCircle(stockPosition, 8, stockPaint);
|
|
||||||
|
|
||||||
canvas.save();
|
|
||||||
canvas.translate(stockPosition.dx, stockPosition.dy);
|
|
||||||
|
|
||||||
final stockTextPainter = TextPainter(
|
|
||||||
text: TextSpan(
|
|
||||||
text: '!',
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
);
|
|
||||||
stockTextPainter.layout();
|
|
||||||
stockTextPainter.paint(
|
|
||||||
canvas,
|
|
||||||
Offset(-stockTextPainter.width / 2, -stockTextPainter.height / 2),
|
|
||||||
);
|
|
||||||
|
|
||||||
canvas.restore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw white dots around the outer edge
|
// Draw white dots around the outer edge
|
||||||
@ -182,7 +141,7 @@ class WheelPainter extends CustomPainter {
|
|||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 2;
|
..strokeWidth = 2;
|
||||||
|
|
||||||
for (int i = 0; i < gamePrizes.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
final angle = i * sectionAngle - math.pi / 2;
|
final angle = i * sectionAngle - math.pi / 2;
|
||||||
final lineStart = Offset(
|
final lineStart = Offset(
|
||||||
center.dx + (radius - 130) * math.cos(angle),
|
center.dx + (radius - 130) * math.cos(angle),
|
||||||
@ -196,34 +155,6 @@ class WheelPainter extends CustomPainter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconData _getIconFromMetadata(Map<String, dynamic> metadata) {
|
|
||||||
final iconName = metadata['icon'] as String?;
|
|
||||||
switch (iconName?.toLowerCase()) {
|
|
||||||
case 'card_giftcard':
|
|
||||||
return Icons.card_giftcard;
|
|
||||||
case 'monetization_on':
|
|
||||||
return Icons.monetization_on;
|
|
||||||
case 'redeem':
|
|
||||||
return Icons.redeem;
|
|
||||||
case 'attach_money':
|
|
||||||
return Icons.attach_money;
|
|
||||||
case 'account_balance_wallet':
|
|
||||||
return Icons.account_balance_wallet;
|
|
||||||
case 'diamond':
|
|
||||||
return Icons.diamond;
|
|
||||||
case 'star':
|
|
||||||
return Icons.star;
|
|
||||||
case 'emoji_events':
|
|
||||||
return Icons.emoji_events;
|
|
||||||
case 'refresh':
|
|
||||||
return Icons.refresh;
|
|
||||||
case 'visibility':
|
|
||||||
return Icons.visibility;
|
|
||||||
default:
|
|
||||||
return Icons.card_giftcard; // Default icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getIconText(IconData icon) {
|
String _getIconText(IconData icon) {
|
||||||
// Convert IconData to Unicode string for drawing
|
// Convert IconData to Unicode string for drawing
|
||||||
switch (icon.codePoint) {
|
switch (icon.codePoint) {
|
||||||
@ -243,17 +174,11 @@ class WheelPainter extends CustomPainter {
|
|||||||
return String.fromCharCode(0xe8a1);
|
return String.fromCharCode(0xe8a1);
|
||||||
case 0xe57d: // Icons.monetization_on
|
case 0xe57d: // Icons.monetization_on
|
||||||
return String.fromCharCode(0xe57d);
|
return String.fromCharCode(0xe57d);
|
||||||
case 0xe5ca: // Icons.diamond
|
|
||||||
return String.fromCharCode(0xe5ca);
|
|
||||||
case 0xe838: // Icons.star
|
|
||||||
return String.fromCharCode(0xe838);
|
|
||||||
case 0xe2a3: // Icons.emoji_events
|
|
||||||
return String.fromCharCode(0xe2a3);
|
|
||||||
default:
|
default:
|
||||||
return String.fromCharCode(0xe151); // Default card_giftcard icon
|
return String.fromCharCode(0xe87c); // Default star icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,4 @@ class ApiPath {
|
|||||||
static String setPassword = '/api/v1/customer-auth/register/set-password';
|
static String setPassword = '/api/v1/customer-auth/register/set-password';
|
||||||
static String login = '/api/v1/customer-auth/login';
|
static String login = '/api/v1/customer-auth/login';
|
||||||
static String resend = '/api/v1/customer-auth/resend-otp';
|
static String resend = '/api/v1/customer-auth/resend-otp';
|
||||||
|
|
||||||
// Marketing
|
|
||||||
static String gamePrizeByGameId = '/api/v1/marketing/game-prizes/game';
|
|
||||||
// Customer
|
|
||||||
static String customerPoint = '/api/v1/customer/points';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
|
|
||||||
import '../../common/api/api_failure.dart';
|
|
||||||
|
|
||||||
part 'customer.freezed.dart';
|
|
||||||
|
|
||||||
part 'entities/customer_point_entity.dart';
|
|
||||||
part 'failures/customer_failures.dart';
|
|
||||||
part 'repositories/i_customer_repository.dart';
|
|
||||||
@ -1,713 +0,0 @@
|
|||||||
// 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 'customer.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 _$CustomerPoint {
|
|
||||||
String get status => throw _privateConstructorUsedError;
|
|
||||||
String get message => throw _privateConstructorUsedError;
|
|
||||||
int get totalPoints => throw _privateConstructorUsedError;
|
|
||||||
String get lastUpdated => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPoint
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$CustomerPointCopyWith<CustomerPoint> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerPointCopyWith<$Res> {
|
|
||||||
factory $CustomerPointCopyWith(
|
|
||||||
CustomerPoint value,
|
|
||||||
$Res Function(CustomerPoint) then,
|
|
||||||
) = _$CustomerPointCopyWithImpl<$Res, CustomerPoint>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
String status,
|
|
||||||
String message,
|
|
||||||
int totalPoints,
|
|
||||||
String lastUpdated,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerPointCopyWithImpl<$Res, $Val extends CustomerPoint>
|
|
||||||
implements $CustomerPointCopyWith<$Res> {
|
|
||||||
_$CustomerPointCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPoint
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? status = null,
|
|
||||||
Object? message = null,
|
|
||||||
Object? totalPoints = null,
|
|
||||||
Object? lastUpdated = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
status: null == status
|
|
||||||
? _value.status
|
|
||||||
: status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
message: null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
totalPoints: null == totalPoints
|
|
||||||
? _value.totalPoints
|
|
||||||
: totalPoints // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int,
|
|
||||||
lastUpdated: null == lastUpdated
|
|
||||||
? _value.lastUpdated
|
|
||||||
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$CustomerPointImplCopyWith<$Res>
|
|
||||||
implements $CustomerPointCopyWith<$Res> {
|
|
||||||
factory _$$CustomerPointImplCopyWith(
|
|
||||||
_$CustomerPointImpl value,
|
|
||||||
$Res Function(_$CustomerPointImpl) then,
|
|
||||||
) = __$$CustomerPointImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
String status,
|
|
||||||
String message,
|
|
||||||
int totalPoints,
|
|
||||||
String lastUpdated,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$CustomerPointImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerPointCopyWithImpl<$Res, _$CustomerPointImpl>
|
|
||||||
implements _$$CustomerPointImplCopyWith<$Res> {
|
|
||||||
__$$CustomerPointImplCopyWithImpl(
|
|
||||||
_$CustomerPointImpl _value,
|
|
||||||
$Res Function(_$CustomerPointImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPoint
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? status = null,
|
|
||||||
Object? message = null,
|
|
||||||
Object? totalPoints = null,
|
|
||||||
Object? lastUpdated = null,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$CustomerPointImpl(
|
|
||||||
status: null == status
|
|
||||||
? _value.status
|
|
||||||
: status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
message: null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
totalPoints: null == totalPoints
|
|
||||||
? _value.totalPoints
|
|
||||||
: totalPoints // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int,
|
|
||||||
lastUpdated: null == lastUpdated
|
|
||||||
? _value.lastUpdated
|
|
||||||
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$CustomerPointImpl implements _CustomerPoint {
|
|
||||||
const _$CustomerPointImpl({
|
|
||||||
required this.status,
|
|
||||||
required this.message,
|
|
||||||
required this.totalPoints,
|
|
||||||
required this.lastUpdated,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String status;
|
|
||||||
@override
|
|
||||||
final String message;
|
|
||||||
@override
|
|
||||||
final int totalPoints;
|
|
||||||
@override
|
|
||||||
final String lastUpdated;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerPoint(status: $status, message: $message, totalPoints: $totalPoints, lastUpdated: $lastUpdated)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$CustomerPointImpl &&
|
|
||||||
(identical(other.status, status) || other.status == status) &&
|
|
||||||
(identical(other.message, message) || other.message == message) &&
|
|
||||||
(identical(other.totalPoints, totalPoints) ||
|
|
||||||
other.totalPoints == totalPoints) &&
|
|
||||||
(identical(other.lastUpdated, lastUpdated) ||
|
|
||||||
other.lastUpdated == lastUpdated));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode =>
|
|
||||||
Object.hash(runtimeType, status, message, totalPoints, lastUpdated);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPoint
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$CustomerPointImplCopyWith<_$CustomerPointImpl> get copyWith =>
|
|
||||||
__$$CustomerPointImplCopyWithImpl<_$CustomerPointImpl>(this, _$identity);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _CustomerPoint implements CustomerPoint {
|
|
||||||
const factory _CustomerPoint({
|
|
||||||
required final String status,
|
|
||||||
required final String message,
|
|
||||||
required final int totalPoints,
|
|
||||||
required final String lastUpdated,
|
|
||||||
}) = _$CustomerPointImpl;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get status;
|
|
||||||
@override
|
|
||||||
String get message;
|
|
||||||
@override
|
|
||||||
int get totalPoints;
|
|
||||||
@override
|
|
||||||
String get lastUpdated;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPoint
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$CustomerPointImplCopyWith<_$CustomerPointImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$CustomerFailure {
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(ApiFailure failure) serverError,
|
|
||||||
required TResult Function() unexpectedError,
|
|
||||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(ApiFailure failure)? serverError,
|
|
||||||
TResult? Function()? unexpectedError,
|
|
||||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(ApiFailure failure)? serverError,
|
|
||||||
TResult Function()? unexpectedError,
|
|
||||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_ServerError value) serverError,
|
|
||||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
|
||||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_ServerError value)? serverError,
|
|
||||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_ServerError value)? serverError,
|
|
||||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerFailureCopyWith<$Res> {
|
|
||||||
factory $CustomerFailureCopyWith(
|
|
||||||
CustomerFailure value,
|
|
||||||
$Res Function(CustomerFailure) then,
|
|
||||||
) = _$CustomerFailureCopyWithImpl<$Res, CustomerFailure>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerFailureCopyWithImpl<$Res, $Val extends CustomerFailure>
|
|
||||||
implements $CustomerFailureCopyWith<$Res> {
|
|
||||||
_$CustomerFailureCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$ServerErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$ServerErrorImplCopyWith(
|
|
||||||
_$ServerErrorImpl value,
|
|
||||||
$Res Function(_$ServerErrorImpl) then,
|
|
||||||
) = __$$ServerErrorImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({ApiFailure failure});
|
|
||||||
|
|
||||||
$ApiFailureCopyWith<$Res> get failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$ServerErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerFailureCopyWithImpl<$Res, _$ServerErrorImpl>
|
|
||||||
implements _$$ServerErrorImplCopyWith<$Res> {
|
|
||||||
__$$ServerErrorImplCopyWithImpl(
|
|
||||||
_$ServerErrorImpl _value,
|
|
||||||
$Res Function(_$ServerErrorImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? failure = null}) {
|
|
||||||
return _then(
|
|
||||||
_$ServerErrorImpl(
|
|
||||||
null == failure
|
|
||||||
? _value.failure
|
|
||||||
: failure // ignore: cast_nullable_to_non_nullable
|
|
||||||
as ApiFailure,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$ApiFailureCopyWith<$Res> get failure {
|
|
||||||
return $ApiFailureCopyWith<$Res>(_value.failure, (value) {
|
|
||||||
return _then(_value.copyWith(failure: value));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$ServerErrorImpl implements _ServerError {
|
|
||||||
const _$ServerErrorImpl(this.failure);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final ApiFailure failure;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerFailure.serverError(failure: $failure)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$ServerErrorImpl &&
|
|
||||||
(identical(other.failure, failure) || other.failure == failure));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, failure);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
|
||||||
__$$ServerErrorImplCopyWithImpl<_$ServerErrorImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(ApiFailure failure) serverError,
|
|
||||||
required TResult Function() unexpectedError,
|
|
||||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return serverError(failure);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(ApiFailure failure)? serverError,
|
|
||||||
TResult? Function()? unexpectedError,
|
|
||||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return serverError?.call(failure);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(ApiFailure failure)? serverError,
|
|
||||||
TResult Function()? unexpectedError,
|
|
||||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (serverError != null) {
|
|
||||||
return serverError(failure);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_ServerError value) serverError,
|
|
||||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
|
||||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return serverError(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_ServerError value)? serverError,
|
|
||||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return serverError?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_ServerError value)? serverError,
|
|
||||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (serverError != null) {
|
|
||||||
return serverError(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _ServerError implements CustomerFailure {
|
|
||||||
const factory _ServerError(final ApiFailure failure) = _$ServerErrorImpl;
|
|
||||||
|
|
||||||
ApiFailure get failure;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$UnexpectedErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$UnexpectedErrorImplCopyWith(
|
|
||||||
_$UnexpectedErrorImpl value,
|
|
||||||
$Res Function(_$UnexpectedErrorImpl) then,
|
|
||||||
) = __$$UnexpectedErrorImplCopyWithImpl<$Res>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$UnexpectedErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerFailureCopyWithImpl<$Res, _$UnexpectedErrorImpl>
|
|
||||||
implements _$$UnexpectedErrorImplCopyWith<$Res> {
|
|
||||||
__$$UnexpectedErrorImplCopyWithImpl(
|
|
||||||
_$UnexpectedErrorImpl _value,
|
|
||||||
$Res Function(_$UnexpectedErrorImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$UnexpectedErrorImpl implements _UnexpectedError {
|
|
||||||
const _$UnexpectedErrorImpl();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerFailure.unexpectedError()';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType && other is _$UnexpectedErrorImpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => runtimeType.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(ApiFailure failure) serverError,
|
|
||||||
required TResult Function() unexpectedError,
|
|
||||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return unexpectedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(ApiFailure failure)? serverError,
|
|
||||||
TResult? Function()? unexpectedError,
|
|
||||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return unexpectedError?.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(ApiFailure failure)? serverError,
|
|
||||||
TResult Function()? unexpectedError,
|
|
||||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (unexpectedError != null) {
|
|
||||||
return unexpectedError();
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_ServerError value) serverError,
|
|
||||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
|
||||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return unexpectedError(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_ServerError value)? serverError,
|
|
||||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return unexpectedError?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_ServerError value)? serverError,
|
|
||||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (unexpectedError != null) {
|
|
||||||
return unexpectedError(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _UnexpectedError implements CustomerFailure {
|
|
||||||
const factory _UnexpectedError() = _$UnexpectedErrorImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$DynamicErrorMessageImplCopyWith<$Res> {
|
|
||||||
factory _$$DynamicErrorMessageImplCopyWith(
|
|
||||||
_$DynamicErrorMessageImpl value,
|
|
||||||
$Res Function(_$DynamicErrorMessageImpl) then,
|
|
||||||
) = __$$DynamicErrorMessageImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String erroMessage});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$DynamicErrorMessageImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerFailureCopyWithImpl<$Res, _$DynamicErrorMessageImpl>
|
|
||||||
implements _$$DynamicErrorMessageImplCopyWith<$Res> {
|
|
||||||
__$$DynamicErrorMessageImplCopyWithImpl(
|
|
||||||
_$DynamicErrorMessageImpl _value,
|
|
||||||
$Res Function(_$DynamicErrorMessageImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? erroMessage = null}) {
|
|
||||||
return _then(
|
|
||||||
_$DynamicErrorMessageImpl(
|
|
||||||
null == erroMessage
|
|
||||||
? _value.erroMessage
|
|
||||||
: erroMessage // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
|
|
||||||
const _$DynamicErrorMessageImpl(this.erroMessage);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String erroMessage;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerFailure.dynamicErrorMessage(erroMessage: $erroMessage)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$DynamicErrorMessageImpl &&
|
|
||||||
(identical(other.erroMessage, erroMessage) ||
|
|
||||||
other.erroMessage == erroMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, erroMessage);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
|
||||||
__$$DynamicErrorMessageImplCopyWithImpl<_$DynamicErrorMessageImpl>(
|
|
||||||
this,
|
|
||||||
_$identity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function(ApiFailure failure) serverError,
|
|
||||||
required TResult Function() unexpectedError,
|
|
||||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return dynamicErrorMessage(erroMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(ApiFailure failure)? serverError,
|
|
||||||
TResult? Function()? unexpectedError,
|
|
||||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return dynamicErrorMessage?.call(erroMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function(ApiFailure failure)? serverError,
|
|
||||||
TResult Function()? unexpectedError,
|
|
||||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (dynamicErrorMessage != null) {
|
|
||||||
return dynamicErrorMessage(erroMessage);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_ServerError value) serverError,
|
|
||||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
|
||||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return dynamicErrorMessage(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_ServerError value)? serverError,
|
|
||||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
}) {
|
|
||||||
return dynamicErrorMessage?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_ServerError value)? serverError,
|
|
||||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
|
||||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (dynamicErrorMessage != null) {
|
|
||||||
return dynamicErrorMessage(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _DynamicErrorMessage implements CustomerFailure {
|
|
||||||
const factory _DynamicErrorMessage(final String erroMessage) =
|
|
||||||
_$DynamicErrorMessageImpl;
|
|
||||||
|
|
||||||
String get erroMessage;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerFailure
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
part of '../customer.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class CustomerPoint with _$CustomerPoint {
|
|
||||||
const factory CustomerPoint({
|
|
||||||
required String status,
|
|
||||||
required String message,
|
|
||||||
required int totalPoints,
|
|
||||||
required String lastUpdated,
|
|
||||||
}) = _CustomerPoint;
|
|
||||||
|
|
||||||
factory CustomerPoint.empty() => const CustomerPoint(
|
|
||||||
status: '',
|
|
||||||
message: '',
|
|
||||||
totalPoints: 0,
|
|
||||||
lastUpdated: '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
part of '../customer.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
sealed class CustomerFailure with _$CustomerFailure {
|
|
||||||
const factory CustomerFailure.serverError(ApiFailure failure) = _ServerError;
|
|
||||||
const factory CustomerFailure.unexpectedError() = _UnexpectedError;
|
|
||||||
const factory CustomerFailure.dynamicErrorMessage(String erroMessage) =
|
|
||||||
_DynamicErrorMessage;
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
part of '../customer.dart';
|
|
||||||
|
|
||||||
abstract class ICustomerRepository {
|
|
||||||
Future<Either<CustomerFailure, CustomerPoint>> getPoints();
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
part of '../game.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class Game with _$Game {
|
|
||||||
const factory Game({
|
|
||||||
required String id,
|
|
||||||
required String name,
|
|
||||||
required String type,
|
|
||||||
required bool isActive,
|
|
||||||
required Map<String, dynamic> metadata,
|
|
||||||
required String createdAt,
|
|
||||||
required String updatedAt,
|
|
||||||
}) = _Game;
|
|
||||||
|
|
||||||
factory Game.empty() => const Game(
|
|
||||||
id: '',
|
|
||||||
name: '',
|
|
||||||
type: '',
|
|
||||||
isActive: false,
|
|
||||||
metadata: {},
|
|
||||||
createdAt: '',
|
|
||||||
updatedAt: '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
part of '../game.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class GamePrize with _$GamePrize {
|
|
||||||
const factory GamePrize({
|
|
||||||
required String id,
|
|
||||||
required String gameId,
|
|
||||||
required String name,
|
|
||||||
required int weight,
|
|
||||||
required int stock,
|
|
||||||
required int maxStock,
|
|
||||||
required int threshold,
|
|
||||||
required Map<String, dynamic> metadata,
|
|
||||||
required Game game,
|
|
||||||
required String createdAt,
|
|
||||||
required String updatedAt,
|
|
||||||
}) = _GamePrize;
|
|
||||||
|
|
||||||
factory GamePrize.empty() => GamePrize(
|
|
||||||
id: '',
|
|
||||||
gameId: '',
|
|
||||||
name: '',
|
|
||||||
weight: 0,
|
|
||||||
stock: 0,
|
|
||||||
maxStock: 0,
|
|
||||||
threshold: 0,
|
|
||||||
metadata: const {},
|
|
||||||
game: Game.empty(),
|
|
||||||
createdAt: '',
|
|
||||||
updatedAt: '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
part of '../game.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
sealed class GameFailure with _$GameFailure {
|
|
||||||
const factory GameFailure.serverError(ApiFailure failure) = _ServerError;
|
|
||||||
const factory GameFailure.unexpectedError() = _UnexpectedError;
|
|
||||||
const factory GameFailure.dynamicErrorMessage(String erroMessage) =
|
|
||||||
_DynamicErrorMessage;
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
|
|
||||||
import '../../common/api/api_failure.dart';
|
|
||||||
|
|
||||||
part 'game.freezed.dart';
|
|
||||||
|
|
||||||
part 'entity/game_entity.dart';
|
|
||||||
part 'entity/game_prize_entity.dart';
|
|
||||||
part 'failures/game_failure.dart';
|
|
||||||
part 'repositories/i_game_repository.dart';
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
part of '../game.dart';
|
|
||||||
|
|
||||||
abstract class IGameRepository {
|
|
||||||
Future<Either<GameFailure, List<GamePrize>>> gamePrizeByGameId({
|
|
||||||
required String id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
|
|
||||||
import '../../domain/customer/customer.dart';
|
|
||||||
|
|
||||||
part 'customer_dtos.freezed.dart';
|
|
||||||
part 'customer_dtos.g.dart';
|
|
||||||
|
|
||||||
part 'dtos/customer_point_dto.dart';
|
|
||||||
@ -1,443 +0,0 @@
|
|||||||
// 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 'customer_dtos.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',
|
|
||||||
);
|
|
||||||
|
|
||||||
CustomerPointDto _$CustomerPointDtoFromJson(Map<String, dynamic> json) {
|
|
||||||
return _CustomerPointDto.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$CustomerPointDto {
|
|
||||||
@JsonKey(name: 'status')
|
|
||||||
String? get status => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'message')
|
|
||||||
String? get message => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'data')
|
|
||||||
CustomerPointDataDto? get data => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Serializes this CustomerPointDto to a JSON map.
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$CustomerPointDtoCopyWith<CustomerPointDto> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerPointDtoCopyWith<$Res> {
|
|
||||||
factory $CustomerPointDtoCopyWith(
|
|
||||||
CustomerPointDto value,
|
|
||||||
$Res Function(CustomerPointDto) then,
|
|
||||||
) = _$CustomerPointDtoCopyWithImpl<$Res, CustomerPointDto>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'status') String? status,
|
|
||||||
@JsonKey(name: 'message') String? message,
|
|
||||||
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
|
||||||
});
|
|
||||||
|
|
||||||
$CustomerPointDataDtoCopyWith<$Res>? get data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerPointDtoCopyWithImpl<$Res, $Val extends CustomerPointDto>
|
|
||||||
implements $CustomerPointDtoCopyWith<$Res> {
|
|
||||||
_$CustomerPointDtoCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? status = freezed,
|
|
||||||
Object? message = freezed,
|
|
||||||
Object? data = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
status: freezed == status
|
|
||||||
? _value.status
|
|
||||||
: status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
message: freezed == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
data: freezed == data
|
|
||||||
? _value.data
|
|
||||||
: data // ignore: cast_nullable_to_non_nullable
|
|
||||||
as CustomerPointDataDto?,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$CustomerPointDataDtoCopyWith<$Res>? get data {
|
|
||||||
if (_value.data == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $CustomerPointDataDtoCopyWith<$Res>(_value.data!, (value) {
|
|
||||||
return _then(_value.copyWith(data: value) as $Val);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$CustomerPointDtoImplCopyWith<$Res>
|
|
||||||
implements $CustomerPointDtoCopyWith<$Res> {
|
|
||||||
factory _$$CustomerPointDtoImplCopyWith(
|
|
||||||
_$CustomerPointDtoImpl value,
|
|
||||||
$Res Function(_$CustomerPointDtoImpl) then,
|
|
||||||
) = __$$CustomerPointDtoImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'status') String? status,
|
|
||||||
@JsonKey(name: 'message') String? message,
|
|
||||||
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
$CustomerPointDataDtoCopyWith<$Res>? get data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$CustomerPointDtoImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerPointDtoCopyWithImpl<$Res, _$CustomerPointDtoImpl>
|
|
||||||
implements _$$CustomerPointDtoImplCopyWith<$Res> {
|
|
||||||
__$$CustomerPointDtoImplCopyWithImpl(
|
|
||||||
_$CustomerPointDtoImpl _value,
|
|
||||||
$Res Function(_$CustomerPointDtoImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? status = freezed,
|
|
||||||
Object? message = freezed,
|
|
||||||
Object? data = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$CustomerPointDtoImpl(
|
|
||||||
status: freezed == status
|
|
||||||
? _value.status
|
|
||||||
: status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
message: freezed == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
data: freezed == data
|
|
||||||
? _value.data
|
|
||||||
: data // ignore: cast_nullable_to_non_nullable
|
|
||||||
as CustomerPointDataDto?,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$CustomerPointDtoImpl extends _CustomerPointDto {
|
|
||||||
const _$CustomerPointDtoImpl({
|
|
||||||
@JsonKey(name: 'status') this.status,
|
|
||||||
@JsonKey(name: 'message') this.message,
|
|
||||||
@JsonKey(name: 'data') this.data,
|
|
||||||
}) : super._();
|
|
||||||
|
|
||||||
factory _$CustomerPointDtoImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$CustomerPointDtoImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'status')
|
|
||||||
final String? status;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'message')
|
|
||||||
final String? message;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'data')
|
|
||||||
final CustomerPointDataDto? data;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerPointDto(status: $status, message: $message, data: $data)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$CustomerPointDtoImpl &&
|
|
||||||
(identical(other.status, status) || other.status == status) &&
|
|
||||||
(identical(other.message, message) || other.message == message) &&
|
|
||||||
(identical(other.data, data) || other.data == data));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, status, message, data);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$CustomerPointDtoImplCopyWith<_$CustomerPointDtoImpl> get copyWith =>
|
|
||||||
__$$CustomerPointDtoImplCopyWithImpl<_$CustomerPointDtoImpl>(
|
|
||||||
this,
|
|
||||||
_$identity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$CustomerPointDtoImplToJson(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _CustomerPointDto extends CustomerPointDto {
|
|
||||||
const factory _CustomerPointDto({
|
|
||||||
@JsonKey(name: 'status') final String? status,
|
|
||||||
@JsonKey(name: 'message') final String? message,
|
|
||||||
@JsonKey(name: 'data') final CustomerPointDataDto? data,
|
|
||||||
}) = _$CustomerPointDtoImpl;
|
|
||||||
const _CustomerPointDto._() : super._();
|
|
||||||
|
|
||||||
factory _CustomerPointDto.fromJson(Map<String, dynamic> json) =
|
|
||||||
_$CustomerPointDtoImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'status')
|
|
||||||
String? get status;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'message')
|
|
||||||
String? get message;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'data')
|
|
||||||
CustomerPointDataDto? get data;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$CustomerPointDtoImplCopyWith<_$CustomerPointDtoImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomerPointDataDto _$CustomerPointDataDtoFromJson(Map<String, dynamic> json) {
|
|
||||||
return _CustomerPointDataDto.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$CustomerPointDataDto {
|
|
||||||
@JsonKey(name: 'total_points')
|
|
||||||
int? get totalPoints => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'last_updated')
|
|
||||||
String? get lastUpdated => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Serializes this CustomerPointDataDto to a JSON map.
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDataDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$CustomerPointDataDtoCopyWith<CustomerPointDataDto> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $CustomerPointDataDtoCopyWith<$Res> {
|
|
||||||
factory $CustomerPointDataDtoCopyWith(
|
|
||||||
CustomerPointDataDto value,
|
|
||||||
$Res Function(CustomerPointDataDto) then,
|
|
||||||
) = _$CustomerPointDataDtoCopyWithImpl<$Res, CustomerPointDataDto>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'total_points') int? totalPoints,
|
|
||||||
@JsonKey(name: 'last_updated') String? lastUpdated,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CustomerPointDataDtoCopyWithImpl<
|
|
||||||
$Res,
|
|
||||||
$Val extends CustomerPointDataDto
|
|
||||||
>
|
|
||||||
implements $CustomerPointDataDtoCopyWith<$Res> {
|
|
||||||
_$CustomerPointDataDtoCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDataDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? totalPoints = freezed, Object? lastUpdated = freezed}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
totalPoints: freezed == totalPoints
|
|
||||||
? _value.totalPoints
|
|
||||||
: totalPoints // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
lastUpdated: freezed == lastUpdated
|
|
||||||
? _value.lastUpdated
|
|
||||||
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$CustomerPointDataDtoImplCopyWith<$Res>
|
|
||||||
implements $CustomerPointDataDtoCopyWith<$Res> {
|
|
||||||
factory _$$CustomerPointDataDtoImplCopyWith(
|
|
||||||
_$CustomerPointDataDtoImpl value,
|
|
||||||
$Res Function(_$CustomerPointDataDtoImpl) then,
|
|
||||||
) = __$$CustomerPointDataDtoImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'total_points') int? totalPoints,
|
|
||||||
@JsonKey(name: 'last_updated') String? lastUpdated,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$CustomerPointDataDtoImplCopyWithImpl<$Res>
|
|
||||||
extends _$CustomerPointDataDtoCopyWithImpl<$Res, _$CustomerPointDataDtoImpl>
|
|
||||||
implements _$$CustomerPointDataDtoImplCopyWith<$Res> {
|
|
||||||
__$$CustomerPointDataDtoImplCopyWithImpl(
|
|
||||||
_$CustomerPointDataDtoImpl _value,
|
|
||||||
$Res Function(_$CustomerPointDataDtoImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDataDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({Object? totalPoints = freezed, Object? lastUpdated = freezed}) {
|
|
||||||
return _then(
|
|
||||||
_$CustomerPointDataDtoImpl(
|
|
||||||
totalPoints: freezed == totalPoints
|
|
||||||
? _value.totalPoints
|
|
||||||
: totalPoints // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
lastUpdated: freezed == lastUpdated
|
|
||||||
? _value.lastUpdated
|
|
||||||
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$CustomerPointDataDtoImpl implements _CustomerPointDataDto {
|
|
||||||
const _$CustomerPointDataDtoImpl({
|
|
||||||
@JsonKey(name: 'total_points') this.totalPoints,
|
|
||||||
@JsonKey(name: 'last_updated') this.lastUpdated,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory _$CustomerPointDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$CustomerPointDataDtoImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'total_points')
|
|
||||||
final int? totalPoints;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'last_updated')
|
|
||||||
final String? lastUpdated;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomerPointDataDto(totalPoints: $totalPoints, lastUpdated: $lastUpdated)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$CustomerPointDataDtoImpl &&
|
|
||||||
(identical(other.totalPoints, totalPoints) ||
|
|
||||||
other.totalPoints == totalPoints) &&
|
|
||||||
(identical(other.lastUpdated, lastUpdated) ||
|
|
||||||
other.lastUpdated == lastUpdated));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, totalPoints, lastUpdated);
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDataDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$CustomerPointDataDtoImplCopyWith<_$CustomerPointDataDtoImpl>
|
|
||||||
get copyWith =>
|
|
||||||
__$$CustomerPointDataDtoImplCopyWithImpl<_$CustomerPointDataDtoImpl>(
|
|
||||||
this,
|
|
||||||
_$identity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$CustomerPointDataDtoImplToJson(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _CustomerPointDataDto implements CustomerPointDataDto {
|
|
||||||
const factory _CustomerPointDataDto({
|
|
||||||
@JsonKey(name: 'total_points') final int? totalPoints,
|
|
||||||
@JsonKey(name: 'last_updated') final String? lastUpdated,
|
|
||||||
}) = _$CustomerPointDataDtoImpl;
|
|
||||||
|
|
||||||
factory _CustomerPointDataDto.fromJson(Map<String, dynamic> json) =
|
|
||||||
_$CustomerPointDataDtoImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'total_points')
|
|
||||||
int? get totalPoints;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'last_updated')
|
|
||||||
String? get lastUpdated;
|
|
||||||
|
|
||||||
/// Create a copy of CustomerPointDataDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$CustomerPointDataDtoImplCopyWith<_$CustomerPointDataDtoImpl>
|
|
||||||
get copyWith => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'customer_dtos.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
_$CustomerPointDtoImpl _$$CustomerPointDtoImplFromJson(
|
|
||||||
Map<String, dynamic> json,
|
|
||||||
) => _$CustomerPointDtoImpl(
|
|
||||||
status: json['status'] as String?,
|
|
||||||
message: json['message'] as String?,
|
|
||||||
data: json['data'] == null
|
|
||||||
? null
|
|
||||||
: CustomerPointDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$CustomerPointDtoImplToJson(
|
|
||||||
_$CustomerPointDtoImpl instance,
|
|
||||||
) => <String, dynamic>{
|
|
||||||
'status': instance.status,
|
|
||||||
'message': instance.message,
|
|
||||||
'data': instance.data,
|
|
||||||
};
|
|
||||||
|
|
||||||
_$CustomerPointDataDtoImpl _$$CustomerPointDataDtoImplFromJson(
|
|
||||||
Map<String, dynamic> json,
|
|
||||||
) => _$CustomerPointDataDtoImpl(
|
|
||||||
totalPoints: (json['total_points'] as num?)?.toInt(),
|
|
||||||
lastUpdated: json['last_updated'] as String?,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$CustomerPointDataDtoImplToJson(
|
|
||||||
_$CustomerPointDataDtoImpl instance,
|
|
||||||
) => <String, dynamic>{
|
|
||||||
'total_points': instance.totalPoints,
|
|
||||||
'last_updated': instance.lastUpdated,
|
|
||||||
};
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:data_channel/data_channel.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../common/api/api_client.dart';
|
|
||||||
import '../../../common/api/api_failure.dart';
|
|
||||||
import '../../../common/function/app_function.dart';
|
|
||||||
import '../../../common/url/api_path.dart';
|
|
||||||
import '../../../domain/customer/customer.dart';
|
|
||||||
import '../customer_dtos.dart';
|
|
||||||
|
|
||||||
@injectable
|
|
||||||
class CustomerRemoteDataProvider {
|
|
||||||
final ApiClient _apiClient;
|
|
||||||
final String _logName = "CustomerRemoteDataProvider";
|
|
||||||
|
|
||||||
CustomerRemoteDataProvider(this._apiClient);
|
|
||||||
|
|
||||||
Future<DC<CustomerFailure, CustomerPointDto>> fetchCustomerPoint() async {
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
ApiPath.customerPoint,
|
|
||||||
headers: getAuthorizationHeader(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.data['code'] == 401) {
|
|
||||||
return DC.error(
|
|
||||||
CustomerFailure.serverError(
|
|
||||||
ApiFailure.unauthorized('Session Expired'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.data['status'] == false) {
|
|
||||||
return DC.error(
|
|
||||||
CustomerFailure.dynamicErrorMessage(
|
|
||||||
'Terjadi kesalahan coba lagi nanti',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final dto = CustomerPointDto.fromJson(response.data['data']);
|
|
||||||
return DC.data(dto);
|
|
||||||
} on ApiFailure catch (e, s) {
|
|
||||||
log('fetchCustomerPoint', name: _logName, error: e, stackTrace: s);
|
|
||||||
return DC.error(CustomerFailure.serverError(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
part of '../customer_dtos.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class CustomerPointDto with _$CustomerPointDto {
|
|
||||||
const factory CustomerPointDto({
|
|
||||||
@JsonKey(name: 'status') String? status,
|
|
||||||
@JsonKey(name: 'message') String? message,
|
|
||||||
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
|
||||||
}) = _CustomerPointDto;
|
|
||||||
|
|
||||||
factory CustomerPointDto.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$CustomerPointDtoFromJson(json);
|
|
||||||
|
|
||||||
const CustomerPointDto._();
|
|
||||||
|
|
||||||
/// mapping ke domain
|
|
||||||
CustomerPoint toDomain() => CustomerPoint(
|
|
||||||
status: status ?? '',
|
|
||||||
message: message ?? '',
|
|
||||||
totalPoints: data?.totalPoints ?? 0,
|
|
||||||
lastUpdated: data?.lastUpdated ?? '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class CustomerPointDataDto with _$CustomerPointDataDto {
|
|
||||||
const factory CustomerPointDataDto({
|
|
||||||
@JsonKey(name: 'total_points') int? totalPoints,
|
|
||||||
@JsonKey(name: 'last_updated') String? lastUpdated,
|
|
||||||
}) = _CustomerPointDataDto;
|
|
||||||
|
|
||||||
factory CustomerPointDataDto.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$CustomerPointDataDtoFromJson(json);
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../domain/customer/customer.dart';
|
|
||||||
import '../datasources/remote_data_provider.dart';
|
|
||||||
|
|
||||||
@Injectable(as: ICustomerRepository)
|
|
||||||
class CustomerRepository implements ICustomerRepository {
|
|
||||||
final CustomerRemoteDataProvider _remoteDataProvider;
|
|
||||||
|
|
||||||
final String _logName = 'CustomerRepository';
|
|
||||||
|
|
||||||
CustomerRepository(this._remoteDataProvider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Either<CustomerFailure, CustomerPoint>> getPoints() async {
|
|
||||||
try {
|
|
||||||
final result = await _remoteDataProvider.fetchCustomerPoint();
|
|
||||||
|
|
||||||
if (result.hasError) {
|
|
||||||
return left(result.error!);
|
|
||||||
}
|
|
||||||
|
|
||||||
final data = result.data!.toDomain();
|
|
||||||
return right(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
log('getPoints', name: _logName, error: e, stackTrace: s);
|
|
||||||
return left(const CustomerFailure.unexpectedError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:data_channel/data_channel.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../common/api/api_client.dart';
|
|
||||||
import '../../../common/api/api_failure.dart';
|
|
||||||
import '../../../common/function/app_function.dart';
|
|
||||||
import '../../../common/url/api_path.dart';
|
|
||||||
import '../../../domain/game/game.dart';
|
|
||||||
import '../game_dtos.dart';
|
|
||||||
|
|
||||||
@injectable
|
|
||||||
class GameRemoteDataProvider {
|
|
||||||
final ApiClient _apiClient;
|
|
||||||
final String _logName = "GameRemoteDataProvider";
|
|
||||||
|
|
||||||
GameRemoteDataProvider(this._apiClient);
|
|
||||||
|
|
||||||
Future<DC<GameFailure, List<GamePrizeDto>>> gamePrizeByGameId({
|
|
||||||
required String id,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
'${ApiPath.gamePrizeByGameId}/$id',
|
|
||||||
headers: getAuthorizationHeader(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.data['code'] == 401) {
|
|
||||||
return DC.error(
|
|
||||||
GameFailure.serverError(ApiFailure.unauthorized('Session Expired')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.data['status'] == false) {
|
|
||||||
return DC.error(
|
|
||||||
GameFailure.dynamicErrorMessage('Terjadi kesalahan coba lagi nanti'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final dto = (response.data['data'] as List)
|
|
||||||
.map((e) => GamePrizeDto.fromJson(e))
|
|
||||||
.toList();
|
|
||||||
return DC.data(dto);
|
|
||||||
} on ApiFailure catch (e, s) {
|
|
||||||
log('gamePrizeByGameId', name: _logName, error: e, stackTrace: s);
|
|
||||||
return DC.error(GameFailure.serverError(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
part of '../game_dtos.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class GameDto with _$GameDto {
|
|
||||||
const factory GameDto({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'type') String? type,
|
|
||||||
@JsonKey(name: 'is_active') bool? isActive,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
}) = _GameDto;
|
|
||||||
|
|
||||||
factory GameDto.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$GameDtoFromJson(json);
|
|
||||||
|
|
||||||
const GameDto._();
|
|
||||||
|
|
||||||
Game toDomain() => Game(
|
|
||||||
id: id ?? '',
|
|
||||||
name: name ?? '',
|
|
||||||
type: type ?? '',
|
|
||||||
isActive: isActive ?? false,
|
|
||||||
metadata: metadata ?? const {},
|
|
||||||
createdAt: createdAt ?? '',
|
|
||||||
updatedAt: updatedAt ?? '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
part of '../game_dtos.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class GamePrizeDto with _$GamePrizeDto {
|
|
||||||
const factory GamePrizeDto({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'game_id') String? gameId,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'weight') int? weight,
|
|
||||||
@JsonKey(name: 'stock') int? stock,
|
|
||||||
@JsonKey(name: 'max_stock') int? maxStock,
|
|
||||||
@JsonKey(name: 'threshold') int? threshold,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'game') GameDto? game,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
}) = _GamePrizeDto;
|
|
||||||
|
|
||||||
factory GamePrizeDto.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$GamePrizeDtoFromJson(json);
|
|
||||||
|
|
||||||
const GamePrizeDto._();
|
|
||||||
|
|
||||||
/// mapping ke domain
|
|
||||||
GamePrize toDomain() => GamePrize(
|
|
||||||
id: id ?? '',
|
|
||||||
gameId: gameId ?? '',
|
|
||||||
name: name ?? '',
|
|
||||||
weight: weight ?? 0,
|
|
||||||
stock: stock ?? 0,
|
|
||||||
maxStock: maxStock ?? 0,
|
|
||||||
threshold: threshold ?? 0,
|
|
||||||
metadata: metadata ?? const {},
|
|
||||||
game: game?.toDomain() ?? Game.empty(),
|
|
||||||
createdAt: createdAt ?? '',
|
|
||||||
updatedAt: updatedAt ?? '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
|
|
||||||
import '../../domain/game/game.dart';
|
|
||||||
|
|
||||||
part 'game_dtos.freezed.dart';
|
|
||||||
part 'game_dtos.g.dart';
|
|
||||||
|
|
||||||
part 'dto/game_dto.dart';
|
|
||||||
part 'dto/game_prize_dto.dart';
|
|
||||||
@ -1,779 +0,0 @@
|
|||||||
// 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 'game_dtos.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',
|
|
||||||
);
|
|
||||||
|
|
||||||
GameDto _$GameDtoFromJson(Map<String, dynamic> json) {
|
|
||||||
return _GameDto.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$GameDto {
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
String? get id => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
String? get name => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'type')
|
|
||||||
String? get type => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
bool? get isActive => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
String? get createdAt => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
String? get updatedAt => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Serializes this GameDto to a JSON map.
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of GameDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$GameDtoCopyWith<GameDto> get copyWith => throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $GameDtoCopyWith<$Res> {
|
|
||||||
factory $GameDtoCopyWith(GameDto value, $Res Function(GameDto) then) =
|
|
||||||
_$GameDtoCopyWithImpl<$Res, GameDto>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'type') String? type,
|
|
||||||
@JsonKey(name: 'is_active') bool? isActive,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$GameDtoCopyWithImpl<$Res, $Val extends GameDto>
|
|
||||||
implements $GameDtoCopyWith<$Res> {
|
|
||||||
_$GameDtoCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of GameDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? id = freezed,
|
|
||||||
Object? name = freezed,
|
|
||||||
Object? type = freezed,
|
|
||||||
Object? isActive = freezed,
|
|
||||||
Object? metadata = freezed,
|
|
||||||
Object? createdAt = freezed,
|
|
||||||
Object? updatedAt = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
id: freezed == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
name: freezed == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
type: freezed == type
|
|
||||||
? _value.type
|
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
isActive: freezed == isActive
|
|
||||||
? _value.isActive
|
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool?,
|
|
||||||
metadata: freezed == metadata
|
|
||||||
? _value.metadata
|
|
||||||
: metadata // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Map<String, dynamic>?,
|
|
||||||
createdAt: freezed == createdAt
|
|
||||||
? _value.createdAt
|
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
updatedAt: freezed == updatedAt
|
|
||||||
? _value.updatedAt
|
|
||||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$GameDtoImplCopyWith<$Res> implements $GameDtoCopyWith<$Res> {
|
|
||||||
factory _$$GameDtoImplCopyWith(
|
|
||||||
_$GameDtoImpl value,
|
|
||||||
$Res Function(_$GameDtoImpl) then,
|
|
||||||
) = __$$GameDtoImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'type') String? type,
|
|
||||||
@JsonKey(name: 'is_active') bool? isActive,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$GameDtoImplCopyWithImpl<$Res>
|
|
||||||
extends _$GameDtoCopyWithImpl<$Res, _$GameDtoImpl>
|
|
||||||
implements _$$GameDtoImplCopyWith<$Res> {
|
|
||||||
__$$GameDtoImplCopyWithImpl(
|
|
||||||
_$GameDtoImpl _value,
|
|
||||||
$Res Function(_$GameDtoImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GameDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? id = freezed,
|
|
||||||
Object? name = freezed,
|
|
||||||
Object? type = freezed,
|
|
||||||
Object? isActive = freezed,
|
|
||||||
Object? metadata = freezed,
|
|
||||||
Object? createdAt = freezed,
|
|
||||||
Object? updatedAt = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$GameDtoImpl(
|
|
||||||
id: freezed == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
name: freezed == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
type: freezed == type
|
|
||||||
? _value.type
|
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
isActive: freezed == isActive
|
|
||||||
? _value.isActive
|
|
||||||
: isActive // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool?,
|
|
||||||
metadata: freezed == metadata
|
|
||||||
? _value._metadata
|
|
||||||
: metadata // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Map<String, dynamic>?,
|
|
||||||
createdAt: freezed == createdAt
|
|
||||||
? _value.createdAt
|
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
updatedAt: freezed == updatedAt
|
|
||||||
? _value.updatedAt
|
|
||||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$GameDtoImpl extends _GameDto {
|
|
||||||
const _$GameDtoImpl({
|
|
||||||
@JsonKey(name: 'id') this.id,
|
|
||||||
@JsonKey(name: 'name') this.name,
|
|
||||||
@JsonKey(name: 'type') this.type,
|
|
||||||
@JsonKey(name: 'is_active') this.isActive,
|
|
||||||
@JsonKey(name: 'metadata') final Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'created_at') this.createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
|
||||||
}) : _metadata = metadata,
|
|
||||||
super._();
|
|
||||||
|
|
||||||
factory _$GameDtoImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$GameDtoImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
final String? id;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
final String? name;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'type')
|
|
||||||
final String? type;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
final bool? isActive;
|
|
||||||
final Map<String, dynamic>? _metadata;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata {
|
|
||||||
final value = _metadata;
|
|
||||||
if (value == null) return null;
|
|
||||||
if (_metadata is EqualUnmodifiableMapView) return _metadata;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableMapView(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
final String? createdAt;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
final String? updatedAt;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GameDto(id: $id, name: $name, type: $type, isActive: $isActive, metadata: $metadata, createdAt: $createdAt, updatedAt: $updatedAt)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$GameDtoImpl &&
|
|
||||||
(identical(other.id, id) || other.id == id) &&
|
|
||||||
(identical(other.name, name) || other.name == name) &&
|
|
||||||
(identical(other.type, type) || other.type == type) &&
|
|
||||||
(identical(other.isActive, isActive) ||
|
|
||||||
other.isActive == isActive) &&
|
|
||||||
const DeepCollectionEquality().equals(other._metadata, _metadata) &&
|
|
||||||
(identical(other.createdAt, createdAt) ||
|
|
||||||
other.createdAt == createdAt) &&
|
|
||||||
(identical(other.updatedAt, updatedAt) ||
|
|
||||||
other.updatedAt == updatedAt));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType,
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
isActive,
|
|
||||||
const DeepCollectionEquality().hash(_metadata),
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Create a copy of GameDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$GameDtoImplCopyWith<_$GameDtoImpl> get copyWith =>
|
|
||||||
__$$GameDtoImplCopyWithImpl<_$GameDtoImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$GameDtoImplToJson(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _GameDto extends GameDto {
|
|
||||||
const factory _GameDto({
|
|
||||||
@JsonKey(name: 'id') final String? id,
|
|
||||||
@JsonKey(name: 'name') final String? name,
|
|
||||||
@JsonKey(name: 'type') final String? type,
|
|
||||||
@JsonKey(name: 'is_active') final bool? isActive,
|
|
||||||
@JsonKey(name: 'metadata') final Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'created_at') final String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') final String? updatedAt,
|
|
||||||
}) = _$GameDtoImpl;
|
|
||||||
const _GameDto._() : super._();
|
|
||||||
|
|
||||||
factory _GameDto.fromJson(Map<String, dynamic> json) = _$GameDtoImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
String? get id;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
String? get name;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'type')
|
|
||||||
String? get type;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
bool? get isActive;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
String? get createdAt;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
String? get updatedAt;
|
|
||||||
|
|
||||||
/// Create a copy of GameDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$GameDtoImplCopyWith<_$GameDtoImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
GamePrizeDto _$GamePrizeDtoFromJson(Map<String, dynamic> json) {
|
|
||||||
return _GamePrizeDto.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$GamePrizeDto {
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
String? get id => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'game_id')
|
|
||||||
String? get gameId => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
String? get name => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'weight')
|
|
||||||
int? get weight => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'stock')
|
|
||||||
int? get stock => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'max_stock')
|
|
||||||
int? get maxStock => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'threshold')
|
|
||||||
int? get threshold => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'game')
|
|
||||||
GameDto? get game => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
String? get createdAt => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
String? get updatedAt => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Serializes this GamePrizeDto to a JSON map.
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$GamePrizeDtoCopyWith<GamePrizeDto> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $GamePrizeDtoCopyWith<$Res> {
|
|
||||||
factory $GamePrizeDtoCopyWith(
|
|
||||||
GamePrizeDto value,
|
|
||||||
$Res Function(GamePrizeDto) then,
|
|
||||||
) = _$GamePrizeDtoCopyWithImpl<$Res, GamePrizeDto>;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'game_id') String? gameId,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'weight') int? weight,
|
|
||||||
@JsonKey(name: 'stock') int? stock,
|
|
||||||
@JsonKey(name: 'max_stock') int? maxStock,
|
|
||||||
@JsonKey(name: 'threshold') int? threshold,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'game') GameDto? game,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
$GameDtoCopyWith<$Res>? get game;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$GamePrizeDtoCopyWithImpl<$Res, $Val extends GamePrizeDto>
|
|
||||||
implements $GamePrizeDtoCopyWith<$Res> {
|
|
||||||
_$GamePrizeDtoCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? id = freezed,
|
|
||||||
Object? gameId = freezed,
|
|
||||||
Object? name = freezed,
|
|
||||||
Object? weight = freezed,
|
|
||||||
Object? stock = freezed,
|
|
||||||
Object? maxStock = freezed,
|
|
||||||
Object? threshold = freezed,
|
|
||||||
Object? metadata = freezed,
|
|
||||||
Object? game = freezed,
|
|
||||||
Object? createdAt = freezed,
|
|
||||||
Object? updatedAt = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_value.copyWith(
|
|
||||||
id: freezed == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
gameId: freezed == gameId
|
|
||||||
? _value.gameId
|
|
||||||
: gameId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
name: freezed == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
weight: freezed == weight
|
|
||||||
? _value.weight
|
|
||||||
: weight // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
stock: freezed == stock
|
|
||||||
? _value.stock
|
|
||||||
: stock // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
maxStock: freezed == maxStock
|
|
||||||
? _value.maxStock
|
|
||||||
: maxStock // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
threshold: freezed == threshold
|
|
||||||
? _value.threshold
|
|
||||||
: threshold // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
metadata: freezed == metadata
|
|
||||||
? _value.metadata
|
|
||||||
: metadata // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Map<String, dynamic>?,
|
|
||||||
game: freezed == game
|
|
||||||
? _value.game
|
|
||||||
: game // ignore: cast_nullable_to_non_nullable
|
|
||||||
as GameDto?,
|
|
||||||
createdAt: freezed == createdAt
|
|
||||||
? _value.createdAt
|
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
updatedAt: freezed == updatedAt
|
|
||||||
? _value.updatedAt
|
|
||||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
)
|
|
||||||
as $Val,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$GameDtoCopyWith<$Res>? get game {
|
|
||||||
if (_value.game == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $GameDtoCopyWith<$Res>(_value.game!, (value) {
|
|
||||||
return _then(_value.copyWith(game: value) as $Val);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$GamePrizeDtoImplCopyWith<$Res>
|
|
||||||
implements $GamePrizeDtoCopyWith<$Res> {
|
|
||||||
factory _$$GamePrizeDtoImplCopyWith(
|
|
||||||
_$GamePrizeDtoImpl value,
|
|
||||||
$Res Function(_$GamePrizeDtoImpl) then,
|
|
||||||
) = __$$GamePrizeDtoImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
@JsonKey(name: 'id') String? id,
|
|
||||||
@JsonKey(name: 'game_id') String? gameId,
|
|
||||||
@JsonKey(name: 'name') String? name,
|
|
||||||
@JsonKey(name: 'weight') int? weight,
|
|
||||||
@JsonKey(name: 'stock') int? stock,
|
|
||||||
@JsonKey(name: 'max_stock') int? maxStock,
|
|
||||||
@JsonKey(name: 'threshold') int? threshold,
|
|
||||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'game') GameDto? game,
|
|
||||||
@JsonKey(name: 'created_at') String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
$GameDtoCopyWith<$Res>? get game;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$GamePrizeDtoImplCopyWithImpl<$Res>
|
|
||||||
extends _$GamePrizeDtoCopyWithImpl<$Res, _$GamePrizeDtoImpl>
|
|
||||||
implements _$$GamePrizeDtoImplCopyWith<$Res> {
|
|
||||||
__$$GamePrizeDtoImplCopyWithImpl(
|
|
||||||
_$GamePrizeDtoImpl _value,
|
|
||||||
$Res Function(_$GamePrizeDtoImpl) _then,
|
|
||||||
) : super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? id = freezed,
|
|
||||||
Object? gameId = freezed,
|
|
||||||
Object? name = freezed,
|
|
||||||
Object? weight = freezed,
|
|
||||||
Object? stock = freezed,
|
|
||||||
Object? maxStock = freezed,
|
|
||||||
Object? threshold = freezed,
|
|
||||||
Object? metadata = freezed,
|
|
||||||
Object? game = freezed,
|
|
||||||
Object? createdAt = freezed,
|
|
||||||
Object? updatedAt = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(
|
|
||||||
_$GamePrizeDtoImpl(
|
|
||||||
id: freezed == id
|
|
||||||
? _value.id
|
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
gameId: freezed == gameId
|
|
||||||
? _value.gameId
|
|
||||||
: gameId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
name: freezed == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
weight: freezed == weight
|
|
||||||
? _value.weight
|
|
||||||
: weight // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
stock: freezed == stock
|
|
||||||
? _value.stock
|
|
||||||
: stock // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
maxStock: freezed == maxStock
|
|
||||||
? _value.maxStock
|
|
||||||
: maxStock // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
threshold: freezed == threshold
|
|
||||||
? _value.threshold
|
|
||||||
: threshold // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
metadata: freezed == metadata
|
|
||||||
? _value._metadata
|
|
||||||
: metadata // ignore: cast_nullable_to_non_nullable
|
|
||||||
as Map<String, dynamic>?,
|
|
||||||
game: freezed == game
|
|
||||||
? _value.game
|
|
||||||
: game // ignore: cast_nullable_to_non_nullable
|
|
||||||
as GameDto?,
|
|
||||||
createdAt: freezed == createdAt
|
|
||||||
? _value.createdAt
|
|
||||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
updatedAt: freezed == updatedAt
|
|
||||||
? _value.updatedAt
|
|
||||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$GamePrizeDtoImpl extends _GamePrizeDto {
|
|
||||||
const _$GamePrizeDtoImpl({
|
|
||||||
@JsonKey(name: 'id') this.id,
|
|
||||||
@JsonKey(name: 'game_id') this.gameId,
|
|
||||||
@JsonKey(name: 'name') this.name,
|
|
||||||
@JsonKey(name: 'weight') this.weight,
|
|
||||||
@JsonKey(name: 'stock') this.stock,
|
|
||||||
@JsonKey(name: 'max_stock') this.maxStock,
|
|
||||||
@JsonKey(name: 'threshold') this.threshold,
|
|
||||||
@JsonKey(name: 'metadata') final Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'game') this.game,
|
|
||||||
@JsonKey(name: 'created_at') this.createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
|
||||||
}) : _metadata = metadata,
|
|
||||||
super._();
|
|
||||||
|
|
||||||
factory _$GamePrizeDtoImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$GamePrizeDtoImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
final String? id;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'game_id')
|
|
||||||
final String? gameId;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
final String? name;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'weight')
|
|
||||||
final int? weight;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'stock')
|
|
||||||
final int? stock;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'max_stock')
|
|
||||||
final int? maxStock;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'threshold')
|
|
||||||
final int? threshold;
|
|
||||||
final Map<String, dynamic>? _metadata;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata {
|
|
||||||
final value = _metadata;
|
|
||||||
if (value == null) return null;
|
|
||||||
if (_metadata is EqualUnmodifiableMapView) return _metadata;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableMapView(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'game')
|
|
||||||
final GameDto? game;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
final String? createdAt;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
final String? updatedAt;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GamePrizeDto(id: $id, gameId: $gameId, name: $name, weight: $weight, stock: $stock, maxStock: $maxStock, threshold: $threshold, metadata: $metadata, game: $game, createdAt: $createdAt, updatedAt: $updatedAt)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$GamePrizeDtoImpl &&
|
|
||||||
(identical(other.id, id) || other.id == id) &&
|
|
||||||
(identical(other.gameId, gameId) || other.gameId == gameId) &&
|
|
||||||
(identical(other.name, name) || other.name == name) &&
|
|
||||||
(identical(other.weight, weight) || other.weight == weight) &&
|
|
||||||
(identical(other.stock, stock) || other.stock == stock) &&
|
|
||||||
(identical(other.maxStock, maxStock) ||
|
|
||||||
other.maxStock == maxStock) &&
|
|
||||||
(identical(other.threshold, threshold) ||
|
|
||||||
other.threshold == threshold) &&
|
|
||||||
const DeepCollectionEquality().equals(other._metadata, _metadata) &&
|
|
||||||
(identical(other.game, game) || other.game == game) &&
|
|
||||||
(identical(other.createdAt, createdAt) ||
|
|
||||||
other.createdAt == createdAt) &&
|
|
||||||
(identical(other.updatedAt, updatedAt) ||
|
|
||||||
other.updatedAt == updatedAt));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType,
|
|
||||||
id,
|
|
||||||
gameId,
|
|
||||||
name,
|
|
||||||
weight,
|
|
||||||
stock,
|
|
||||||
maxStock,
|
|
||||||
threshold,
|
|
||||||
const DeepCollectionEquality().hash(_metadata),
|
|
||||||
game,
|
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$GamePrizeDtoImplCopyWith<_$GamePrizeDtoImpl> get copyWith =>
|
|
||||||
__$$GamePrizeDtoImplCopyWithImpl<_$GamePrizeDtoImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$GamePrizeDtoImplToJson(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _GamePrizeDto extends GamePrizeDto {
|
|
||||||
const factory _GamePrizeDto({
|
|
||||||
@JsonKey(name: 'id') final String? id,
|
|
||||||
@JsonKey(name: 'game_id') final String? gameId,
|
|
||||||
@JsonKey(name: 'name') final String? name,
|
|
||||||
@JsonKey(name: 'weight') final int? weight,
|
|
||||||
@JsonKey(name: 'stock') final int? stock,
|
|
||||||
@JsonKey(name: 'max_stock') final int? maxStock,
|
|
||||||
@JsonKey(name: 'threshold') final int? threshold,
|
|
||||||
@JsonKey(name: 'metadata') final Map<String, dynamic>? metadata,
|
|
||||||
@JsonKey(name: 'game') final GameDto? game,
|
|
||||||
@JsonKey(name: 'created_at') final String? createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') final String? updatedAt,
|
|
||||||
}) = _$GamePrizeDtoImpl;
|
|
||||||
const _GamePrizeDto._() : super._();
|
|
||||||
|
|
||||||
factory _GamePrizeDto.fromJson(Map<String, dynamic> json) =
|
|
||||||
_$GamePrizeDtoImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'id')
|
|
||||||
String? get id;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'game_id')
|
|
||||||
String? get gameId;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'name')
|
|
||||||
String? get name;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'weight')
|
|
||||||
int? get weight;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'stock')
|
|
||||||
int? get stock;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'max_stock')
|
|
||||||
int? get maxStock;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'threshold')
|
|
||||||
int? get threshold;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'metadata')
|
|
||||||
Map<String, dynamic>? get metadata;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'game')
|
|
||||||
GameDto? get game;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'created_at')
|
|
||||||
String? get createdAt;
|
|
||||||
@override
|
|
||||||
@JsonKey(name: 'updated_at')
|
|
||||||
String? get updatedAt;
|
|
||||||
|
|
||||||
/// Create a copy of GamePrizeDto
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$GamePrizeDtoImplCopyWith<_$GamePrizeDtoImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'game_dtos.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
_$GameDtoImpl _$$GameDtoImplFromJson(Map<String, dynamic> json) =>
|
|
||||||
_$GameDtoImpl(
|
|
||||||
id: json['id'] as String?,
|
|
||||||
name: json['name'] as String?,
|
|
||||||
type: json['type'] as String?,
|
|
||||||
isActive: json['is_active'] as bool?,
|
|
||||||
metadata: json['metadata'] as Map<String, dynamic>?,
|
|
||||||
createdAt: json['created_at'] as String?,
|
|
||||||
updatedAt: json['updated_at'] as String?,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameDtoImplToJson(_$GameDtoImpl instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'name': instance.name,
|
|
||||||
'type': instance.type,
|
|
||||||
'is_active': instance.isActive,
|
|
||||||
'metadata': instance.metadata,
|
|
||||||
'created_at': instance.createdAt,
|
|
||||||
'updated_at': instance.updatedAt,
|
|
||||||
};
|
|
||||||
|
|
||||||
_$GamePrizeDtoImpl _$$GamePrizeDtoImplFromJson(Map<String, dynamic> json) =>
|
|
||||||
_$GamePrizeDtoImpl(
|
|
||||||
id: json['id'] as String?,
|
|
||||||
gameId: json['game_id'] as String?,
|
|
||||||
name: json['name'] as String?,
|
|
||||||
weight: (json['weight'] as num?)?.toInt(),
|
|
||||||
stock: (json['stock'] as num?)?.toInt(),
|
|
||||||
maxStock: (json['max_stock'] as num?)?.toInt(),
|
|
||||||
threshold: (json['threshold'] as num?)?.toInt(),
|
|
||||||
metadata: json['metadata'] as Map<String, dynamic>?,
|
|
||||||
game: json['game'] == null
|
|
||||||
? null
|
|
||||||
: GameDto.fromJson(json['game'] as Map<String, dynamic>),
|
|
||||||
createdAt: json['created_at'] as String?,
|
|
||||||
updatedAt: json['updated_at'] as String?,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$GamePrizeDtoImplToJson(_$GamePrizeDtoImpl instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'game_id': instance.gameId,
|
|
||||||
'name': instance.name,
|
|
||||||
'weight': instance.weight,
|
|
||||||
'stock': instance.stock,
|
|
||||||
'max_stock': instance.maxStock,
|
|
||||||
'threshold': instance.threshold,
|
|
||||||
'metadata': instance.metadata,
|
|
||||||
'game': instance.game,
|
|
||||||
'created_at': instance.createdAt,
|
|
||||||
'updated_at': instance.updatedAt,
|
|
||||||
};
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
|
||||||
|
|
||||||
import '../../../domain/game/game.dart';
|
|
||||||
import '../datasources/remote_data_provider.dart';
|
|
||||||
|
|
||||||
@Injectable(as: IGameRepository)
|
|
||||||
class GameRepository implements IGameRepository {
|
|
||||||
final GameRemoteDataProvider _remoteDataProvider;
|
|
||||||
|
|
||||||
final String _logName = 'GameRepository';
|
|
||||||
|
|
||||||
GameRepository(this._remoteDataProvider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Either<GameFailure, List<GamePrize>>> gamePrizeByGameId({
|
|
||||||
required String id,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final result = await _remoteDataProvider.gamePrizeByGameId(id: id);
|
|
||||||
|
|
||||||
if (result.hasError) {
|
|
||||||
return left(result.error!);
|
|
||||||
}
|
|
||||||
|
|
||||||
final data = result.data!.map((e) => e.toDomain()).toList();
|
|
||||||
|
|
||||||
return right(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
log('gamePrizeByGameId', name: _logName, error: e, stackTrace: s);
|
|
||||||
return left(const GameFailure.unexpectedError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -16,8 +16,6 @@ import 'package:enaklo/application/auth/check_phone_form/check_phone_form_bloc.d
|
|||||||
as _i869;
|
as _i869;
|
||||||
import 'package:enaklo/application/auth/login_form/login_form_bloc.dart'
|
import 'package:enaklo/application/auth/login_form/login_form_bloc.dart'
|
||||||
as _i510;
|
as _i510;
|
||||||
import 'package:enaklo/application/auth/logout_form/logout_form_bloc.dart'
|
|
||||||
as _i216;
|
|
||||||
import 'package:enaklo/application/auth/register_form/register_form_bloc.dart'
|
import 'package:enaklo/application/auth/register_form/register_form_bloc.dart'
|
||||||
as _i260;
|
as _i260;
|
||||||
import 'package:enaklo/application/auth/resend_form/resend_form_bloc.dart'
|
import 'package:enaklo/application/auth/resend_form/resend_form_bloc.dart'
|
||||||
@ -26,10 +24,6 @@ import 'package:enaklo/application/auth/set_password/set_password_form_bloc.dart
|
|||||||
as _i174;
|
as _i174;
|
||||||
import 'package:enaklo/application/auth/verify_form/verify_form_bloc.dart'
|
import 'package:enaklo/application/auth/verify_form/verify_form_bloc.dart'
|
||||||
as _i521;
|
as _i521;
|
||||||
import 'package:enaklo/application/customer/customer_point_loader/customer_point_loader_bloc.dart'
|
|
||||||
as _i497;
|
|
||||||
import 'package:enaklo/application/game/game_price_loader/game_prize_loader_bloc.dart'
|
|
||||||
as _i925;
|
|
||||||
import 'package:enaklo/common/api/api_client.dart' as _i842;
|
import 'package:enaklo/common/api/api_client.dart' as _i842;
|
||||||
import 'package:enaklo/common/di/di_auto_route.dart' as _i619;
|
import 'package:enaklo/common/di/di_auto_route.dart' as _i619;
|
||||||
import 'package:enaklo/common/di/di_connectivity.dart' as _i644;
|
import 'package:enaklo/common/di/di_connectivity.dart' as _i644;
|
||||||
@ -37,8 +31,6 @@ import 'package:enaklo/common/di/di_dio.dart' as _i842;
|
|||||||
import 'package:enaklo/common/di/di_shared_preferences.dart' as _i672;
|
import 'package:enaklo/common/di/di_shared_preferences.dart' as _i672;
|
||||||
import 'package:enaklo/common/network/network_client.dart' as _i109;
|
import 'package:enaklo/common/network/network_client.dart' as _i109;
|
||||||
import 'package:enaklo/domain/auth/auth.dart' as _i995;
|
import 'package:enaklo/domain/auth/auth.dart' as _i995;
|
||||||
import 'package:enaklo/domain/customer/customer.dart' as _i898;
|
|
||||||
import 'package:enaklo/domain/game/game.dart' as _i96;
|
|
||||||
import 'package:enaklo/env.dart' as _i372;
|
import 'package:enaklo/env.dart' as _i372;
|
||||||
import 'package:enaklo/infrastructure/auth/datasources/local_data_provider.dart'
|
import 'package:enaklo/infrastructure/auth/datasources/local_data_provider.dart'
|
||||||
as _i1003;
|
as _i1003;
|
||||||
@ -46,14 +38,6 @@ import 'package:enaklo/infrastructure/auth/datasources/remote_data_provider.dart
|
|||||||
as _i818;
|
as _i818;
|
||||||
import 'package:enaklo/infrastructure/auth/repositories/auth_repository.dart'
|
import 'package:enaklo/infrastructure/auth/repositories/auth_repository.dart'
|
||||||
as _i879;
|
as _i879;
|
||||||
import 'package:enaklo/infrastructure/customer/datasources/remote_data_provider.dart'
|
|
||||||
as _i89;
|
|
||||||
import 'package:enaklo/infrastructure/customer/repositories/customer_repository.dart'
|
|
||||||
as _i118;
|
|
||||||
import 'package:enaklo/infrastructure/game/datasources/remote_data_provider.dart'
|
|
||||||
as _i143;
|
|
||||||
import 'package:enaklo/infrastructure/game/repositories/game_repository.dart'
|
|
||||||
as _i547;
|
|
||||||
import 'package:enaklo/presentation/router/app_router.dart' as _i698;
|
import 'package:enaklo/presentation/router/app_router.dart' as _i698;
|
||||||
import 'package:get_it/get_it.dart' as _i174;
|
import 'package:get_it/get_it.dart' as _i174;
|
||||||
import 'package:injectable/injectable.dart' as _i526;
|
import 'package:injectable/injectable.dart' as _i526;
|
||||||
@ -94,18 +78,6 @@ extension GetItInjectableX on _i174.GetIt {
|
|||||||
gh.factory<_i818.AuthRemoteDataProvider>(
|
gh.factory<_i818.AuthRemoteDataProvider>(
|
||||||
() => _i818.AuthRemoteDataProvider(gh<_i842.ApiClient>()),
|
() => _i818.AuthRemoteDataProvider(gh<_i842.ApiClient>()),
|
||||||
);
|
);
|
||||||
gh.factory<_i143.GameRemoteDataProvider>(
|
|
||||||
() => _i143.GameRemoteDataProvider(gh<_i842.ApiClient>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i89.CustomerRemoteDataProvider>(
|
|
||||||
() => _i89.CustomerRemoteDataProvider(gh<_i842.ApiClient>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i96.IGameRepository>(
|
|
||||||
() => _i547.GameRepository(gh<_i143.GameRemoteDataProvider>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i925.GamePrizeLoaderBloc>(
|
|
||||||
() => _i925.GamePrizeLoaderBloc(gh<_i96.IGameRepository>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i995.IAuthRepository>(
|
gh.factory<_i995.IAuthRepository>(
|
||||||
() => _i879.AuthRepository(
|
() => _i879.AuthRepository(
|
||||||
gh<_i818.AuthRemoteDataProvider>(),
|
gh<_i818.AuthRemoteDataProvider>(),
|
||||||
@ -130,18 +102,9 @@ extension GetItInjectableX on _i174.GetIt {
|
|||||||
gh.factory<_i771.AuthBloc>(
|
gh.factory<_i771.AuthBloc>(
|
||||||
() => _i771.AuthBloc(gh<_i995.IAuthRepository>()),
|
() => _i771.AuthBloc(gh<_i995.IAuthRepository>()),
|
||||||
);
|
);
|
||||||
gh.factory<_i216.LogoutFormBloc>(
|
|
||||||
() => _i216.LogoutFormBloc(gh<_i995.IAuthRepository>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i898.ICustomerRepository>(
|
|
||||||
() => _i118.CustomerRepository(gh<_i89.CustomerRemoteDataProvider>()),
|
|
||||||
);
|
|
||||||
gh.factory<_i510.LoginFormBloc>(
|
gh.factory<_i510.LoginFormBloc>(
|
||||||
() => _i510.LoginFormBloc(gh<_i995.IAuthRepository>()),
|
() => _i510.LoginFormBloc(gh<_i995.IAuthRepository>()),
|
||||||
);
|
);
|
||||||
gh.factory<_i497.CustomerPointLoaderBloc>(
|
|
||||||
() => _i497.CustomerPointLoaderBloc(gh<_i898.ICustomerRepository>()),
|
|
||||||
);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import '../application/auth/auth_bloc.dart';
|
import '../application/auth/auth_bloc.dart';
|
||||||
import '../application/auth/logout_form/logout_form_bloc.dart';
|
|
||||||
import '../application/customer/customer_point_loader/customer_point_loader_bloc.dart';
|
|
||||||
import '../common/theme/theme.dart';
|
import '../common/theme/theme.dart';
|
||||||
import '../common/constant/app_constant.dart';
|
import '../common/constant/app_constant.dart';
|
||||||
import '../injection.dart';
|
import '../injection.dart';
|
||||||
@ -23,11 +21,7 @@ class _AppWidgetState extends State<AppWidget> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [BlocProvider(create: (context) => getIt<AuthBloc>())],
|
||||||
BlocProvider(create: (context) => getIt<AuthBloc>()),
|
|
||||||
BlocProvider(create: (context) => getIt<LogoutFormBloc>()),
|
|
||||||
BlocProvider(create: (context) => getIt<CustomerPointLoaderBloc>()),
|
|
||||||
],
|
|
||||||
child: MaterialApp.router(
|
child: MaterialApp.router(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: AppConstant.appName,
|
title: AppConstant.appName,
|
||||||
|
|||||||
@ -1,26 +1,13 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../router/app_router.gr.dart';
|
import '../../router/app_router.gr.dart';
|
||||||
import 'widgets/bottom_navbar.dart';
|
import 'widgets/bottom_navbar.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class MainPage extends StatefulWidget {
|
class MainPage extends StatelessWidget {
|
||||||
const MainPage({super.key});
|
const MainPage({super.key});
|
||||||
|
|
||||||
@override
|
|
||||||
State<MainPage> createState() => _MainPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MainPageState extends State<MainPage> {
|
|
||||||
@override
|
|
||||||
initState() {
|
|
||||||
super.initState();
|
|
||||||
context.read<AuthBloc>().add(const AuthEvent.fetchCurrentUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AutoTabsRouter.pageView(
|
return AutoTabsRouter.pageView(
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../../../../application/customer/customer_point_loader/customer_point_loader_bloc.dart';
|
|
||||||
import '../../../../../common/theme/theme.dart';
|
import '../../../../../common/theme/theme.dart';
|
||||||
import '../../../../components/image/image.dart';
|
import '../../../../components/image/image.dart';
|
||||||
import '../../../../router/app_router.gr.dart';
|
import '../../../../router/app_router.gr.dart';
|
||||||
@ -33,16 +30,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
'https://images.unsplash.com/photo-1574848794584-c740d6a5595f?w=800&h=400&fit=crop',
|
'https://images.unsplash.com/photo-1574848794584-c740d6a5595f?w=800&h=400&fit=crop',
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
if (context.read<AuthBloc>().state.isAuthenticated) {
|
|
||||||
context.read<CustomerPointLoaderBloc>().add(
|
|
||||||
CustomerPointLoaderEvent.fetched(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -74,19 +61,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
top: 225,
|
top: 225,
|
||||||
child: _buildCarouselIndicators(),
|
child: _buildCarouselIndicators(),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(left: 16, right: 16, top: 240, child: HomePointCard()),
|
||||||
left: 16,
|
|
||||||
right: 16,
|
|
||||||
top: 240,
|
|
||||||
child: HomePointCard(
|
|
||||||
point: context
|
|
||||||
.read<CustomerPointLoaderBloc>()
|
|
||||||
.state
|
|
||||||
.customerPoint
|
|
||||||
.totalPoints
|
|
||||||
.toString(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import '../../../../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../../../../router/app_router.gr.dart';
|
import '../../../../../router/app_router.gr.dart';
|
||||||
import 'feature_card.dart';
|
import 'feature_card.dart';
|
||||||
|
|
||||||
@ -10,8 +8,6 @@ class HomeFeatureSection extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<AuthBloc, AuthState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -39,14 +35,10 @@ class HomeFeatureSection extends StatelessWidget {
|
|||||||
icon: Icons.blur_circular,
|
icon: Icons.blur_circular,
|
||||||
title: 'Wheels',
|
title: 'Wheels',
|
||||||
iconColor: const Color(0xFF388E3C),
|
iconColor: const Color(0xFF388E3C),
|
||||||
onTap: () => state.isAuthenticated
|
onTap: () => context.router.push(FerrisWheelRoute()),
|
||||||
? context.router.push(FerrisWheelRoute())
|
|
||||||
: context.router.push(OnboardingRoute()),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,16 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../../../../../common/theme/theme.dart';
|
import '../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../router/app_router.gr.dart';
|
import '../../../../../router/app_router.gr.dart';
|
||||||
|
|
||||||
class HomePointCard extends StatelessWidget {
|
class HomePointCard extends StatelessWidget {
|
||||||
final String point;
|
const HomePointCard({super.key});
|
||||||
const HomePointCard({super.key, required this.point});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<AuthBloc, AuthState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => state.isAuthenticated
|
onTap: () => context.router.push(PoinRoute()),
|
||||||
? context.router.push(PoinRoute())
|
|
||||||
: context.router.push(OnboardingRoute()),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
@ -40,20 +33,8 @@ class HomePointCard extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
!state.isAuthenticated
|
Column(
|
||||||
? Expanded(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Text(
|
|
||||||
'Hi, Selamat Datang Di Enaklo',
|
|
||||||
style: AppStyle.md.copyWith(
|
|
||||||
color: AppColor.primary,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
@ -62,9 +43,7 @@ class HomePointCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.primary,
|
color: AppColor.primary,
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(25),
|
||||||
25,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -76,7 +55,7 @@ class HomePointCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
'$point Poin',
|
'148 Poin',
|
||||||
style: AppStyle.md.copyWith(
|
style: AppStyle.md.copyWith(
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -87,7 +66,7 @@ class HomePointCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
'Kamu punya $point poin',
|
'Kamu punya 148 poin',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: AppColor.textSecondary,
|
color: AppColor.textSecondary,
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
@ -95,8 +74,7 @@ class HomePointCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
height: 40,
|
height: 40,
|
||||||
@ -141,9 +119,7 @@ class HomePointCard extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
state.isAuthenticated
|
'Tukarkan poinmu dengan hadiah menarik',
|
||||||
? 'Tukarkan poinmu dengan hadiah menarik'
|
|
||||||
: 'Silahkan login untuk tukarkan poinmu',
|
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: AppColor.textPrimary,
|
color: AppColor.textPrimary,
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
@ -165,8 +141,6 @@ class HomePointCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCoinPattern() {
|
Widget _buildCoinPattern() {
|
||||||
|
|||||||
@ -1,37 +1,19 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../../../../application/auth/logout_form/logout_form_bloc.dart';
|
|
||||||
import '../../../../../common/theme/theme.dart';
|
import '../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../injection.dart';
|
|
||||||
import '../../../../components/toast/flushbar.dart';
|
|
||||||
import '../../../../router/app_router.gr.dart';
|
import '../../../../router/app_router.gr.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
class ProfilePage extends StatelessWidget {
|
||||||
const ProfilePage({super.key});
|
const ProfilePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocListener<LogoutFormBloc, LogoutFormState>(
|
return Scaffold(
|
||||||
listener: (context, state) {
|
|
||||||
state.failureOrAuthOption.fold(
|
|
||||||
() => null,
|
|
||||||
(either) => either.fold(
|
|
||||||
(f) => AppFlushbar.showAuthFailureToast(context, f),
|
|
||||||
(_) => context.router.replaceAll([OnboardingRoute()]),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: AppColor.background,
|
backgroundColor: AppColor.background,
|
||||||
appBar: AppBar(title: Text('Profil'), automaticallyImplyLeading: false),
|
appBar: AppBar(title: Text('Profil'), automaticallyImplyLeading: false),
|
||||||
body: BlocBuilder<AuthBloc, AuthState>(
|
body: SingleChildScrollView(
|
||||||
builder: (context, state) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Profile Header
|
// Profile Header
|
||||||
@ -43,9 +25,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
children: [
|
children: [
|
||||||
// Profile Avatar & Info
|
// Profile Avatar & Info
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => state.isAuthenticated
|
onTap: () => context.router.push(AccountMyRoute()),
|
||||||
? context.router.push(AccountMyRoute())
|
|
||||||
: context.router.push(OnboardingRoute()),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
@ -128,22 +108,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
// Main Content
|
// Main Content
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: !state.isAuthenticated
|
child: Row(
|
||||||
? Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
'Silahkan Masuk',
|
|
||||||
style: AppStyle.lg.copyWith(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: AppColor.white,
|
|
||||||
letterSpacing: 0.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Row(
|
|
||||||
children: [
|
children: [
|
||||||
// Avatar
|
// Avatar
|
||||||
Container(
|
Container(
|
||||||
@ -154,8 +119,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: AppColor.black
|
color: AppColor.black.withOpacity(0.1),
|
||||||
.withOpacity(0.1),
|
|
||||||
blurRadius: 8,
|
blurRadius: 8,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
@ -175,20 +139,20 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
state.user.name,
|
'EFRIL',
|
||||||
style: AppStyle.lg.copyWith(
|
style: AppStyle.lg.copyWith(
|
||||||
fontWeight:
|
fontWeight: FontWeight.bold,
|
||||||
FontWeight.bold,
|
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
letterSpacing: 0.5,
|
letterSpacing: 0.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
state.user.phoneNumber,
|
'+6283873987851',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: AppColor.white
|
color: AppColor.white.withOpacity(
|
||||||
.withOpacity(0.9),
|
0.9,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -214,7 +178,6 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
// Menu Items
|
// Menu Items
|
||||||
if (state.isAuthenticated) ...[
|
|
||||||
Container(
|
Container(
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -243,8 +206,8 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
],
|
|
||||||
|
|
||||||
// Legal & Privacy Section
|
// Legal & Privacy Section
|
||||||
Container(
|
Container(
|
||||||
@ -285,9 +248,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'Customer Service kami siap untuk membantu',
|
'Customer Service kami siap untuk membantu',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||||
color: AppColor.textSecondary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// WhatsApp Customer Service
|
// WhatsApp Customer Service
|
||||||
@ -349,7 +310,6 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// Footer Section
|
// Footer Section
|
||||||
if (state.isAuthenticated)
|
|
||||||
Container(
|
Container(
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
@ -358,17 +318,10 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Version 4.6.1',
|
'Version 4.6.1',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||||
color: AppColor.textSecondary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _showLogoutDialog(
|
onTap: () => _showLogoutDialog(context),
|
||||||
context,
|
|
||||||
onLogout: () => context
|
|
||||||
.read<LogoutFormBloc>()
|
|
||||||
.add(const LogoutFormEvent.submitted()),
|
|
||||||
),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'Logout',
|
'Logout',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
@ -384,9 +337,6 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
const SizedBox(height: 100), // Bottom spacing
|
const SizedBox(height: 100), // Bottom spacing
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -422,10 +372,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showLogoutDialog(
|
void _showLogoutDialog(BuildContext context) {
|
||||||
BuildContext context, {
|
|
||||||
required VoidCallback onLogout,
|
|
||||||
}) {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -448,7 +395,6 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: onLogout,
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'Logout',
|
'Logout',
|
||||||
style: AppStyle.md.copyWith(
|
style: AppStyle.md.copyWith(
|
||||||
@ -456,14 +402,15 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
|||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
// Add logout logic here
|
||||||
|
// Example: context.router.pushAndClearStack('/login');
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Widget wrappedRoute(BuildContext context) =>
|
|
||||||
BlocProvider(create: (_) => getIt<LogoutFormBloc>(), child: this);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,6 @@ class PrizeHistory {
|
|||||||
final int value;
|
final int value;
|
||||||
final Color color;
|
final Color color;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final String? gamePrizeId; // Added for API integration
|
|
||||||
|
|
||||||
PrizeHistory({
|
PrizeHistory({
|
||||||
required this.prize,
|
required this.prize,
|
||||||
@ -28,73 +27,5 @@ class PrizeHistory {
|
|||||||
required this.value,
|
required this.value,
|
||||||
required this.color,
|
required this.color,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
this.gamePrizeId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// CopyWith method for updating properties
|
|
||||||
PrizeHistory copyWith({
|
|
||||||
String? prize,
|
|
||||||
DateTime? dateTime,
|
|
||||||
int? value,
|
|
||||||
Color? color,
|
|
||||||
IconData? icon,
|
|
||||||
String? gamePrizeId,
|
|
||||||
}) {
|
|
||||||
return PrizeHistory(
|
|
||||||
prize: prize ?? this.prize,
|
|
||||||
dateTime: dateTime ?? this.dateTime,
|
|
||||||
value: value ?? this.value,
|
|
||||||
color: color ?? this.color,
|
|
||||||
icon: icon ?? this.icon,
|
|
||||||
gamePrizeId: gamePrizeId ?? this.gamePrizeId,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert to Map for storage/API calls
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {
|
|
||||||
'prize': prize,
|
|
||||||
'dateTime': dateTime.toIso8601String(),
|
|
||||||
'value': value,
|
|
||||||
'gamePrizeId': gamePrizeId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create from Map for loading from storage/API
|
|
||||||
factory PrizeHistory.fromMap(
|
|
||||||
Map<String, dynamic> map, {
|
|
||||||
required Color color,
|
|
||||||
required IconData icon,
|
|
||||||
}) {
|
|
||||||
return PrizeHistory(
|
|
||||||
prize: map['prize'] ?? '',
|
|
||||||
dateTime: DateTime.tryParse(map['dateTime'] ?? '') ?? DateTime.now(),
|
|
||||||
value: map['value'] ?? 0,
|
|
||||||
color: color,
|
|
||||||
icon: icon,
|
|
||||||
gamePrizeId: map['gamePrizeId'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format date for display
|
|
||||||
String get formattedDate {
|
|
||||||
return '${dateTime.day.toString().padLeft(2, '0')}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.year} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get prize category based on value
|
|
||||||
String get prizeCategory {
|
|
||||||
if (value >= 1000000) return 'Jackpot';
|
|
||||||
if (value >= 100000) return 'Big Prize';
|
|
||||||
if (value >= 10000) return 'Medium Prize';
|
|
||||||
if (value >= 1000) return 'Small Prize';
|
|
||||||
return 'Token/Spin';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get prize category color
|
|
||||||
Color get categoryColor {
|
|
||||||
if (value >= 1000000) return const Color(0xFFFFD700); // Gold
|
|
||||||
if (value >= 100000) return const Color(0xFFC0C0C0); // Silver
|
|
||||||
if (value >= 10000) return const Color(0xFFCD7F32); // Bronze
|
|
||||||
return color; // Default color
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +1,18 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import '../../../../application/auth/auth_bloc.dart';
|
|
||||||
import '../../../../application/game/game_price_loader/game_prize_loader_bloc.dart';
|
|
||||||
import '../../../../common/theme/theme.dart';
|
import '../../../../common/theme/theme.dart';
|
||||||
import '../../../../common/painter/wheel_painter.dart';
|
import '../../../../common/painter/wheel_painter.dart';
|
||||||
import '../../../../injection.dart';
|
|
||||||
import '../../../../domain/game/game.dart';
|
|
||||||
import 'data/model.dart';
|
import 'data/model.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class FerrisWheelPage extends StatefulWidget implements AutoRouteWrapper {
|
class FerrisWheelPage extends StatefulWidget {
|
||||||
const FerrisWheelPage({super.key});
|
const FerrisWheelPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FerrisWheelPage> createState() => _FerrisWheelPageState();
|
State<FerrisWheelPage> createState() => _FerrisWheelPageState();
|
||||||
|
|
||||||
@override
|
|
||||||
Widget wrappedRoute(BuildContext context) => BlocProvider(
|
|
||||||
create: (context) => getIt<GamePrizeLoaderBloc>()
|
|
||||||
..add(
|
|
||||||
const GamePrizeLoaderEvent.fetched(
|
|
||||||
'28d5aed3-4c1b-4b7b-bad5-67cdd4919dc2',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: this,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FerrisWheelPageState extends State<FerrisWheelPage>
|
class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||||
@ -62,7 +45,56 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
|
|
||||||
// Game Data
|
// Game Data
|
||||||
List<PrizeHistory> prizeHistory = [];
|
List<PrizeHistory> prizeHistory = [];
|
||||||
List<GamePrize> gamePrizes = [];
|
List<WheelSection> wheelSections = [
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.primary,
|
||||||
|
icon: Icons.visibility,
|
||||||
|
prize: '1 JT',
|
||||||
|
value: 1000000,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.info,
|
||||||
|
icon: Icons.account_balance_wallet,
|
||||||
|
prize: '10RB',
|
||||||
|
value: 10000,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.warning,
|
||||||
|
icon: Icons.card_giftcard,
|
||||||
|
prize: '50',
|
||||||
|
value: 50,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.success,
|
||||||
|
icon: Icons.refresh,
|
||||||
|
prize: 'SPIN',
|
||||||
|
value: 1,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.primaryDark,
|
||||||
|
icon: Icons.visibility,
|
||||||
|
prize: '30',
|
||||||
|
value: 30,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.textLight,
|
||||||
|
icon: Icons.attach_money,
|
||||||
|
prize: '5RB',
|
||||||
|
value: 5000,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.secondary,
|
||||||
|
icon: Icons.redeem,
|
||||||
|
prize: '20',
|
||||||
|
value: 20,
|
||||||
|
),
|
||||||
|
WheelSection(
|
||||||
|
color: AppColor.info,
|
||||||
|
icon: Icons.monetization_on,
|
||||||
|
prize: '5RB',
|
||||||
|
value: 5000,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -114,8 +146,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
void _playWheelSpin() =>
|
void _playWheelSpin() =>
|
||||||
_playSound('audio/carnival/sfx/wheel_spin.mp3', volume: 0.8);
|
_playSound('audio/carnival/sfx/wheel_spin.mp3', volume: 0.8);
|
||||||
|
|
||||||
void _playWinSound(GamePrize prize) {
|
void _playWinSound(int prizeValue) {
|
||||||
int prizeValue = prize.metadata['value'] ?? prize.weight;
|
|
||||||
if (prizeValue >= 1000000) {
|
if (prizeValue >= 1000000) {
|
||||||
_playSound('audio/carnival/sfx/win_big.mp3', volume: 0.9);
|
_playSound('audio/carnival/sfx/win_big.mp3', volume: 0.9);
|
||||||
} else if (prizeValue >= 5000) {
|
} else if (prizeValue >= 5000) {
|
||||||
@ -167,73 +198,8 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
_idleRotationController.repeat();
|
_idleRotationController.repeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
int _selectPrizeWithWeight() {
|
|
||||||
if (gamePrizes.isEmpty) return 0;
|
|
||||||
|
|
||||||
final availablePrizes = gamePrizes
|
|
||||||
.asMap()
|
|
||||||
.entries
|
|
||||||
.where((entry) => entry.value.stock > 0)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if (availablePrizes.isEmpty) {
|
|
||||||
return math.Random().nextInt(gamePrizes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalWeight = availablePrizes
|
|
||||||
.map((entry) => entry.value.weight)
|
|
||||||
.reduce((a, b) => a + b);
|
|
||||||
|
|
||||||
if (totalWeight <= 0) {
|
|
||||||
final randomEntry =
|
|
||||||
availablePrizes[math.Random().nextInt(availablePrizes.length)];
|
|
||||||
return randomEntry.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
int randomWeight = math.Random().nextInt(totalWeight);
|
|
||||||
int currentWeight = 0;
|
|
||||||
|
|
||||||
for (final entry in availablePrizes) {
|
|
||||||
currentWeight += entry.value.weight;
|
|
||||||
if (randomWeight < currentWeight) {
|
|
||||||
return entry.key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return availablePrizes.last.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
Color _getPrizeColor(GamePrize prize, int index) {
|
|
||||||
final colorName = prize.metadata['color'] as String?;
|
|
||||||
switch (colorName?.toLowerCase()) {
|
|
||||||
case 'primary':
|
|
||||||
return AppColor.primary;
|
|
||||||
case 'info':
|
|
||||||
return AppColor.info;
|
|
||||||
case 'warning':
|
|
||||||
return AppColor.warning;
|
|
||||||
case 'success':
|
|
||||||
return AppColor.success;
|
|
||||||
case 'error':
|
|
||||||
return AppColor.error;
|
|
||||||
case 'secondary':
|
|
||||||
return AppColor.secondary;
|
|
||||||
default:
|
|
||||||
final colors = [
|
|
||||||
AppColor.primary,
|
|
||||||
AppColor.info,
|
|
||||||
AppColor.warning,
|
|
||||||
AppColor.success,
|
|
||||||
AppColor.primaryDark,
|
|
||||||
AppColor.secondary,
|
|
||||||
AppColor.error,
|
|
||||||
];
|
|
||||||
return colors[index % colors.length];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _spinWheel() {
|
void _spinWheel() {
|
||||||
if (isSpinning || tokens <= 0 || gamePrizes.isEmpty) return;
|
if (isSpinning || tokens <= 0) return;
|
||||||
|
|
||||||
_playWheelSpin();
|
_playWheelSpin();
|
||||||
_playTokenSound();
|
_playTokenSound();
|
||||||
@ -246,8 +212,8 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
|
|
||||||
_idleRotationController.stop();
|
_idleRotationController.stop();
|
||||||
|
|
||||||
int targetSection = _selectPrizeWithWeight();
|
int targetSection = math.Random().nextInt(8);
|
||||||
double sectionAngle = (2 * math.pi) / gamePrizes.length;
|
double sectionAngle = (2 * math.pi) / 8;
|
||||||
double targetAngle = (targetSection * sectionAngle) + (sectionAngle / 2);
|
double targetAngle = (targetSection * sectionAngle) + (sectionAngle / 2);
|
||||||
double baseRotations = 4 + math.Random().nextDouble() * 3;
|
double baseRotations = 4 + math.Random().nextDouble() * 3;
|
||||||
double currentIdleRotation = _idleRotationAnimation?.value ?? 0.0;
|
double currentIdleRotation = _idleRotationAnimation?.value ?? 0.0;
|
||||||
@ -270,40 +236,32 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
|
|
||||||
_rotationController.reset();
|
_rotationController.reset();
|
||||||
_rotationController.animateTo(1.0).then((_) {
|
_rotationController.animateTo(1.0).then((_) {
|
||||||
final wonPrize = gamePrizes[targetSection];
|
_playWinSound(wheelSections[targetSection].value);
|
||||||
_playWinSound(wonPrize);
|
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
currentRotation = finalRotation;
|
currentRotation = finalRotation;
|
||||||
isSpinning = false;
|
isSpinning = false;
|
||||||
resultText = 'Selamat! Anda mendapat ${wonPrize.name}!';
|
resultText =
|
||||||
|
'Selamat! Anda mendapat ${wheelSections[targetSection].prize}!';
|
||||||
if (wonPrize.stock > 0) {
|
|
||||||
gamePrizes[targetSection] = wonPrize.copyWith(
|
|
||||||
stock: wonPrize.stock - 1,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
prizeHistory.insert(
|
prizeHistory.insert(
|
||||||
0,
|
0,
|
||||||
PrizeHistory(
|
PrizeHistory(
|
||||||
prize: wonPrize.name,
|
prize: wheelSections[targetSection].prize,
|
||||||
dateTime: DateTime.now(),
|
dateTime: DateTime.now(),
|
||||||
value: wonPrize.metadata['value'] ?? wonPrize.weight,
|
value: wheelSections[targetSection].value,
|
||||||
color: _getPrizeColor(wonPrize, targetSection),
|
color: wheelSections[targetSection].color,
|
||||||
icon: Icons.card_giftcard,
|
icon: wheelSections[targetSection].icon,
|
||||||
gamePrizeId: wonPrize.id,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
_showWinDialog(wonPrize);
|
_showWinDialog(wheelSections[targetSection]);
|
||||||
_idleRotationController.reset();
|
_idleRotationController.reset();
|
||||||
_idleRotationController.repeat();
|
_idleRotationController.repeat();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showWinDialog(GamePrize wonPrize) {
|
void _showWinDialog(WheelSection section) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@ -336,11 +294,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(section.icon, color: section.color, size: 40),
|
||||||
Icons.card_giftcard,
|
|
||||||
color: AppColor.primary,
|
|
||||||
size: 40,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
@ -357,21 +311,12 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
wonPrize.name,
|
section.prize,
|
||||||
style: AppStyle.h5.copyWith(
|
style: AppStyle.h5.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: AppColor.textWhite,
|
color: AppColor.textWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (wonPrize.stock >= 0) ...[
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'Stok tersisa: ${wonPrize.stock}',
|
|
||||||
style: AppStyle.sm.copyWith(
|
|
||||||
color: AppColor.textWhite.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -406,33 +351,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<GamePrizeLoaderBloc, GamePrizeLoaderState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state.isFetching) {
|
|
||||||
return Scaffold(
|
|
||||||
body: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: AppColor.primaryGradient,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: SpinKitFadingCircle(color: AppColor.textWhite, size: 36),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gamePrizes.isEmpty && state.gamePrize.isNotEmpty) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
setState(() {
|
|
||||||
gamePrizes = state.gamePrize;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Container(
|
body: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -474,18 +392,14 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: _toggleMusic,
|
onPressed: _toggleMusic,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
_isMusicEnabled
|
_isMusicEnabled ? Icons.volume_up : Icons.volume_off,
|
||||||
? Icons.volume_up
|
|
||||||
: Icons.volume_off,
|
|
||||||
color: AppColor.textWhite,
|
color: AppColor.textWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: _toggleSound,
|
onPressed: _toggleSound,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
_isSoundEnabled
|
_isSoundEnabled ? Icons.graphic_eq : Icons.volume_mute,
|
||||||
? Icons.graphic_eq
|
|
||||||
: Icons.volume_mute,
|
|
||||||
color: AppColor.textWhite,
|
color: AppColor.textWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -510,9 +424,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
setState(() => currentTabIndex = i);
|
setState(() => currentTabIndex = i);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
vertical: 12,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: currentTabIndex == i
|
color: currentTabIndex == i
|
||||||
? AppColor.white
|
? AppColor.white
|
||||||
@ -551,8 +463,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainContent() {
|
Widget _buildMainContent() {
|
||||||
@ -576,9 +486,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BlocBuilder<AuthBloc, AuthState>(
|
Row(
|
||||||
builder: (context, auth) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
@ -602,14 +510,14 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
auth.user.name,
|
'GPY268e42',
|
||||||
style: AppStyle.lg.copyWith(
|
style: AppStyle.lg.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: AppColor.textPrimary,
|
color: AppColor.textPrimary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
auth.user.phoneNumber,
|
'Warrior',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: AppColor.textSecondary,
|
color: AppColor.textSecondary,
|
||||||
),
|
),
|
||||||
@ -617,8 +525,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@ -658,9 +564,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
// Wheel Section
|
// Wheel Section
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: gamePrizes.isEmpty
|
child: Stack(
|
||||||
? SpinKitFadingCircle(color: AppColor.textWhite, size: 36)
|
|
||||||
: Stack(
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
// Glow Effect
|
// Glow Effect
|
||||||
@ -699,10 +603,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
angle: rotationAngle,
|
angle: rotationAngle,
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
size: const Size(320, 320),
|
size: const Size(320, 320),
|
||||||
painter: WheelPainter(
|
painter: WheelPainter(sections: wheelSections),
|
||||||
gamePrizes: gamePrizes,
|
|
||||||
getPrizeColor: _getPrizeColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -711,8 +612,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
// Spin Button
|
// Spin Button
|
||||||
AnimatedBuilder(
|
AnimatedBuilder(
|
||||||
animation:
|
animation:
|
||||||
_pulseAnimation ??
|
_pulseAnimation ?? const AlwaysStoppedAnimation(1.0),
|
||||||
const AlwaysStoppedAnimation(1.0),
|
|
||||||
builder: (context, child) => Transform.scale(
|
builder: (context, child) => Transform.scale(
|
||||||
scale: _pulseAnimation?.value ?? 1.0,
|
scale: _pulseAnimation?.value ?? 1.0,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -732,8 +632,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: AppColor.warning.withOpacity(0.5),
|
color: AppColor.warning.withOpacity(0.5),
|
||||||
blurRadius: 20,
|
blurRadius: 20,
|
||||||
spreadRadius:
|
spreadRadius: (_pulseAnimation?.value ?? 1.0) * 5,
|
||||||
(_pulseAnimation?.value ?? 1.0) * 5,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -766,18 +665,9 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
height: 0,
|
height: 0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(width: 15, color: Colors.transparent),
|
||||||
width: 15,
|
right: BorderSide(width: 15, color: Colors.transparent),
|
||||||
color: Colors.transparent,
|
bottom: BorderSide(width: 30, color: AppColor.error),
|
||||||
),
|
|
||||||
right: BorderSide(
|
|
||||||
width: 15,
|
|
||||||
color: Colors.transparent,
|
|
||||||
),
|
|
||||||
bottom: BorderSide(
|
|
||||||
width: 30,
|
|
||||||
color: AppColor.error,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -839,17 +729,10 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: gamePrizes.isEmpty
|
child: ListView.builder(
|
||||||
? Center(
|
itemCount: wheelSections.length,
|
||||||
child: SpinKitFadingCircle(
|
|
||||||
color: AppColor.white.withOpacity(0.7),
|
|
||||||
size: 36,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ListView.builder(
|
|
||||||
itemCount: gamePrizes.length,
|
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final prize = gamePrizes[index];
|
final section = wheelSections[index];
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
@ -870,11 +753,11 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _getPrizeColor(prize, index),
|
color: section.color,
|
||||||
borderRadius: BorderRadius.circular(25),
|
borderRadius: BorderRadius.circular(25),
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.card_giftcard,
|
section.icon,
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
size: 24,
|
size: 24,
|
||||||
),
|
),
|
||||||
@ -885,26 +768,18 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
prize.name,
|
section.prize,
|
||||||
style: AppStyle.lg.copyWith(
|
style: AppStyle.lg.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: AppColor.textPrimary,
|
color: AppColor.textPrimary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Nilai: ${prize.metadata['value'] ?? prize.weight}',
|
'Nilai: ${section.value}',
|
||||||
style: AppStyle.sm.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: AppColor.textSecondary,
|
color: AppColor.textSecondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
|
||||||
'Stok: ${prize.stock}/${prize.maxStock}',
|
|
||||||
style: AppStyle.xs.copyWith(
|
|
||||||
color: prize.stock > 0
|
|
||||||
? AppColor.success
|
|
||||||
: AppColor.error,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -914,16 +789,13 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
vertical: 6,
|
vertical: 6,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _getPrizeColor(
|
color: section.color.withOpacity(0.1),
|
||||||
prize,
|
|
||||||
index,
|
|
||||||
).withOpacity(0.1),
|
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Weight: ${prize.weight}',
|
'Hadiah',
|
||||||
style: AppStyle.xs.copyWith(
|
style: AppStyle.sm.copyWith(
|
||||||
color: _getPrizeColor(prize, index),
|
color: section.color,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1046,14 +918,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
|||||||
color: AppColor.textSecondary,
|
color: AppColor.textSecondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (history.gamePrizeId != null)
|
|
||||||
Text(
|
|
||||||
'ID: ${history.gamePrizeId}',
|
|
||||||
style: AppStyle.xs.copyWith(
|
|
||||||
color: AppColor.textSecondary
|
|
||||||
.withOpacity(0.7),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../application/customer/customer_point_loader/customer_point_loader_bloc.dart';
|
|
||||||
import '../../../common/theme/theme.dart';
|
import '../../../common/theme/theme.dart';
|
||||||
import '../../router/app_router.gr.dart';
|
import '../../router/app_router.gr.dart';
|
||||||
|
|
||||||
@ -203,9 +201,6 @@ class _PoinPageState extends State<PoinPage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
activeCategoryId = categories.first.id; // Set first category as active
|
activeCategoryId = categories.first.id; // Set first category as active
|
||||||
_initializeCategoryKeys();
|
_initializeCategoryKeys();
|
||||||
context.read<CustomerPointLoaderBloc>().add(
|
|
||||||
CustomerPointLoaderEvent.fetched(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initializeCategoryKeys() {
|
void _initializeCategoryKeys() {
|
||||||
@ -309,8 +304,6 @@ class _PoinPageState extends State<PoinPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPointCard() {
|
Widget _buildPointCard() {
|
||||||
return BlocBuilder<CustomerPointLoaderBloc, CustomerPointLoaderState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.all(16),
|
margin: EdgeInsets.all(16),
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
@ -338,16 +331,16 @@ class _PoinPageState extends State<PoinPage> {
|
|||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Text(
|
|
||||||
// "",
|
|
||||||
// style: AppStyle.sm.copyWith(
|
|
||||||
// color: AppColor.textWhite.withOpacity(0.9),
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 4),
|
|
||||||
Text(
|
Text(
|
||||||
"${state.customerPoint.totalPoints}",
|
pointCard.membershipLevel,
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.textWhite.withOpacity(0.9),
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
"${pointCard.availablePoints}",
|
||||||
style: AppStyle.h2.copyWith(
|
style: AppStyle.h2.copyWith(
|
||||||
color: AppColor.textWhite,
|
color: AppColor.textWhite,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
@ -375,49 +368,46 @@ class _PoinPageState extends State<PoinPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
// SizedBox(height: 16),
|
Container(
|
||||||
// Container(
|
height: 8,
|
||||||
// height: 8,
|
decoration: BoxDecoration(
|
||||||
// decoration: BoxDecoration(
|
color: AppColor.white.withOpacity(0.3),
|
||||||
// color: AppColor.white.withOpacity(0.3),
|
borderRadius: BorderRadius.circular(4),
|
||||||
// borderRadius: BorderRadius.circular(4),
|
),
|
||||||
// ),
|
child: FractionallySizedBox(
|
||||||
// child: FractionallySizedBox(
|
widthFactor:
|
||||||
// widthFactor:
|
(pointCard.totalPoints - pointCard.usedPoints) /
|
||||||
// (pointCard.totalPoints - pointCard.usedPoints) /
|
pointCard.totalPoints,
|
||||||
// pointCard.totalPoints,
|
alignment: Alignment.centerLeft,
|
||||||
// alignment: Alignment.centerLeft,
|
child: Container(
|
||||||
// child: Container(
|
decoration: BoxDecoration(
|
||||||
// decoration: BoxDecoration(
|
color: AppColor.textWhite,
|
||||||
// color: AppColor.textWhite,
|
borderRadius: BorderRadius.circular(4),
|
||||||
// borderRadius: BorderRadius.circular(4),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
SizedBox(height: 8),
|
||||||
// SizedBox(height: 8),
|
Row(
|
||||||
// Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
// children: [
|
Text(
|
||||||
// Text(
|
"Terpakai: ${pointCard.usedPoints}",
|
||||||
// "Terpakai: ${pointCard.usedPoints}",
|
style: AppStyle.xs.copyWith(
|
||||||
// style: AppStyle.xs.copyWith(
|
color: AppColor.textWhite.withOpacity(0.8),
|
||||||
// color: AppColor.textWhite.withOpacity(0.8),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
Text(
|
||||||
// Text(
|
"Total: ${pointCard.totalPoints}",
|
||||||
// "Total: ${pointCard.totalPoints}",
|
style: AppStyle.xs.copyWith(
|
||||||
// style: AppStyle.xs.copyWith(
|
color: AppColor.textWhite.withOpacity(0.8),
|
||||||
// color: AppColor.textWhite.withOpacity(0.8),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
],
|
||||||
// ],
|
),
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -252,7 +252,7 @@ class FerrisWheelRoute extends _i33.PageRouteInfo<void> {
|
|||||||
static _i33.PageInfo page = _i33.PageInfo(
|
static _i33.PageInfo page = _i33.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return _i33.WrappedRoute(child: const _i10.FerrisWheelPage());
|
return const _i10.FerrisWheelPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ class ProfileRoute extends _i33.PageRouteInfo<void> {
|
|||||||
static _i33.PageInfo page = _i33.PageInfo(
|
static _i33.PageInfo page = _i33.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return _i33.WrappedRoute(child: const _i27.ProfilePage());
|
return const _i27.ProfilePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user