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

@@ -21,12 +21,19 @@ DiaryModel _$DiaryModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$DiaryModel {
int get id => throw _privateConstructorUsedError;
DateTime get date => throw _privateConstructorUsedError;
int get closed => throw _privateConstructorUsedError;
List<Meal> get meals => throw _privateConstructorUsedError;
State get state => throw _privateConstructorUsedError;
String? get comment => throw _privateConstructorUsedError;
DateTime? get wakeup => throw _privateConstructorUsedError;
DateTime? get retire => throw _privateConstructorUsedError;
/// Serializes this DiaryModel to a JSON map.
@@ -35,36 +42,26 @@ mixin _$DiaryModel {
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DiaryModelCopyWith<DiaryModel> get copyWith =>
throw _privateConstructorUsedError;
$DiaryModelCopyWith<DiaryModel> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DiaryModelCopyWith<$Res> {
factory $DiaryModelCopyWith(
DiaryModel value, $Res Function(DiaryModel) then) =
_$DiaryModelCopyWithImpl<$Res, DiaryModel>;
factory $DiaryModelCopyWith(DiaryModel value, $Res Function(DiaryModel) then) = _$DiaryModelCopyWithImpl<$Res, DiaryModel>;
@useResult
$Res call(
{int id,
DateTime date,
int closed,
List<Meal> meals,
State state,
String? comment,
DateTime? wakeup,
DateTime? retire});
$Res call({int id, DateTime date, int closed, List<Meal> meals, State state, String? comment, DateTime? wakeup, DateTime? retire});
$StateCopyWith<$Res> get state;
}
/// @nodoc
class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
implements $DiaryModelCopyWith<$Res> {
class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> implements $DiaryModelCopyWith<$Res> {
_$DiaryModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -130,34 +127,20 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
}
/// @nodoc
abstract class _$$DiaryModelImplCopyWith<$Res>
implements $DiaryModelCopyWith<$Res> {
factory _$$DiaryModelImplCopyWith(
_$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) =
__$$DiaryModelImplCopyWithImpl<$Res>;
abstract class _$$DiaryModelImplCopyWith<$Res> implements $DiaryModelCopyWith<$Res> {
factory _$$DiaryModelImplCopyWith(_$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = __$$DiaryModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int id,
DateTime date,
int closed,
List<Meal> meals,
State state,
String? comment,
DateTime? wakeup,
DateTime? retire});
$Res call({int id, DateTime date, int closed, List<Meal> meals, State state, String? comment, DateTime? wakeup, DateTime? retire});
@override
$StateCopyWith<$Res> get state;
}
/// @nodoc
class __$$DiaryModelImplCopyWithImpl<$Res>
extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl>
implements _$$DiaryModelImplCopyWith<$Res> {
__$$DiaryModelImplCopyWithImpl(
_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then)
: super(_value, _then);
class __$$DiaryModelImplCopyWithImpl<$Res> extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> implements _$$DiaryModelImplCopyWith<$Res> {
__$$DiaryModelImplCopyWithImpl(_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) : super(_value, _then);
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@@ -224,8 +207,7 @@ class _$DiaryModelImpl implements _DiaryModel {
this.retire})
: _meals = meals;
factory _$DiaryModelImpl.fromJson(Map<String, dynamic> json) =>
_$$DiaryModelImplFromJson(json);
factory _$DiaryModelImpl.fromJson(Map<String, dynamic> json) => _$$DiaryModelImplFromJson(json);
@override
final int id;
@@ -234,6 +216,7 @@ class _$DiaryModelImpl implements _DiaryModel {
@override
final int closed;
final List<Meal> _meals;
@override
List<Meal> get meals {
if (_meals is EqualUnmodifiableListView) return _meals;
@@ -272,24 +255,14 @@ class _$DiaryModelImpl implements _DiaryModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
date,
closed,
const DeepCollectionEquality().hash(_meals),
state,
comment,
wakeup,
retire);
int get hashCode => Object.hash(runtimeType, id, date, closed, const DeepCollectionEquality().hash(_meals), state, comment, wakeup, retire);
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
__$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity);
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -310,23 +283,29 @@ abstract class _DiaryModel implements DiaryModel {
final DateTime? wakeup,
final DateTime? retire}) = _$DiaryModelImpl;
factory _DiaryModel.fromJson(Map<String, dynamic> json) =
_$DiaryModelImpl.fromJson;
factory _DiaryModel.fromJson(Map<String, dynamic> json) = _$DiaryModelImpl.fromJson;
@override
int get id;
@override
DateTime get date;
@override
int get closed;
@override
List<Meal> get meals;
@override
State get state;
@override
String? get comment;
@override
DateTime? get wakeup;
@override
DateTime? get retire;
@@ -334,6 +313,5 @@ abstract class _DiaryModel implements DiaryModel {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -6,26 +6,18 @@ part of 'diary_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$DiaryModelImpl _$$DiaryModelImplFromJson(Map<String, dynamic> json) =>
_$DiaryModelImpl(
_$DiaryModelImpl _$$DiaryModelImplFromJson(Map<String, dynamic> json) => _$DiaryModelImpl(
id: (json['id'] as num).toInt(),
date: DateTime.parse(json['date'] as String),
closed: (json['closed'] as num).toInt(),
meals: (json['meals'] as List<dynamic>)
.map((e) => Meal.fromJson(e as Map<String, dynamic>))
.toList(),
meals: (json['meals'] as List<dynamic>).map((e) => Meal.fromJson(e as Map<String, dynamic>)).toList(),
state: State.fromJson(json['state'] as Map<String, dynamic>),
comment: json['comment'] as String?,
wakeup: json['wakeup'] == null
? null
: DateTime.parse(json['wakeup'] as String),
retire: json['retire'] == null
? null
: DateTime.parse(json['retire'] as String),
wakeup: json['wakeup'] == null ? null : DateTime.parse(json['wakeup'] as String),
retire: json['retire'] == null ? null : DateTime.parse(json['retire'] as String),
);
Map<String, dynamic> _$$DiaryModelImplToJson(_$DiaryModelImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => <String, dynamic>{
'id': instance.id,
'date': instance.date.toIso8601String(),
'closed': instance.closed,

View File

@@ -21,11 +21,17 @@ Meal _$MealFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Meal {
int get id => throw _privateConstructorUsedError;
String get time => throw _privateConstructorUsedError;
int get type => throw _privateConstructorUsedError;
int get satiety => throw _privateConstructorUsedError;
int get mood => throw _privateConstructorUsedError;
List<Portion> get portions => throw _privateConstructorUsedError;
List<Photo> get photos => throw _privateConstructorUsedError;
/// Serializes this Meal to a JSON map.
@@ -39,26 +45,19 @@ mixin _$Meal {
/// @nodoc
abstract class $MealCopyWith<$Res> {
factory $MealCopyWith(Meal value, $Res Function(Meal) then) =
_$MealCopyWithImpl<$Res, Meal>;
factory $MealCopyWith(Meal value, $Res Function(Meal) then) = _$MealCopyWithImpl<$Res, Meal>;
@useResult
$Res call(
{int id,
String time,
int type,
int satiety,
int mood,
List<Portion> portions,
List<Photo> photos});
$Res call({int id, String time, int type, int satiety, int mood, List<Portion> portions, List<Photo> photos});
}
/// @nodoc
class _$MealCopyWithImpl<$Res, $Val extends Meal>
implements $MealCopyWith<$Res> {
class _$MealCopyWithImpl<$Res, $Val extends Meal> implements $MealCopyWith<$Res> {
_$MealCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -110,27 +109,16 @@ class _$MealCopyWithImpl<$Res, $Val extends Meal>
/// @nodoc
abstract class _$$MealImplCopyWith<$Res> implements $MealCopyWith<$Res> {
factory _$$MealImplCopyWith(
_$MealImpl value, $Res Function(_$MealImpl) then) =
__$$MealImplCopyWithImpl<$Res>;
factory _$$MealImplCopyWith(_$MealImpl value, $Res Function(_$MealImpl) then) = __$$MealImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int id,
String time,
int type,
int satiety,
int mood,
List<Portion> portions,
List<Photo> photos});
$Res call({int id, String time, int type, int satiety, int mood, List<Portion> portions, List<Photo> photos});
}
/// @nodoc
class __$$MealImplCopyWithImpl<$Res>
extends _$MealCopyWithImpl<$Res, _$MealImpl>
implements _$$MealImplCopyWith<$Res> {
__$$MealImplCopyWithImpl(_$MealImpl _value, $Res Function(_$MealImpl) _then)
: super(_value, _then);
class __$$MealImplCopyWithImpl<$Res> extends _$MealCopyWithImpl<$Res, _$MealImpl> implements _$$MealImplCopyWith<$Res> {
__$$MealImplCopyWithImpl(_$MealImpl _value, $Res Function(_$MealImpl) _then) : super(_value, _then);
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@@ -192,8 +180,7 @@ class _$MealImpl implements _Meal {
: _portions = portions,
_photos = photos;
factory _$MealImpl.fromJson(Map<String, dynamic> json) =>
_$$MealImplFromJson(json);
factory _$MealImpl.fromJson(Map<String, dynamic> json) => _$$MealImplFromJson(json);
@override
final int id;
@@ -206,6 +193,7 @@ class _$MealImpl implements _Meal {
@override
final int mood;
final List<Portion> _portions;
@override
List<Portion> get portions {
if (_portions is EqualUnmodifiableListView) return _portions;
@@ -214,6 +202,7 @@ class _$MealImpl implements _Meal {
}
final List<Photo> _photos;
@override
List<Photo> get photos {
if (_photos is EqualUnmodifiableListView) return _photos;
@@ -242,23 +231,15 @@ class _$MealImpl implements _Meal {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
time,
type,
satiety,
mood,
const DeepCollectionEquality().hash(_portions),
const DeepCollectionEquality().hash(_photos));
int get hashCode =>
Object.hash(runtimeType, id, time, type, satiety, mood, const DeepCollectionEquality().hash(_portions), const DeepCollectionEquality().hash(_photos));
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
__$$MealImplCopyWithImpl<_$MealImpl>(this, _$identity);
_$$MealImplCopyWith<_$MealImpl> get copyWith => __$$MealImplCopyWithImpl<_$MealImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -282,16 +263,22 @@ abstract class _Meal implements Meal {
@override
int get id;
@override
String get time;
@override
int get type;
@override
int get satiety;
@override
int get mood;
@override
List<Portion> get portions;
@override
List<Photo> get photos;
@@ -299,6 +286,5 @@ abstract class _Meal implements Meal {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$MealImplCopyWith<_$MealImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,16 +12,11 @@ _$MealImpl _$$MealImplFromJson(Map<String, dynamic> json) => _$MealImpl(
type: (json['type'] as num).toInt(),
satiety: (json['satiety'] as num).toInt(),
mood: (json['mood'] as num).toInt(),
portions: (json['portions'] as List<dynamic>)
.map((e) => Portion.fromJson(e as Map<String, dynamic>))
.toList(),
photos: (json['photos'] as List<dynamic>)
.map((e) => Photo.fromJson(e as Map<String, dynamic>))
.toList(),
portions: (json['portions'] as List<dynamic>).map((e) => Portion.fromJson(e as Map<String, dynamic>)).toList(),
photos: (json['photos'] as List<dynamic>).map((e) => Photo.fromJson(e as Map<String, dynamic>)).toList(),
);
Map<String, dynamic> _$$MealImplToJson(_$MealImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$MealImplToJson(_$MealImpl instance) => <String, dynamic>{
'id': instance.id,
'time': instance.time,
'type': instance.type,

View File

@@ -1,7 +1,6 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'photo.freezed.dart';
part 'photo.g.dart';
@freezed

View File

@@ -21,8 +21,10 @@ Photo _$PhotoFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Photo {
int get id => throw _privateConstructorUsedError;
@JsonKey(name: 'original_name')
String get originalName => throw _privateConstructorUsedError;
String get path => throw _privateConstructorUsedError;
/// Serializes this Photo to a JSON map.
@@ -36,22 +38,19 @@ mixin _$Photo {
/// @nodoc
abstract class $PhotoCopyWith<$Res> {
factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) =
_$PhotoCopyWithImpl<$Res, Photo>;
factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) = _$PhotoCopyWithImpl<$Res, Photo>;
@useResult
$Res call(
{int id,
@JsonKey(name: 'original_name') String originalName,
String path});
$Res call({int id, @JsonKey(name: 'original_name') String originalName, String path});
}
/// @nodoc
class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
implements $PhotoCopyWith<$Res> {
class _$PhotoCopyWithImpl<$Res, $Val extends Photo> implements $PhotoCopyWith<$Res> {
_$PhotoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -83,24 +82,16 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
/// @nodoc
abstract class _$$PhotoImplCopyWith<$Res> implements $PhotoCopyWith<$Res> {
factory _$$PhotoImplCopyWith(
_$PhotoImpl value, $Res Function(_$PhotoImpl) then) =
__$$PhotoImplCopyWithImpl<$Res>;
factory _$$PhotoImplCopyWith(_$PhotoImpl value, $Res Function(_$PhotoImpl) then) = __$$PhotoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int id,
@JsonKey(name: 'original_name') String originalName,
String path});
$Res call({int id, @JsonKey(name: 'original_name') String originalName, String path});
}
/// @nodoc
class __$$PhotoImplCopyWithImpl<$Res>
extends _$PhotoCopyWithImpl<$Res, _$PhotoImpl>
implements _$$PhotoImplCopyWith<$Res> {
__$$PhotoImplCopyWithImpl(
_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then)
: super(_value, _then);
class __$$PhotoImplCopyWithImpl<$Res> extends _$PhotoCopyWithImpl<$Res, _$PhotoImpl> implements _$$PhotoImplCopyWith<$Res> {
__$$PhotoImplCopyWithImpl(_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then) : super(_value, _then);
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@@ -131,13 +122,9 @@ class __$$PhotoImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$PhotoImpl implements _Photo {
const _$PhotoImpl(
{required this.id,
@JsonKey(name: 'original_name') required this.originalName,
required this.path});
const _$PhotoImpl({required this.id, @JsonKey(name: 'original_name') required this.originalName, required this.path});
factory _$PhotoImpl.fromJson(Map<String, dynamic> json) =>
_$$PhotoImplFromJson(json);
factory _$PhotoImpl.fromJson(Map<String, dynamic> json) => _$$PhotoImplFromJson(json);
@override
final int id;
@@ -158,8 +145,7 @@ class _$PhotoImpl implements _Photo {
(other.runtimeType == runtimeType &&
other is _$PhotoImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.originalName, originalName) ||
other.originalName == originalName) &&
(identical(other.originalName, originalName) || other.originalName == originalName) &&
(identical(other.path, path) || other.path == path));
}
@@ -172,8 +158,7 @@ class _$PhotoImpl implements _Photo {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
__$$PhotoImplCopyWithImpl<_$PhotoImpl>(this, _$identity);
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => __$$PhotoImplCopyWithImpl<_$PhotoImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -184,18 +169,17 @@ class _$PhotoImpl implements _Photo {
}
abstract class _Photo implements Photo {
const factory _Photo(
{required final int id,
@JsonKey(name: 'original_name') required final String originalName,
required final String path}) = _$PhotoImpl;
const factory _Photo({required final int id, @JsonKey(name: 'original_name') required final String originalName, required final String path}) = _$PhotoImpl;
factory _Photo.fromJson(Map<String, dynamic> json) = _$PhotoImpl.fromJson;
@override
int get id;
@override
@JsonKey(name: 'original_name')
String get originalName;
@override
String get path;
@@ -203,6 +187,5 @@ abstract class _Photo implements Photo {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,8 +12,7 @@ _$PhotoImpl _$$PhotoImplFromJson(Map<String, dynamic> json) => _$PhotoImpl(
path: json['path'] as String,
);
Map<String, dynamic> _$$PhotoImplToJson(_$PhotoImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$PhotoImplToJson(_$PhotoImpl instance) => <String, dynamic>{
'id': instance.id,
'original_name': instance.originalName,
'path': instance.path,

View File

@@ -21,9 +21,13 @@ Portion _$PortionFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Portion {
int get id => throw _privateConstructorUsedError;
String get product_name => throw _privateConstructorUsedError;
int get quantity => throw _privateConstructorUsedError;
String get portion => throw _privateConstructorUsedError;
bool get from_diet => throw _privateConstructorUsedError;
/// Serializes this Portion to a JSON map.
@@ -37,24 +41,19 @@ mixin _$Portion {
/// @nodoc
abstract class $PortionCopyWith<$Res> {
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) =
_$PortionCopyWithImpl<$Res, Portion>;
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) = _$PortionCopyWithImpl<$Res, Portion>;
@useResult
$Res call(
{int id,
String product_name,
int quantity,
String portion,
bool from_diet});
$Res call({int id, String product_name, int quantity, String portion, bool from_diet});
}
/// @nodoc
class _$PortionCopyWithImpl<$Res, $Val extends Portion>
implements $PortionCopyWith<$Res> {
class _$PortionCopyWithImpl<$Res, $Val extends Portion> implements $PortionCopyWith<$Res> {
_$PortionCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -96,26 +95,16 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
/// @nodoc
abstract class _$$PortionImplCopyWith<$Res> implements $PortionCopyWith<$Res> {
factory _$$PortionImplCopyWith(
_$PortionImpl value, $Res Function(_$PortionImpl) then) =
__$$PortionImplCopyWithImpl<$Res>;
factory _$$PortionImplCopyWith(_$PortionImpl value, $Res Function(_$PortionImpl) then) = __$$PortionImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int id,
String product_name,
int quantity,
String portion,
bool from_diet});
$Res call({int id, String product_name, int quantity, String portion, bool from_diet});
}
/// @nodoc
class __$$PortionImplCopyWithImpl<$Res>
extends _$PortionCopyWithImpl<$Res, _$PortionImpl>
implements _$$PortionImplCopyWith<$Res> {
__$$PortionImplCopyWithImpl(
_$PortionImpl _value, $Res Function(_$PortionImpl) _then)
: super(_value, _then);
class __$$PortionImplCopyWithImpl<$Res> extends _$PortionCopyWithImpl<$Res, _$PortionImpl> implements _$$PortionImplCopyWith<$Res> {
__$$PortionImplCopyWithImpl(_$PortionImpl _value, $Res Function(_$PortionImpl) _then) : super(_value, _then);
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@@ -156,15 +145,9 @@ class __$$PortionImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$PortionImpl implements _Portion {
const _$PortionImpl(
{required this.id,
required this.product_name,
required this.quantity,
required this.portion,
required this.from_diet});
const _$PortionImpl({required this.id, required this.product_name, required this.quantity, required this.portion, required this.from_diet});
factory _$PortionImpl.fromJson(Map<String, dynamic> json) =>
_$$PortionImplFromJson(json);
factory _$PortionImpl.fromJson(Map<String, dynamic> json) => _$$PortionImplFromJson(json);
@override
final int id;
@@ -188,27 +171,22 @@ class _$PortionImpl implements _Portion {
(other.runtimeType == runtimeType &&
other is _$PortionImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.product_name, product_name) ||
other.product_name == product_name) &&
(identical(other.quantity, quantity) ||
other.quantity == quantity) &&
(identical(other.product_name, product_name) || other.product_name == product_name) &&
(identical(other.quantity, quantity) || other.quantity == quantity) &&
(identical(other.portion, portion) || other.portion == portion) &&
(identical(other.from_diet, from_diet) ||
other.from_diet == from_diet));
(identical(other.from_diet, from_diet) || other.from_diet == from_diet));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, id, product_name, quantity, portion, from_diet);
int get hashCode => Object.hash(runtimeType, id, product_name, quantity, portion, from_diet);
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
__$$PortionImplCopyWithImpl<_$PortionImpl>(this, _$identity);
_$$PortionImplCopyWith<_$PortionImpl> get copyWith => __$$PortionImplCopyWithImpl<_$PortionImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -230,12 +208,16 @@ abstract class _Portion implements Portion {
@override
int get id;
@override
String get product_name;
@override
int get quantity;
@override
String get portion;
@override
bool get from_diet;
@@ -243,6 +225,5 @@ abstract class _Portion implements Portion {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$PortionImplCopyWith<_$PortionImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -6,8 +6,7 @@ part of 'portion.dart';
// JsonSerializableGenerator
// **************************************************************************
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
_$PortionImpl(
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) => _$PortionImpl(
id: (json['id'] as num).toInt(),
product_name: json['product_name'] as String,
quantity: (json['quantity'] as num).toInt(),
@@ -15,8 +14,7 @@ _$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
from_diet: json['from_diet'] as bool,
);
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) => <String, dynamic>{
'id': instance.id,
'product_name': instance.product_name,
'quantity': instance.quantity,

View File

@@ -21,6 +21,7 @@ Product _$ProductFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Product {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
/// Serializes this Product to a JSON map.
@@ -34,19 +35,19 @@ mixin _$Product {
/// @nodoc
abstract class $ProductCopyWith<$Res> {
factory $ProductCopyWith(Product value, $Res Function(Product) then) =
_$ProductCopyWithImpl<$Res, Product>;
factory $ProductCopyWith(Product value, $Res Function(Product) then) = _$ProductCopyWithImpl<$Res, Product>;
@useResult
$Res call({int id, String name});
}
/// @nodoc
class _$ProductCopyWithImpl<$Res, $Val extends Product>
implements $ProductCopyWith<$Res> {
class _$ProductCopyWithImpl<$Res, $Val extends Product> implements $ProductCopyWith<$Res> {
_$ProductCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -73,21 +74,16 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product>
/// @nodoc
abstract class _$$ProductImplCopyWith<$Res> implements $ProductCopyWith<$Res> {
factory _$$ProductImplCopyWith(
_$ProductImpl value, $Res Function(_$ProductImpl) then) =
__$$ProductImplCopyWithImpl<$Res>;
factory _$$ProductImplCopyWith(_$ProductImpl value, $Res Function(_$ProductImpl) then) = __$$ProductImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, String name});
}
/// @nodoc
class __$$ProductImplCopyWithImpl<$Res>
extends _$ProductCopyWithImpl<$Res, _$ProductImpl>
implements _$$ProductImplCopyWith<$Res> {
__$$ProductImplCopyWithImpl(
_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
: super(_value, _then);
class __$$ProductImplCopyWithImpl<$Res> extends _$ProductCopyWithImpl<$Res, _$ProductImpl> implements _$$ProductImplCopyWith<$Res> {
__$$ProductImplCopyWithImpl(_$ProductImpl _value, $Res Function(_$ProductImpl) _then) : super(_value, _then);
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@@ -115,8 +111,7 @@ class __$$ProductImplCopyWithImpl<$Res>
class _$ProductImpl implements _Product {
const _$ProductImpl({required this.id, required this.name});
factory _$ProductImpl.fromJson(Map<String, dynamic> json) =>
_$$ProductImplFromJson(json);
factory _$ProductImpl.fromJson(Map<String, dynamic> json) => _$$ProductImplFromJson(json);
@override
final int id;
@@ -146,8 +141,7 @@ class _$ProductImpl implements _Product {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
__$$ProductImplCopyWithImpl<_$ProductImpl>(this, _$identity);
_$$ProductImplCopyWith<_$ProductImpl> get copyWith => __$$ProductImplCopyWithImpl<_$ProductImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -158,13 +152,13 @@ class _$ProductImpl implements _Product {
}
abstract class _Product implements Product {
const factory _Product({required final int id, required final String name}) =
_$ProductImpl;
const factory _Product({required final int id, required final String name}) = _$ProductImpl;
factory _Product.fromJson(Map<String, dynamic> json) = _$ProductImpl.fromJson;
@override
int get id;
@override
String get name;
@@ -172,6 +166,5 @@ abstract class _Product implements Product {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$ProductImplCopyWith<_$ProductImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -6,14 +6,12 @@ part of 'product.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ProductImpl _$$ProductImplFromJson(Map<String, dynamic> json) =>
_$ProductImpl(
_$ProductImpl _$$ProductImplFromJson(Map<String, dynamic> json) => _$ProductImpl(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
);
Map<String, dynamic> _$$ProductImplToJson(_$ProductImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$ProductImplToJson(_$ProductImpl instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -21,6 +21,7 @@ State _$StateFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$State {
bool get has_chosen_diet => throw _privateConstructorUsedError;
bool get has_chosen_plan => throw _privateConstructorUsedError;
/// Serializes this State to a JSON map.
@@ -34,19 +35,19 @@ mixin _$State {
/// @nodoc
abstract class $StateCopyWith<$Res> {
factory $StateCopyWith(State value, $Res Function(State) then) =
_$StateCopyWithImpl<$Res, State>;
factory $StateCopyWith(State value, $Res Function(State) then) = _$StateCopyWithImpl<$Res, State>;
@useResult
$Res call({bool has_chosen_diet, bool has_chosen_plan});
}
/// @nodoc
class _$StateCopyWithImpl<$Res, $Val extends State>
implements $StateCopyWith<$Res> {
class _$StateCopyWithImpl<$Res, $Val extends State> implements $StateCopyWith<$Res> {
_$StateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -73,21 +74,16 @@ class _$StateCopyWithImpl<$Res, $Val extends State>
/// @nodoc
abstract class _$$StateImplCopyWith<$Res> implements $StateCopyWith<$Res> {
factory _$$StateImplCopyWith(
_$StateImpl value, $Res Function(_$StateImpl) then) =
__$$StateImplCopyWithImpl<$Res>;
factory _$$StateImplCopyWith(_$StateImpl value, $Res Function(_$StateImpl) then) = __$$StateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool has_chosen_diet, bool has_chosen_plan});
}
/// @nodoc
class __$$StateImplCopyWithImpl<$Res>
extends _$StateCopyWithImpl<$Res, _$StateImpl>
implements _$$StateImplCopyWith<$Res> {
__$$StateImplCopyWithImpl(
_$StateImpl _value, $Res Function(_$StateImpl) _then)
: super(_value, _then);
class __$$StateImplCopyWithImpl<$Res> extends _$StateCopyWithImpl<$Res, _$StateImpl> implements _$$StateImplCopyWith<$Res> {
__$$StateImplCopyWithImpl(_$StateImpl _value, $Res Function(_$StateImpl) _then) : super(_value, _then);
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@@ -113,11 +109,9 @@ class __$$StateImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$StateImpl implements _State {
const _$StateImpl(
{required this.has_chosen_diet, required this.has_chosen_plan});
const _$StateImpl({required this.has_chosen_diet, required this.has_chosen_plan});
factory _$StateImpl.fromJson(Map<String, dynamic> json) =>
_$$StateImplFromJson(json);
factory _$StateImpl.fromJson(Map<String, dynamic> json) => _$$StateImplFromJson(json);
@override
final bool has_chosen_diet;
@@ -134,24 +128,20 @@ class _$StateImpl implements _State {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$StateImpl &&
(identical(other.has_chosen_diet, has_chosen_diet) ||
other.has_chosen_diet == has_chosen_diet) &&
(identical(other.has_chosen_plan, has_chosen_plan) ||
other.has_chosen_plan == has_chosen_plan));
(identical(other.has_chosen_diet, has_chosen_diet) || other.has_chosen_diet == has_chosen_diet) &&
(identical(other.has_chosen_plan, has_chosen_plan) || other.has_chosen_plan == has_chosen_plan));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, has_chosen_diet, has_chosen_plan);
int get hashCode => Object.hash(runtimeType, has_chosen_diet, has_chosen_plan);
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
__$$StateImplCopyWithImpl<_$StateImpl>(this, _$identity);
_$$StateImplCopyWith<_$StateImpl> get copyWith => __$$StateImplCopyWithImpl<_$StateImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -162,14 +152,13 @@ class _$StateImpl implements _State {
}
abstract class _State implements State {
const factory _State(
{required final bool has_chosen_diet,
required final bool has_chosen_plan}) = _$StateImpl;
const factory _State({required final bool has_chosen_diet, required final bool has_chosen_plan}) = _$StateImpl;
factory _State.fromJson(Map<String, dynamic> json) = _$StateImpl.fromJson;
@override
bool get has_chosen_diet;
@override
bool get has_chosen_plan;
@@ -177,6 +166,5 @@ abstract class _State implements State {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
throw _privateConstructorUsedError;
_$$StateImplCopyWith<_$StateImpl> get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -11,8 +11,7 @@ _$StateImpl _$$StateImplFromJson(Map<String, dynamic> json) => _$StateImpl(
has_chosen_plan: json['has_chosen_plan'] as bool,
);
Map<String, dynamic> _$$StateImplToJson(_$StateImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$StateImplToJson(_$StateImpl instance) => <String, dynamic>{
'has_chosen_diet': instance.has_chosen_diet,
'has_chosen_plan': instance.has_chosen_plan,
};

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';

View File

@@ -79,8 +79,7 @@ class _DiaryService implements DiaryService {
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, DiaryModel> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, DiaryModel.fromJson(v as Map<String, dynamic>)));
_value = _result.data!.map((k, dynamic v) => MapEntry(k, DiaryModel.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
@@ -140,11 +139,7 @@ class _DiaryService implements DiaryService {
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, List<Product>> _value;
try {
_value = _result.data!.map((k, dynamic v) => MapEntry(
k,
(v as List)
.map((i) => Product.fromJson(i as Map<String, dynamic>))
.toList()));
_value = _result.data!.map((k, dynamic v) => MapEntry(k, (v as List).map((i) => Product.fromJson(i as Map<String, dynamic>)).toList()));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
@@ -333,8 +328,7 @@ class _DiaryService implements DiaryService {
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, Portion> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, Portion.fromJson(v as Map<String, dynamic>)));
_value = _result.data!.map((k, dynamic v) => MapEntry(k, Portion.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
@@ -511,9 +505,7 @@ class _DiaryService implements DiaryService {
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||
requestOptions.responseType == ResponseType.stream)) {
if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) {
if (T == String) {
requestOptions.responseType = ResponseType.plain;
} else {