fix(diary): added proccesing of future dates and fixed deleted portions

This commit is contained in:
Username1548
2025-04-08 21:28:40 +07:00
parent 245c854754
commit 823dc78490
25 changed files with 1038 additions and 371 deletions

View File

@@ -0,0 +1,32 @@
import 'dart:developer';
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
import 'package:eatvio_app/features/order_info/cubit/order_info_state.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class OrderInfoCubit extends Cubit<OrderInfoState> {
OrderInfoCubit({required this.chatRepository}) : super(OrderInfoState());
final ChatRepository chatRepository;
Future<String?> getPaymentLink() async {
try {
final plan = state.chosenPlan;
if (plan == null) return null;
final paymentModel = await chatRepository.getPaymentLink(id: plan.id);
return paymentModel.paymentUrl;
} catch (e) {
log(e.toString());
return null;
}
}
Future<void> getChosenPlan(int id) async{
try {
emit(state.copyWith(isLoading: true));
emit(state.copyWith(isLoading: false));
} catch (e) {
log(e.toString());
emit(state.copyWith(isLoading: false));
}
}
}

View File

@@ -0,0 +1,14 @@
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'order_info_state.freezed.dart';
@freezed
class OrderInfoState with _$OrderInfoState {
factory OrderInfoState({
@Default(false) bool isLoading,
@Default(null) ChosenPlanModel? chosenPlan,
}) = _OrderInfoState;
}

View File

@@ -0,0 +1,185 @@
// 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 'order_info_state.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 _$OrderInfoState {
bool get isLoading => throw _privateConstructorUsedError;
ChosenPlanModel? get chosenPlan => throw _privateConstructorUsedError;
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OrderInfoStateCopyWith<OrderInfoState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OrderInfoStateCopyWith<$Res> {
factory $OrderInfoStateCopyWith(
OrderInfoState value, $Res Function(OrderInfoState) then) =
_$OrderInfoStateCopyWithImpl<$Res, OrderInfoState>;
@useResult
$Res call({bool isLoading, ChosenPlanModel? chosenPlan});
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
}
/// @nodoc
class _$OrderInfoStateCopyWithImpl<$Res, $Val extends OrderInfoState>
implements $OrderInfoStateCopyWith<$Res> {
_$OrderInfoStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? isLoading = null,
Object? chosenPlan = freezed,
}) {
return _then(_value.copyWith(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
) as $Val);
}
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChosenPlanModelCopyWith<$Res>? get chosenPlan {
if (_value.chosenPlan == null) {
return null;
}
return $ChosenPlanModelCopyWith<$Res>(_value.chosenPlan!, (value) {
return _then(_value.copyWith(chosenPlan: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$OrderInfoStateImplCopyWith<$Res>
implements $OrderInfoStateCopyWith<$Res> {
factory _$$OrderInfoStateImplCopyWith(_$OrderInfoStateImpl value,
$Res Function(_$OrderInfoStateImpl) then) =
__$$OrderInfoStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool isLoading, ChosenPlanModel? chosenPlan});
@override
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
}
/// @nodoc
class __$$OrderInfoStateImplCopyWithImpl<$Res>
extends _$OrderInfoStateCopyWithImpl<$Res, _$OrderInfoStateImpl>
implements _$$OrderInfoStateImplCopyWith<$Res> {
__$$OrderInfoStateImplCopyWithImpl(
_$OrderInfoStateImpl _value, $Res Function(_$OrderInfoStateImpl) _then)
: super(_value, _then);
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? isLoading = null,
Object? chosenPlan = freezed,
}) {
return _then(_$OrderInfoStateImpl(
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
));
}
}
/// @nodoc
class _$OrderInfoStateImpl implements _OrderInfoState {
_$OrderInfoStateImpl({this.isLoading = false, this.chosenPlan = null});
@override
@JsonKey()
final bool isLoading;
@override
@JsonKey()
final ChosenPlanModel? chosenPlan;
@override
String toString() {
return 'OrderInfoState(isLoading: $isLoading, chosenPlan: $chosenPlan)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OrderInfoStateImpl &&
(identical(other.isLoading, isLoading) ||
other.isLoading == isLoading) &&
(identical(other.chosenPlan, chosenPlan) ||
other.chosenPlan == chosenPlan));
}
@override
int get hashCode => Object.hash(runtimeType, isLoading, chosenPlan);
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OrderInfoStateImplCopyWith<_$OrderInfoStateImpl> get copyWith =>
__$$OrderInfoStateImplCopyWithImpl<_$OrderInfoStateImpl>(
this, _$identity);
}
abstract class _OrderInfoState implements OrderInfoState {
factory _OrderInfoState(
{final bool isLoading,
final ChosenPlanModel? chosenPlan}) = _$OrderInfoStateImpl;
@override
bool get isLoading;
@override
ChosenPlanModel? get chosenPlan;
/// Create a copy of OrderInfoState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OrderInfoStateImplCopyWith<_$OrderInfoStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}