feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -10,7 +10,7 @@ import 'package:eatvio_app/features/profile/repositories/profile_repository.dart
import 'package:flutter_bloc/flutter_bloc.dart';
class AboutDietCubit extends Cubit<AboutDietState> {
AboutDietCubit({required this.dietsRepository, required this.profileRepository}) : super(AboutDietState.initial());
AboutDietCubit({required this.dietsRepository, required this.profileRepository}) : super(const AboutDietState.initial());
final DietRepository dietsRepository;
final ProfileRepository profileRepository;
bool isCurrentDietStarted = false;
@@ -32,7 +32,7 @@ class AboutDietCubit extends Cubit<AboutDietState> {
Future<void> initDietPage(int id) async {
try {
emit(AboutDietState.loading());
emit(const AboutDietState.loading());
final diet = await dietsRepository.getDiet(id);
final chosenDiets = await profileRepository.getChosenDiets();
final lastChosenDiet = chosenDiets.firstOrNull;
@@ -81,7 +81,7 @@ class AboutDietCubit extends Cubit<AboutDietState> {
EasyDebounce.debounce(
'like_diet',
Duration(seconds: 1),
const Duration(seconds: 1),
() async {
try {
await dietsRepository.likeDiet(id);
@@ -112,7 +112,7 @@ class AboutDietCubit extends Cubit<AboutDietState> {
EasyDebounce.debounce(
'add_or_remove_diet_to_favorites',
Duration(seconds: 1),
const Duration(seconds: 1),
() async {
try {
await dietsRepository.addToFavorite(id);
@@ -143,7 +143,7 @@ class AboutDietCubit extends Cubit<AboutDietState> {
EasyDebounce.debounce(
'add_or_remove_diet_to_favorites',
Duration(seconds: 1),
const Duration(seconds: 1),
() async {
try {
await dietsRepository.removeFromFavorite(id);

View File

@@ -12,8 +12,7 @@ part of 'about_diet_state.dart';
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',
);
'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 _$AboutDietState {
@@ -23,9 +22,10 @@ mixin _$AboutDietState {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -33,7 +33,8 @@ mixin _$AboutDietState {
TResult? Function()? loading,
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
TResult? Function(String message)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -42,7 +43,8 @@ mixin _$AboutDietState {
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_AboutDietState value) $default, {
@@ -50,7 +52,8 @@ mixin _$AboutDietState {
required TResult Function(DietStateLoading value) loading,
required TResult Function(DietStateLoaded value) loaded,
required TResult Function(DietStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_AboutDietState value)? $default, {
@@ -58,7 +61,8 @@ mixin _$AboutDietState {
TResult? Function(DietStateLoading value)? loading,
TResult? Function(DietStateLoaded value)? loaded,
TResult? Function(DietStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_AboutDietState value)? $default, {
@@ -67,15 +71,15 @@ mixin _$AboutDietState {
TResult Function(DietStateLoaded value)? loaded,
TResult Function(DietStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AboutDietStateCopyWith<$Res> {
factory $AboutDietStateCopyWith(
AboutDietState value,
$Res Function(AboutDietState) then,
) = _$AboutDietStateCopyWithImpl<$Res, AboutDietState>;
AboutDietState value, $Res Function(AboutDietState) then) =
_$AboutDietStateCopyWithImpl<$Res, AboutDietState>;
}
/// @nodoc
@@ -94,10 +98,9 @@ class _$AboutDietStateCopyWithImpl<$Res, $Val extends AboutDietState>
/// @nodoc
abstract class _$$AboutDietStateImplCopyWith<$Res> {
factory _$$AboutDietStateImplCopyWith(
_$AboutDietStateImpl value,
$Res Function(_$AboutDietStateImpl) then,
) = __$$AboutDietStateImplCopyWithImpl<$Res>;
factory _$$AboutDietStateImplCopyWith(_$AboutDietStateImpl value,
$Res Function(_$AboutDietStateImpl) then) =
__$$AboutDietStateImplCopyWithImpl<$Res>;
}
/// @nodoc
@@ -105,9 +108,8 @@ class __$$AboutDietStateImplCopyWithImpl<$Res>
extends _$AboutDietStateCopyWithImpl<$Res, _$AboutDietStateImpl>
implements _$$AboutDietStateImplCopyWith<$Res> {
__$$AboutDietStateImplCopyWithImpl(
_$AboutDietStateImpl _value,
$Res Function(_$AboutDietStateImpl) _then,
) : super(_value, _then);
_$AboutDietStateImpl _value, $Res Function(_$AboutDietStateImpl) _then)
: super(_value, _then);
/// Create a copy of AboutDietState
/// with the given fields replaced by the non-null parameter values.
@@ -139,7 +141,7 @@ class _$AboutDietStateImpl implements _AboutDietState {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) {
return $default();
@@ -220,20 +222,18 @@ abstract class _AboutDietState implements AboutDietState {
/// @nodoc
abstract class _$$DietStateInitialImplCopyWith<$Res> {
factory _$$DietStateInitialImplCopyWith(
_$DietStateInitialImpl value,
$Res Function(_$DietStateInitialImpl) then,
) = __$$DietStateInitialImplCopyWithImpl<$Res>;
factory _$$DietStateInitialImplCopyWith(_$DietStateInitialImpl value,
$Res Function(_$DietStateInitialImpl) then) =
__$$DietStateInitialImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$DietStateInitialImplCopyWithImpl<$Res>
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateInitialImpl>
implements _$$DietStateInitialImplCopyWith<$Res> {
__$$DietStateInitialImplCopyWithImpl(
_$DietStateInitialImpl _value,
$Res Function(_$DietStateInitialImpl) _then,
) : super(_value, _then);
__$$DietStateInitialImplCopyWithImpl(_$DietStateInitialImpl _value,
$Res Function(_$DietStateInitialImpl) _then)
: super(_value, _then);
/// Create a copy of AboutDietState
/// with the given fields replaced by the non-null parameter values.
@@ -265,7 +265,7 @@ class _$DietStateInitialImpl implements DietStateInitial {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) {
return initial();
@@ -346,20 +346,18 @@ abstract class DietStateInitial implements AboutDietState {
/// @nodoc
abstract class _$$DietStateLoadingImplCopyWith<$Res> {
factory _$$DietStateLoadingImplCopyWith(
_$DietStateLoadingImpl value,
$Res Function(_$DietStateLoadingImpl) then,
) = __$$DietStateLoadingImplCopyWithImpl<$Res>;
factory _$$DietStateLoadingImplCopyWith(_$DietStateLoadingImpl value,
$Res Function(_$DietStateLoadingImpl) then) =
__$$DietStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$DietStateLoadingImplCopyWithImpl<$Res>
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadingImpl>
implements _$$DietStateLoadingImplCopyWith<$Res> {
__$$DietStateLoadingImplCopyWithImpl(
_$DietStateLoadingImpl _value,
$Res Function(_$DietStateLoadingImpl) _then,
) : super(_value, _then);
__$$DietStateLoadingImplCopyWithImpl(_$DietStateLoadingImpl _value,
$Res Function(_$DietStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of AboutDietState
/// with the given fields replaced by the non-null parameter values.
@@ -391,7 +389,7 @@ class _$DietStateLoadingImpl implements DietStateLoading {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) {
return loading();
@@ -472,10 +470,9 @@ abstract class DietStateLoading implements AboutDietState {
/// @nodoc
abstract class _$$DietStateLoadedImplCopyWith<$Res> {
factory _$$DietStateLoadedImplCopyWith(
_$DietStateLoadedImpl value,
$Res Function(_$DietStateLoadedImpl) then,
) = __$$DietStateLoadedImplCopyWithImpl<$Res>;
factory _$$DietStateLoadedImplCopyWith(_$DietStateLoadedImpl value,
$Res Function(_$DietStateLoadedImpl) then) =
__$$DietStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({Diet diet, bool isStarted, bool hasStartedDiet});
@@ -487,9 +484,8 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res>
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadedImpl>
implements _$$DietStateLoadedImplCopyWith<$Res> {
__$$DietStateLoadedImplCopyWithImpl(
_$DietStateLoadedImpl _value,
$Res Function(_$DietStateLoadedImpl) _then,
) : super(_value, _then);
_$DietStateLoadedImpl _value, $Res Function(_$DietStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of AboutDietState
/// with the given fields replaced by the non-null parameter values.
@@ -500,25 +496,20 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res>
Object? isStarted = null,
Object? hasStartedDiet = null,
}) {
return _then(
_$DietStateLoadedImpl(
diet:
null == diet
? _value.diet
: diet // ignore: cast_nullable_to_non_nullable
as Diet,
isStarted:
null == isStarted
? _value.isStarted
: isStarted // ignore: cast_nullable_to_non_nullable
as bool,
hasStartedDiet:
null == hasStartedDiet
? _value.hasStartedDiet
: hasStartedDiet // ignore: cast_nullable_to_non_nullable
as bool,
),
);
return _then(_$DietStateLoadedImpl(
diet: null == diet
? _value.diet
: diet // ignore: cast_nullable_to_non_nullable
as Diet,
isStarted: null == isStarted
? _value.isStarted
: isStarted // ignore: cast_nullable_to_non_nullable
as bool,
hasStartedDiet: null == hasStartedDiet
? _value.hasStartedDiet
: hasStartedDiet // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of AboutDietState
@@ -535,11 +526,10 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res>
/// @nodoc
class _$DietStateLoadedImpl implements DietStateLoaded {
const _$DietStateLoadedImpl({
required this.diet,
this.isStarted = false,
this.hasStartedDiet = false,
});
const _$DietStateLoadedImpl(
{required this.diet,
this.isStarted = false,
this.hasStartedDiet = false});
@override
final Diet diet;
@@ -577,9 +567,7 @@ class _$DietStateLoadedImpl implements DietStateLoaded {
@pragma('vm:prefer-inline')
_$$DietStateLoadedImplCopyWith<_$DietStateLoadedImpl> get copyWith =>
__$$DietStateLoadedImplCopyWithImpl<_$DietStateLoadedImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -588,7 +576,7 @@ class _$DietStateLoadedImpl implements DietStateLoaded {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) {
return loaded(diet, isStarted, hasStartedDiet);
@@ -664,11 +652,10 @@ class _$DietStateLoadedImpl implements DietStateLoaded {
}
abstract class DietStateLoaded implements AboutDietState {
const factory DietStateLoaded({
required final Diet diet,
final bool isStarted,
final bool hasStartedDiet,
}) = _$DietStateLoadedImpl;
const factory DietStateLoaded(
{required final Diet diet,
final bool isStarted,
final bool hasStartedDiet}) = _$DietStateLoadedImpl;
Diet get diet;
bool get isStarted;
@@ -683,10 +670,9 @@ abstract class DietStateLoaded implements AboutDietState {
/// @nodoc
abstract class _$$DietStateErrorImplCopyWith<$Res> {
factory _$$DietStateErrorImplCopyWith(
_$DietStateErrorImpl value,
$Res Function(_$DietStateErrorImpl) then,
) = __$$DietStateErrorImplCopyWithImpl<$Res>;
factory _$$DietStateErrorImplCopyWith(_$DietStateErrorImpl value,
$Res Function(_$DietStateErrorImpl) then) =
__$$DietStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String message});
}
@@ -696,24 +682,22 @@ class __$$DietStateErrorImplCopyWithImpl<$Res>
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateErrorImpl>
implements _$$DietStateErrorImplCopyWith<$Res> {
__$$DietStateErrorImplCopyWithImpl(
_$DietStateErrorImpl _value,
$Res Function(_$DietStateErrorImpl) _then,
) : super(_value, _then);
_$DietStateErrorImpl _value, $Res Function(_$DietStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of AboutDietState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? message = null}) {
return _then(
_$DietStateErrorImpl(
message:
null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? message = null,
}) {
return _then(_$DietStateErrorImpl(
message: null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -748,9 +732,7 @@ class _$DietStateErrorImpl implements DietStateError {
@pragma('vm:prefer-inline')
_$$DietStateErrorImplCopyWith<_$DietStateErrorImpl> get copyWith =>
__$$DietStateErrorImplCopyWithImpl<_$DietStateErrorImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -759,7 +741,7 @@ class _$DietStateErrorImpl implements DietStateError {
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
loaded,
loaded,
required TResult Function(String message) error,
}) {
return error(message);