refactor: remove unused elements

This commit is contained in:
mso7nueh
2024-09-11 16:39:15 +03:00
parent 09cfacb022
commit 69472f422e
182 changed files with 2443 additions and 5482 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/diary/models/diary_model.dart';
import 'package:eatvio_app/features/diary/models/meal.dart';
@@ -10,6 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
part 'diary_event.dart';
/// A bloc that manages the state of a Diary according to the event that is dispatched to it.

View File

@@ -182,6 +182,7 @@ class RefreshEvent extends DiaryEvent {
class ConfirmPortion extends DiaryEvent {
ConfirmPortion(this.id);
int id;
@override

View File

@@ -54,6 +54,7 @@ mixin _$DiaryState {
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -160,18 +161,16 @@ mixin _$DiaryState {
/// @nodoc
abstract class $DiaryStateCopyWith<$Res> {
factory $DiaryStateCopyWith(
DiaryState value, $Res Function(DiaryState) then) =
_$DiaryStateCopyWithImpl<$Res, DiaryState>;
factory $DiaryStateCopyWith(DiaryState value, $Res Function(DiaryState) then) = _$DiaryStateCopyWithImpl<$Res, DiaryState>;
}
/// @nodoc
class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState>
implements $DiaryStateCopyWith<$Res> {
class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState> implements $DiaryStateCopyWith<$Res> {
_$DiaryStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -181,18 +180,12 @@ class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState>
/// @nodoc
abstract class _$$DiaryStateImplCopyWith<$Res> {
factory _$$DiaryStateImplCopyWith(
_$DiaryStateImpl value, $Res Function(_$DiaryStateImpl) then) =
__$$DiaryStateImplCopyWithImpl<$Res>;
factory _$$DiaryStateImplCopyWith(_$DiaryStateImpl value, $Res Function(_$DiaryStateImpl) then) = __$$DiaryStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$DiaryStateImplCopyWithImpl<$Res>
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateImpl>
implements _$$DiaryStateImplCopyWith<$Res> {
__$$DiaryStateImplCopyWithImpl(
_$DiaryStateImpl _value, $Res Function(_$DiaryStateImpl) _then)
: super(_value, _then);
class __$$DiaryStateImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateImpl> implements _$$DiaryStateImplCopyWith<$Res> {
__$$DiaryStateImplCopyWithImpl(_$DiaryStateImpl _value, $Res Function(_$DiaryStateImpl) _then) : super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@@ -210,8 +203,7 @@ class _$DiaryStateImpl implements _DiaryState {
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$DiaryStateImpl);
return identical(this, other) || (other.runtimeType == runtimeType && other is _$DiaryStateImpl);
}
@override
@@ -388,20 +380,17 @@ abstract class _DiaryState implements DiaryState {
/// @nodoc
abstract class _$$DiaryStateLoadingImplCopyWith<$Res> {
factory _$$DiaryStateLoadingImplCopyWith(_$DiaryStateLoadingImpl value,
$Res Function(_$DiaryStateLoadingImpl) then) =
factory _$$DiaryStateLoadingImplCopyWith(_$DiaryStateLoadingImpl value, $Res Function(_$DiaryStateLoadingImpl) then) =
__$$DiaryStateLoadingImplCopyWithImpl<$Res>;
@useResult
$Res call({int? id});
}
/// @nodoc
class __$$DiaryStateLoadingImplCopyWithImpl<$Res>
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadingImpl>
class __$$DiaryStateLoadingImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadingImpl>
implements _$$DiaryStateLoadingImplCopyWith<$Res> {
__$$DiaryStateLoadingImplCopyWithImpl(_$DiaryStateLoadingImpl _value,
$Res Function(_$DiaryStateLoadingImpl) _then)
: super(_value, _then);
__$$DiaryStateLoadingImplCopyWithImpl(_$DiaryStateLoadingImpl _value, $Res Function(_$DiaryStateLoadingImpl) _then) : super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@@ -434,10 +423,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DiaryStateLoadingImpl &&
(identical(other.id, id) || other.id == id));
return identical(this, other) || (other.runtimeType == runtimeType && other is _$DiaryStateLoadingImpl && (identical(other.id, id) || other.id == id));
}
@override
@@ -448,9 +434,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith =>
__$$DiaryStateLoadingImplCopyWithImpl<_$DiaryStateLoadingImpl>(
this, _$identity);
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith => __$$DiaryStateLoadingImplCopyWithImpl<_$DiaryStateLoadingImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -625,15 +609,14 @@ abstract class DiaryStateLoading implements DiaryState {
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
factory _$$DiaryStateLoadedImplCopyWith(_$DiaryStateLoadedImpl value,
$Res Function(_$DiaryStateLoadedImpl) then) =
factory _$$DiaryStateLoadedImplCopyWith(_$DiaryStateLoadedImpl value, $Res Function(_$DiaryStateLoadedImpl) then) =
__$$DiaryStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call(
{DiaryModel diary,
@@ -667,17 +650,16 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
List<NutritionData>? chartDataCounted});
$DiaryModelCopyWith<$Res> get diary;
$MealCopyWith<$Res> get currentMeal;
$SelectionPopupModelCopyWith<$Res> get portionController;
}
/// @nodoc
class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadedImpl>
class __$$DiaryStateLoadedImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadedImpl>
implements _$$DiaryStateLoadedImplCopyWith<$Res> {
__$$DiaryStateLoadedImplCopyWithImpl(_$DiaryStateLoadedImpl _value,
$Res Function(_$DiaryStateLoadedImpl) _then)
: super(_value, _then);
__$$DiaryStateLoadedImplCopyWithImpl(_$DiaryStateLoadedImpl _value, $Res Function(_$DiaryStateLoadedImpl) _then) : super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@@ -859,8 +841,7 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
@override
@pragma('vm:prefer-inline')
$SelectionPopupModelCopyWith<$Res> get portionController {
return $SelectionPopupModelCopyWith<$Res>(_value.portionController,
(value) {
return $SelectionPopupModelCopyWith<$Res>(_value.portionController, (value) {
return _then(_value.copyWith(portionController: value));
});
}
@@ -913,24 +894,25 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
@override
final String? diaryDate;
final List<int> _recommendedChartValues;
@override
List<int> get recommendedChartValues {
if (_recommendedChartValues is EqualUnmodifiableListView)
return _recommendedChartValues;
if (_recommendedChartValues is EqualUnmodifiableListView) return _recommendedChartValues;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_recommendedChartValues);
}
final List<int> _consumedChartValues;
@override
List<int> get consumedChartValues {
if (_consumedChartValues is EqualUnmodifiableListView)
return _consumedChartValues;
if (_consumedChartValues is EqualUnmodifiableListView) return _consumedChartValues;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_consumedChartValues);
}
final List<Portion> _portions;
@override
List<Portion> get portions {
if (_portions is EqualUnmodifiableListView) return _portions;
@@ -939,6 +921,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
}
final List<SelectionPopupModel> _mealList;
@override
List<SelectionPopupModel> get mealList {
if (_mealList is EqualUnmodifiableListView) return _mealList;
@@ -947,6 +930,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
}
final List<SelectionPopupModel> _portionList;
@override
List<SelectionPopupModel> get portionList {
if (_portionList is EqualUnmodifiableListView) return _portionList;
@@ -955,15 +939,16 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
}
final List<Product> _autocompleteList;
@override
List<Product> get autocompleteList {
if (_autocompleteList is EqualUnmodifiableListView)
return _autocompleteList;
if (_autocompleteList is EqualUnmodifiableListView) return _autocompleteList;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_autocompleteList);
}
final Map<String, dynamic> _chartData;
@override
Map<String, dynamic> get chartData {
if (_chartData is EqualUnmodifiableMapView) return _chartData;
@@ -1010,12 +995,12 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
@override
final bool isAdded;
final List<NutritionData>? _chartDataCounted;
@override
List<NutritionData>? get chartDataCounted {
final value = _chartDataCounted;
if (value == null) return null;
if (_chartDataCounted is EqualUnmodifiableListView)
return _chartDataCounted;
if (_chartDataCounted is EqualUnmodifiableListView) return _chartDataCounted;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@@ -1031,60 +1016,34 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
(other.runtimeType == runtimeType &&
other is _$DiaryStateLoadedImpl &&
(identical(other.diary, diary) || other.diary == diary) &&
(identical(other.diaryDate, diaryDate) ||
other.diaryDate == diaryDate) &&
const DeepCollectionEquality().equals(
other._recommendedChartValues, _recommendedChartValues) &&
const DeepCollectionEquality()
.equals(other._consumedChartValues, _consumedChartValues) &&
(identical(other.diaryDate, diaryDate) || other.diaryDate == diaryDate) &&
const DeepCollectionEquality().equals(other._recommendedChartValues, _recommendedChartValues) &&
const DeepCollectionEquality().equals(other._consumedChartValues, _consumedChartValues) &&
const DeepCollectionEquality().equals(other._portions, _portions) &&
const DeepCollectionEquality().equals(other._mealList, _mealList) &&
const DeepCollectionEquality()
.equals(other._portionList, _portionList) &&
const DeepCollectionEquality()
.equals(other._autocompleteList, _autocompleteList) &&
const DeepCollectionEquality()
.equals(other._chartData, _chartData) &&
(identical(other.currentMeal, currentMeal) ||
other.currentMeal == currentMeal) &&
(identical(other.portionController, portionController) ||
other.portionController == portionController) &&
(identical(other.wakeupController, wakeupController) ||
other.wakeupController == wakeupController) &&
(identical(other.retireController, retireController) ||
other.retireController == retireController) &&
(identical(other.mealTimeController, mealTimeController) ||
other.mealTimeController == mealTimeController) &&
(identical(other.commentController, commentController) ||
other.commentController == commentController) &&
(identical(other.product_nameController, product_nameController) ||
other.product_nameController == product_nameController) &&
(identical(other.productQuantityController,
productQuantityController) ||
other.productQuantityController == productQuantityController) &&
(identical(other.caloriesController, caloriesController) ||
other.caloriesController == caloriesController) &&
(identical(other.fatsController, fatsController) ||
other.fatsController == fatsController) &&
(identical(other.proteinsController, proteinsController) ||
other.proteinsController == proteinsController) &&
(identical(other.carbsController, carbsController) ||
other.carbsController == carbsController) &&
(identical(other.selectedMood, selectedMood) ||
other.selectedMood == selectedMood) &&
(identical(other.selectedSatiety, selectedSatiety) ||
other.selectedSatiety == selectedSatiety) &&
(identical(other.wakeupExpanded, wakeupExpanded) ||
other.wakeupExpanded == wakeupExpanded) &&
(identical(other.moderationExpanded, moderationExpanded) ||
other.moderationExpanded == moderationExpanded) &&
(identical(other.moodExpanded, moodExpanded) ||
other.moodExpanded == moodExpanded) &&
(identical(other.isLoading, isLoading) ||
other.isLoading == isLoading) &&
const DeepCollectionEquality().equals(other._portionList, _portionList) &&
const DeepCollectionEquality().equals(other._autocompleteList, _autocompleteList) &&
const DeepCollectionEquality().equals(other._chartData, _chartData) &&
(identical(other.currentMeal, currentMeal) || other.currentMeal == currentMeal) &&
(identical(other.portionController, portionController) || other.portionController == portionController) &&
(identical(other.wakeupController, wakeupController) || other.wakeupController == wakeupController) &&
(identical(other.retireController, retireController) || other.retireController == retireController) &&
(identical(other.mealTimeController, mealTimeController) || other.mealTimeController == mealTimeController) &&
(identical(other.commentController, commentController) || other.commentController == commentController) &&
(identical(other.product_nameController, product_nameController) || other.product_nameController == product_nameController) &&
(identical(other.productQuantityController, productQuantityController) || other.productQuantityController == productQuantityController) &&
(identical(other.caloriesController, caloriesController) || other.caloriesController == caloriesController) &&
(identical(other.fatsController, fatsController) || other.fatsController == fatsController) &&
(identical(other.proteinsController, proteinsController) || other.proteinsController == proteinsController) &&
(identical(other.carbsController, carbsController) || other.carbsController == carbsController) &&
(identical(other.selectedMood, selectedMood) || other.selectedMood == selectedMood) &&
(identical(other.selectedSatiety, selectedSatiety) || other.selectedSatiety == selectedSatiety) &&
(identical(other.wakeupExpanded, wakeupExpanded) || other.wakeupExpanded == wakeupExpanded) &&
(identical(other.moderationExpanded, moderationExpanded) || other.moderationExpanded == moderationExpanded) &&
(identical(other.moodExpanded, moodExpanded) || other.moodExpanded == moodExpanded) &&
(identical(other.isLoading, isLoading) || other.isLoading == isLoading) &&
(identical(other.isAdded, isAdded) || other.isAdded == isAdded) &&
const DeepCollectionEquality()
.equals(other._chartDataCounted, _chartDataCounted));
const DeepCollectionEquality().equals(other._chartDataCounted, _chartDataCounted));
}
@override
@@ -1126,9 +1085,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith =>
__$$DiaryStateLoadedImplCopyWithImpl<_$DiaryStateLoadedImpl>(
this, _$identity);
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith => __$$DiaryStateLoadedImplCopyWithImpl<_$DiaryStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -1415,58 +1372,80 @@ abstract class DiaryStateLoaded implements DiaryState {
final List<NutritionData>? chartDataCounted}) = _$DiaryStateLoadedImpl;
DiaryModel get diary;
String? get diaryDate;
List<int> get recommendedChartValues;
List<int> get consumedChartValues;
List<Portion> get portions;
List<SelectionPopupModel> get mealList;
List<SelectionPopupModel> get portionList;
List<Product> get autocompleteList;
Map<String, dynamic> get chartData;
Meal get currentMeal;
SelectionPopupModel get portionController;
TimeOfDay get wakeupController;
TimeOfDay get retireController;
TimeOfDay? get mealTimeController;
TextEditingController get commentController;
TextEditingController get product_nameController;
TextEditingController get productQuantityController;
TextEditingController get caloriesController;
TextEditingController get fatsController;
TextEditingController get proteinsController;
TextEditingController get carbsController;
int get selectedMood;
int get selectedSatiety;
bool get wakeupExpanded;
bool get moderationExpanded;
bool get moodExpanded;
bool get isLoading;
bool get isAdded;
List<NutritionData>? get chartDataCounted;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$DiaryStateErrorImplCopyWith<$Res> {
factory _$$DiaryStateErrorImplCopyWith(_$DiaryStateErrorImpl value,
$Res Function(_$DiaryStateErrorImpl) then) =
__$$DiaryStateErrorImplCopyWithImpl<$Res>;
factory _$$DiaryStateErrorImplCopyWith(_$DiaryStateErrorImpl value, $Res Function(_$DiaryStateErrorImpl) then) = __$$DiaryStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$DiaryStateErrorImplCopyWithImpl<$Res>
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateErrorImpl>
implements _$$DiaryStateErrorImplCopyWith<$Res> {
__$$DiaryStateErrorImplCopyWithImpl(
_$DiaryStateErrorImpl _value, $Res Function(_$DiaryStateErrorImpl) _then)
: super(_value, _then);
class __$$DiaryStateErrorImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateErrorImpl> implements _$$DiaryStateErrorImplCopyWith<$Res> {
__$$DiaryStateErrorImplCopyWithImpl(_$DiaryStateErrorImpl _value, $Res Function(_$DiaryStateErrorImpl) _then) : super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@@ -1502,8 +1481,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DiaryStateErrorImpl &&
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
@@ -1514,9 +1492,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith =>
__$$DiaryStateErrorImplCopyWithImpl<_$DiaryStateErrorImpl>(
this, _$identity);
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith => __$$DiaryStateErrorImplCopyWithImpl<_$DiaryStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -1684,14 +1660,12 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
}
abstract class DiaryStateError implements DiaryState {
const factory DiaryStateError({required final String errorMessage}) =
_$DiaryStateErrorImpl;
const factory DiaryStateError({required final String errorMessage}) = _$DiaryStateErrorImpl;
String get errorMessage;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -3,7 +3,6 @@
import 'package:eatvio_app/features/diary/models/portion.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';

View File

@@ -11,15 +11,13 @@ import 'package:eatvio_app/features/diary/models/product.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
import 'package:eatvio_app/localization/app_localization.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/app_decoration.dart';
import 'package:eatvio_app/theme/custom_text_style.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_scale_element.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';