EnakPoint & EnakCoin wallet, PIN, outlet, order, community, reward

- Wallet EnakPoint & EnakCoin: beranda, riwayat, saldo kedaluwarsa, kode
  bayar, tukar EnakCoin, transfer
- PIN (buat, ganti, lupa), outlet, riwayat order, game spin
- Halaman community, webview, coming soon, dan ikon menu beranda baru
- Redesign Reward Saya: kartu tiket, filter chip, detail kode + QR
- Hapus customer point loader, menu, dan checkout lama
- Base URL ke enaklo-pos-api.altru.id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-10-01 01:43:22 +07:00
co-authored by Claude Opus 5.5
parent 5954510b93
commit f5e3075205
253 changed files with 47212 additions and 17437 deletions
@@ -0,0 +1,40 @@
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_spin_event.dart';
part 'game_spin_state.dart';
part 'game_spin_bloc.freezed.dart';
@injectable
class GameSpinBloc extends Bloc<GameSpinEvent, GameSpinState> {
final IGameRepository _repository;
GameSpinBloc(this._repository) : super(GameSpinState.initial()) {
on<GameSpinEvent>(_onGameSpinEvent);
}
Future<void> _onGameSpinEvent(
GameSpinEvent event,
Emitter<GameSpinState> emit,
) {
return event.map(
spun: (e) async {
if (state.isSpinning) return;
emit(state.copyWith(isSpinning: true, failureOrResultOption: none()));
final result = await _repository.spin(gameId: e.gameId);
emit(
state.copyWith(
isSpinning: false,
failureOrResultOption: optionOf(result),
),
);
},
);
}
}
@@ -0,0 +1,546 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'game_spin_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GameSpinEvent {
String get gameId;
/// Create a copy of GameSpinEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GameSpinEventCopyWith<GameSpinEvent> get copyWith => _$GameSpinEventCopyWithImpl<GameSpinEvent>(this as GameSpinEvent, _$identity);
@override
bool operator ==(Object other) {
final _this = this as GameSpinEvent;
return identical(this, other) || (other.runtimeType == runtimeType&&other is GameSpinEvent&&(identical(other.gameId, _this.gameId) || other.gameId == _this.gameId));
}
@override
int get hashCode {
final _this = this as GameSpinEvent;
return Object.hash(runtimeType,_this.gameId);
}
@override
String toString() {
final _this = this as GameSpinEvent;
return 'GameSpinEvent(gameId: ${_this.gameId})';
}
}
/// @nodoc
abstract mixin class $GameSpinEventCopyWith<$Res> {
factory $GameSpinEventCopyWith(GameSpinEvent value, $Res Function(GameSpinEvent) _then) = _$GameSpinEventCopyWithImpl;
@useResult
$Res call({
String gameId
});
}
/// @nodoc
class _$GameSpinEventCopyWithImpl<$Res>
implements $GameSpinEventCopyWith<$Res> {
_$GameSpinEventCopyWithImpl(this._self, this._then);
final GameSpinEvent _self;
final $Res Function(GameSpinEvent) _then;
/// Create a copy of GameSpinEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? gameId = null,}) {
return _then(GameSpinEvent.spun(
null == gameId ? _self.gameId : gameId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [GameSpinEvent].
extension GameSpinEventPatterns on GameSpinEvent {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Spun value)? spun,required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Spun() when spun != null:
return spun(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Spun value) spun,}){
final _that = this;
switch (_that) {
case _Spun():
return spun(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Spun value)? spun,}){
final _that = this;
switch (_that) {
case _Spun() when spun != null:
return spun(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( String gameId)? spun,required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Spun() when spun != null:
return spun(_that.gameId);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( String gameId) spun,}) {final _that = this;
switch (_that) {
case _Spun():
return spun(_that.gameId);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( String gameId)? spun,}) {final _that = this;
switch (_that) {
case _Spun() when spun != null:
return spun(_that.gameId);case _:
return null;
}
}
}
/// @nodoc
class _Spun implements GameSpinEvent {
const _Spun(this.gameId);
@override final String gameId;
/// Create a copy of GameSpinEvent
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SpunCopyWith<_Spun> get copyWith => __$SpunCopyWithImpl<_Spun>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Spun&&(identical(other.gameId, gameId) || other.gameId == gameId));
}
@override
int get hashCode {
return Object.hash(runtimeType,gameId);
}
@override
String toString() {
return 'GameSpinEvent.spun(gameId: $gameId)';
}
}
/// @nodoc
abstract mixin class _$SpunCopyWith<$Res> implements $GameSpinEventCopyWith<$Res> {
factory _$SpunCopyWith(_Spun value, $Res Function(_Spun) _then) = __$SpunCopyWithImpl;
@override @useResult
$Res call({
String gameId
});
}
/// @nodoc
class __$SpunCopyWithImpl<$Res>
implements _$SpunCopyWith<$Res> {
__$SpunCopyWithImpl(this._self, this._then);
final _Spun _self;
final $Res Function(_Spun) _then;
/// Create a copy of GameSpinEvent
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? gameId = null,}) {
return _then(_Spun(
null == gameId ? _self.gameId : gameId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
mixin _$GameSpinState {
bool get isSpinning; Option<Either<GameFailure, SpinResult>> get failureOrResultOption;
/// Create a copy of GameSpinState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GameSpinStateCopyWith<GameSpinState> get copyWith => _$GameSpinStateCopyWithImpl<GameSpinState>(this as GameSpinState, _$identity);
@override
bool operator ==(Object other) {
final _this = this as GameSpinState;
return identical(this, other) || (other.runtimeType == runtimeType&&other is GameSpinState&&(identical(other.isSpinning, _this.isSpinning) || other.isSpinning == _this.isSpinning)&&(identical(other.failureOrResultOption, _this.failureOrResultOption) || other.failureOrResultOption == _this.failureOrResultOption));
}
@override
int get hashCode {
final _this = this as GameSpinState;
return Object.hash(runtimeType,_this.isSpinning,_this.failureOrResultOption);
}
@override
String toString() {
final _this = this as GameSpinState;
return 'GameSpinState(isSpinning: ${_this.isSpinning}, failureOrResultOption: ${_this.failureOrResultOption})';
}
}
/// @nodoc
abstract mixin class $GameSpinStateCopyWith<$Res> {
factory $GameSpinStateCopyWith(GameSpinState value, $Res Function(GameSpinState) _then) = _$GameSpinStateCopyWithImpl;
@useResult
$Res call({
bool isSpinning, Option<Either<GameFailure, SpinResult>> failureOrResultOption
});
}
/// @nodoc
class _$GameSpinStateCopyWithImpl<$Res>
implements $GameSpinStateCopyWith<$Res> {
_$GameSpinStateCopyWithImpl(this._self, this._then);
final GameSpinState _self;
final $Res Function(GameSpinState) _then;
/// Create a copy of GameSpinState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isSpinning = null,Object? failureOrResultOption = null,}) {
return _then(GameSpinState(
isSpinning: null == isSpinning ? _self.isSpinning : isSpinning // ignore: cast_nullable_to_non_nullable
as bool,failureOrResultOption: null == failureOrResultOption ? _self.failureOrResultOption : failureOrResultOption // ignore: cast_nullable_to_non_nullable
as Option<Either<GameFailure, SpinResult>>,
));
}
}
/// Adds pattern-matching-related methods to [GameSpinState].
extension GameSpinStatePatterns on GameSpinState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GameSpinState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GameSpinState() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GameSpinState value) $default,){
final _that = this;
switch (_that) {
case _GameSpinState():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GameSpinState value)? $default,){
final _that = this;
switch (_that) {
case _GameSpinState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isSpinning, Option<Either<GameFailure, SpinResult>> failureOrResultOption)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GameSpinState() when $default != null:
return $default(_that.isSpinning,_that.failureOrResultOption);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isSpinning, Option<Either<GameFailure, SpinResult>> failureOrResultOption) $default,) {final _that = this;
switch (_that) {
case _GameSpinState():
return $default(_that.isSpinning,_that.failureOrResultOption);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isSpinning, Option<Either<GameFailure, SpinResult>> failureOrResultOption)? $default,) {final _that = this;
switch (_that) {
case _GameSpinState() when $default != null:
return $default(_that.isSpinning,_that.failureOrResultOption);case _:
return null;
}
}
}
/// @nodoc
class _GameSpinState implements GameSpinState {
const _GameSpinState({this.isSpinning = false, required this.failureOrResultOption});
@override@JsonKey() final bool isSpinning;
@override final Option<Either<GameFailure, SpinResult>> failureOrResultOption;
/// Create a copy of GameSpinState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GameSpinStateCopyWith<_GameSpinState> get copyWith => __$GameSpinStateCopyWithImpl<_GameSpinState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GameSpinState&&(identical(other.isSpinning, isSpinning) || other.isSpinning == isSpinning)&&(identical(other.failureOrResultOption, failureOrResultOption) || other.failureOrResultOption == failureOrResultOption));
}
@override
int get hashCode {
return Object.hash(runtimeType,isSpinning,failureOrResultOption);
}
@override
String toString() {
return 'GameSpinState(isSpinning: $isSpinning, failureOrResultOption: $failureOrResultOption)';
}
}
/// @nodoc
abstract mixin class _$GameSpinStateCopyWith<$Res> implements $GameSpinStateCopyWith<$Res> {
factory _$GameSpinStateCopyWith(_GameSpinState value, $Res Function(_GameSpinState) _then) = __$GameSpinStateCopyWithImpl;
@override @useResult
$Res call({
bool isSpinning, Option<Either<GameFailure, SpinResult>> failureOrResultOption
});
}
/// @nodoc
class __$GameSpinStateCopyWithImpl<$Res>
implements _$GameSpinStateCopyWith<$Res> {
__$GameSpinStateCopyWithImpl(this._self, this._then);
final _GameSpinState _self;
final $Res Function(_GameSpinState) _then;
/// Create a copy of GameSpinState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isSpinning = null,Object? failureOrResultOption = null,}) {
return _then(_GameSpinState(
isSpinning: null == isSpinning ? _self.isSpinning : isSpinning // ignore: cast_nullable_to_non_nullable
as bool,failureOrResultOption: null == failureOrResultOption ? _self.failureOrResultOption : failureOrResultOption // ignore: cast_nullable_to_non_nullable
as Option<Either<GameFailure, SpinResult>>,
));
}
}
// dart format on
@@ -0,0 +1,6 @@
part of 'game_spin_bloc.dart';
@freezed
abstract class GameSpinEvent with _$GameSpinEvent {
const factory GameSpinEvent.spun(String gameId) = _Spun;
}
@@ -0,0 +1,12 @@
part of 'game_spin_bloc.dart';
@freezed
abstract class GameSpinState with _$GameSpinState {
const factory GameSpinState({
@Default(false) bool isSpinning,
required Option<Either<GameFailure, SpinResult>> failureOrResultOption,
}) = _GameSpinState;
factory GameSpinState.initial() =>
GameSpinState(failureOrResultOption: none());
}