Initial commit

This commit is contained in:
jahongireshonqulov
2025-10-23 19:34:54 +05:00
commit 41d8a38471
212 changed files with 8757 additions and 0 deletions

View File

View File

@@ -0,0 +1,19 @@
import 'package:food_delivery_client/food_delivery_client.dart';
part 'splash_event.dart';
part 'splash_state.dart';
part 'splash_bloc.freezed.dart';
@injectable
class SplashBloc extends Bloc<SplashEvent, SplashState> {
SplashBloc() : super(const SplashState()) {
on<_Started>(_onStarted);
}
Future<void> _onStarted(_Started event, Emitter<SplashState> emit) async {
await Future.delayed(TimeDelayConst.duration3);
emit(state.copyWith(status: RequestStatus.loaded));
}
}

View File

@@ -0,0 +1,463 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'splash_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SplashEvent {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SplashEvent);
}
@override
int get hashCode => runtimeType.hashCode;
@override
String toString() {
return 'SplashEvent()';
}
}
/// @nodoc
class $SplashEventCopyWith<$Res> {
$SplashEventCopyWith(SplashEvent _, $Res Function(SplashEvent) __);
}
/// Adds pattern-matching-related methods to [SplashEvent].
extension SplashEventPatterns on SplashEvent {
/// 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( _Started value)? started,required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Started() when started != null:
return started(_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( _Started value) started,}){
final _that = this;
switch (_that) {
case _Started():
return started(_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( _Started value)? started,}){
final _that = this;
switch (_that) {
case _Started() when started != null:
return started(_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()? started,required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Started() when started != null:
return started();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() started,}) {final _that = this;
switch (_that) {
case _Started():
return started();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()? started,}) {final _that = this;
switch (_that) {
case _Started() when started != null:
return started();case _:
return null;
}
}
}
/// @nodoc
class _Started implements SplashEvent {
const _Started();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
}
@override
int get hashCode => runtimeType.hashCode;
@override
String toString() {
return 'SplashEvent.started()';
}
}
/// @nodoc
mixin _$SplashState {
RequestStatus get status;
/// Create a copy of SplashState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SplashStateCopyWith<SplashState> get copyWith => _$SplashStateCopyWithImpl<SplashState>(this as SplashState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SplashState&&(identical(other.status, status) || other.status == status));
}
@override
int get hashCode => Object.hash(runtimeType,status);
@override
String toString() {
return 'SplashState(status: $status)';
}
}
/// @nodoc
abstract mixin class $SplashStateCopyWith<$Res> {
factory $SplashStateCopyWith(SplashState value, $Res Function(SplashState) _then) = _$SplashStateCopyWithImpl;
@useResult
$Res call({
RequestStatus status
});
}
/// @nodoc
class _$SplashStateCopyWithImpl<$Res>
implements $SplashStateCopyWith<$Res> {
_$SplashStateCopyWithImpl(this._self, this._then);
final SplashState _self;
final $Res Function(SplashState) _then;
/// Create a copy of SplashState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
return _then(_self.copyWith(
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as RequestStatus,
));
}
}
/// Adds pattern-matching-related methods to [SplashState].
extension SplashStatePatterns on SplashState {
/// 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( _SplashState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _SplashState() 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( _SplashState value) $default,){
final _that = this;
switch (_that) {
case _SplashState():
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( _SplashState value)? $default,){
final _that = this;
switch (_that) {
case _SplashState() 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( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SplashState() when $default != null:
return $default(_that.status);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( RequestStatus status) $default,) {final _that = this;
switch (_that) {
case _SplashState():
return $default(_that.status);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( RequestStatus status)? $default,) {final _that = this;
switch (_that) {
case _SplashState() when $default != null:
return $default(_that.status);case _:
return null;
}
}
}
/// @nodoc
class _SplashState implements SplashState {
const _SplashState({this.status = RequestStatus.initial});
@override@JsonKey() final RequestStatus status;
/// Create a copy of SplashState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SplashStateCopyWith<_SplashState> get copyWith => __$SplashStateCopyWithImpl<_SplashState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SplashState&&(identical(other.status, status) || other.status == status));
}
@override
int get hashCode => Object.hash(runtimeType,status);
@override
String toString() {
return 'SplashState(status: $status)';
}
}
/// @nodoc
abstract mixin class _$SplashStateCopyWith<$Res> implements $SplashStateCopyWith<$Res> {
factory _$SplashStateCopyWith(_SplashState value, $Res Function(_SplashState) _then) = __$SplashStateCopyWithImpl;
@override @useResult
$Res call({
RequestStatus status
});
}
/// @nodoc
class __$SplashStateCopyWithImpl<$Res>
implements _$SplashStateCopyWith<$Res> {
__$SplashStateCopyWithImpl(this._self, this._then);
final _SplashState _self;
final $Res Function(_SplashState) _then;
/// Create a copy of SplashState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
return _then(_SplashState(
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as RequestStatus,
));
}
}
// dart format on

View File

@@ -0,0 +1,6 @@
part of 'splash_bloc.dart';
@freezed
class SplashEvent with _$SplashEvent {
const factory SplashEvent.started() = _Started;
}

View File

@@ -0,0 +1,8 @@
part of 'splash_bloc.dart';
@freezed
abstract class SplashState with _$SplashState {
const factory SplashState({
@Default(RequestStatus.initial) RequestStatus status,
}) = _SplashState;
}

View File

@@ -0,0 +1,37 @@
import 'package:flutter_svg/flutter_svg.dart';
import 'package:food_delivery_client/feature/on_boarding/presentation/blocs/splash_bloc/splash_bloc.dart';
import '../../../../../food_delivery_client.dart';
class SplashPage extends StatelessWidget {
const SplashPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => sl<SplashBloc>()..add(SplashEvent.started()),
child: BlocListener<SplashBloc, SplashState>(
listener: (context, state) {
if (state.status.isLoaded()) {
context.go(Routes.main);
}
},
child: Scaffold(
backgroundColor: AppColors.c142328,
body: Align(
alignment: AlignmentGeometry.center,
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(AppIcons.icUber),
SvgPicture.asset(AppIcons.icEat),
],
),
),
),
),
);
}
}