feat(feed): add recipes screen

This commit is contained in:
mso7nueh
2024-08-02 11:52:10 +03:00
parent c78f8dacdf
commit 904adbba2f
111 changed files with 1511 additions and 1784 deletions

View File

@@ -3,6 +3,7 @@ import './portion.dart';
import './photo.dart';
part 'meal.freezed.dart';
part 'meal.g.dart';
@freezed

View File

@@ -21,14 +21,21 @@ 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;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$MealCopyWith<Meal> get copyWith => throw _privateConstructorUsedError;
}
@@ -36,16 +43,16 @@ mixin _$Meal {
/// @nodoc
abstract class $MealCopyWith<$Res> {
factory $MealCopyWith(Meal value, $Res Function(Meal) then) =
_$MealCopyWithImpl<$Res, Meal>;
_$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
@@ -55,6 +62,7 @@ class _$MealCopyWithImpl<$Res, $Val extends Meal>
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -73,55 +81,53 @@ class _$MealCopyWithImpl<$Res, $Val extends Meal>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
time: null == time
? _value.time
: time // ignore: cast_nullable_to_non_nullable
as String,
as String,
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as int,
as int,
satiety: null == satiety
? _value.satiety
: satiety // ignore: cast_nullable_to_non_nullable
as int,
as int,
mood: null == mood
? _value.mood
: mood // ignore: cast_nullable_to_non_nullable
as int,
as int,
portions: null == portions
? _value.portions
: portions // ignore: cast_nullable_to_non_nullable
as List<Portion>,
as List<Portion>,
photos: null == photos
? _value.photos
: photos // ignore: cast_nullable_to_non_nullable
as List<Photo>,
as List<Photo>,
) as $Val);
}
}
/// @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>
class __$$MealImplCopyWithImpl<$Res> extends _$MealCopyWithImpl<$Res, _$MealImpl>
implements _$$MealImplCopyWith<$Res> {
__$$MealImplCopyWithImpl(_$MealImpl _value, $Res Function(_$MealImpl) _then)
: super(_value, _then);
@@ -141,31 +147,31 @@ class __$$MealImplCopyWithImpl<$Res>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
time: null == time
? _value.time
: time // ignore: cast_nullable_to_non_nullable
as String,
as String,
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as int,
as int,
satiety: null == satiety
? _value.satiety
: satiety // ignore: cast_nullable_to_non_nullable
as int,
as int,
mood: null == mood
? _value.mood
: mood // ignore: cast_nullable_to_non_nullable
as int,
as int,
portions: null == portions
? _value._portions
: portions // ignore: cast_nullable_to_non_nullable
as List<Portion>,
as List<Portion>,
photos: null == photos
? _value._photos
: photos // ignore: cast_nullable_to_non_nullable
as List<Photo>,
as List<Photo>,
));
}
}
@@ -173,14 +179,13 @@ class __$$MealImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$MealImpl implements _Meal {
const _$MealImpl(
{required this.id,
required this.time,
required this.type,
required this.satiety,
required this.mood,
required final List<Portion> portions,
required final List<Photo> photos})
const _$MealImpl({required this.id,
required this.time,
required this.type,
required this.satiety,
required this.mood,
required final List<Portion> portions,
required final List<Photo> photos})
: _portions = portions,
_photos = photos;
@@ -198,6 +203,7 @@ class _$MealImpl implements _Meal {
@override
final int mood;
final List<Portion> _portions;
@override
List<Portion> get portions {
if (_portions is EqualUnmodifiableListView) return _portions;
@@ -206,6 +212,7 @@ class _$MealImpl implements _Meal {
}
final List<Photo> _photos;
@override
List<Photo> get photos {
if (_photos is EqualUnmodifiableListView) return _photos;
@@ -234,15 +241,16 @@ class _$MealImpl implements _Meal {
@JsonKey(ignore: true)
@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));
@JsonKey(ignore: true)
@override
@@ -259,31 +267,37 @@ class _$MealImpl implements _Meal {
}
abstract class _Meal implements Meal {
const factory _Meal(
{required final int id,
required final String time,
required final int type,
required final int satiety,
required final int mood,
required final List<Portion> portions,
required final List<Photo> photos}) = _$MealImpl;
const factory _Meal({required final int id,
required final String time,
required final int type,
required final int satiety,
required final int mood,
required final List<Portion> portions,
required final List<Photo> photos}) = _$MealImpl;
factory _Meal.fromJson(Map<String, dynamic> json) = _$MealImpl.fromJson;
@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;
@override
@JsonKey(ignore: true)
_$$MealImplCopyWith<_$MealImpl> get copyWith =>

View File

@@ -6,7 +6,8 @@ part of 'meal.dart';
// JsonSerializableGenerator
// **************************************************************************
_$MealImpl _$$MealImplFromJson(Map<String, dynamic> json) => _$MealImpl(
_$MealImpl _$$MealImplFromJson(Map<String, dynamic> json) =>
_$MealImpl(
id: (json['id'] as num).toInt(),
time: json['time'] as String,
type: (json['type'] as num).toInt(),

View File

@@ -1,14 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'photo.freezed.dart';
part 'photo.g.dart';
@freezed
class Photo with _$Photo {
const factory Photo({
required int id,
@JsonKey(name: 'original_name')
required String originalName,
@JsonKey(name: 'original_name') required String originalName,
required String path,
}) = _Photo;

View File

@@ -21,11 +21,14 @@ 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;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$PhotoCopyWith<Photo> get copyWith => throw _privateConstructorUsedError;
}
@@ -33,12 +36,12 @@ mixin _$Photo {
/// @nodoc
abstract class $PhotoCopyWith<$Res> {
factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) =
_$PhotoCopyWithImpl<$Res, Photo>;
_$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
@@ -48,6 +51,7 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -62,38 +66,35 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
originalName: null == originalName
? _value.originalName
: originalName // ignore: cast_nullable_to_non_nullable
as String,
as String,
path: null == path
? _value.path
: path // ignore: cast_nullable_to_non_nullable
as String,
as String,
) as $Val);
}
}
/// @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>
class __$$PhotoImplCopyWithImpl<$Res> extends _$PhotoCopyWithImpl<$Res, _$PhotoImpl>
implements _$$PhotoImplCopyWith<$Res> {
__$$PhotoImplCopyWithImpl(
_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then)
__$$PhotoImplCopyWithImpl(_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -107,15 +108,15 @@ class __$$PhotoImplCopyWithImpl<$Res>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
originalName: null == originalName
? _value.originalName
: originalName // ignore: cast_nullable_to_non_nullable
as String,
as String,
path: null == path
? _value.path
: path // ignore: cast_nullable_to_non_nullable
as String,
as String,
));
}
}
@@ -123,10 +124,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);
@@ -174,20 +174,22 @@ 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;
@override
@JsonKey(ignore: true)
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>

View File

@@ -6,7 +6,8 @@ part of 'photo.dart';
// JsonSerializableGenerator
// **************************************************************************
_$PhotoImpl _$$PhotoImplFromJson(Map<String, dynamic> json) => _$PhotoImpl(
_$PhotoImpl _$$PhotoImplFromJson(Map<String, dynamic> json) =>
_$PhotoImpl(
id: (json['id'] as num).toInt(),
originalName: json['original_name'] as String,
path: json['path'] as String,

View File

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

View File

@@ -21,11 +21,15 @@ 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;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$PortionCopyWith<Portion> get copyWith => throw _privateConstructorUsedError;
}
@@ -33,7 +37,8 @@ mixin _$Portion {
/// @nodoc
abstract class $PortionCopyWith<$Res> {
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) =
_$PortionCopyWithImpl<$Res, Portion>;
_$PortionCopyWithImpl<$Res, Portion>;
@useResult
$Res call({int id, String product_name, int quantity, String portion});
}
@@ -45,6 +50,7 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -60,39 +66,37 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
product_name: null == product_name
? _value.product_name
: product_name // ignore: cast_nullable_to_non_nullable
as String,
as String,
quantity: null == quantity
? _value.quantity
: quantity // ignore: cast_nullable_to_non_nullable
as int,
as int,
portion: null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
as String,
) as $Val);
}
}
/// @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});
}
/// @nodoc
class __$$PortionImplCopyWithImpl<$Res>
extends _$PortionCopyWithImpl<$Res, _$PortionImpl>
class __$$PortionImplCopyWithImpl<$Res> extends _$PortionCopyWithImpl<$Res, _$PortionImpl>
implements _$$PortionImplCopyWith<$Res> {
__$$PortionImplCopyWithImpl(
_$PortionImpl _value, $Res Function(_$PortionImpl) _then)
__$$PortionImplCopyWithImpl(_$PortionImpl _value, $Res Function(_$PortionImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -107,19 +111,19 @@ class __$$PortionImplCopyWithImpl<$Res>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
product_name: null == product_name
? _value.product_name
: product_name // ignore: cast_nullable_to_non_nullable
as String,
as String,
quantity: null == quantity
? _value.quantity
: quantity // ignore: cast_nullable_to_non_nullable
as int,
as int,
portion: null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
as String,
));
}
}
@@ -127,11 +131,10 @@ class __$$PortionImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$PortionImpl implements _Portion {
const _$PortionImpl(
{required this.id,
required this.product_name,
required this.quantity,
required this.portion});
const _$PortionImpl({required this.id,
required this.product_name,
required this.quantity,
required this.portion});
factory _$PortionImpl.fromJson(Map<String, dynamic> json) =>
_$$PortionImplFromJson(json);
@@ -183,22 +186,25 @@ class _$PortionImpl implements _Portion {
}
abstract class _Portion implements Portion {
const factory _Portion(
{required final int id,
required final String product_name,
required final int quantity,
required final String portion}) = _$PortionImpl;
const factory _Portion({required final int id,
required final String product_name,
required final int quantity,
required final String portion}) = _$PortionImpl;
factory _Portion.fromJson(Map<String, dynamic> json) = _$PortionImpl.fromJson;
@override
int get id;
@override
String get product_name;
@override
int get quantity;
@override
String get portion;
@override
@JsonKey(ignore: true)
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>

View File

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

View File

@@ -21,9 +21,11 @@ Product _$ProductFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Product {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ProductCopyWith<Product> get copyWith => throw _privateConstructorUsedError;
}
@@ -31,7 +33,8 @@ mixin _$Product {
/// @nodoc
abstract class $ProductCopyWith<$Res> {
factory $ProductCopyWith(Product value, $Res Function(Product) then) =
_$ProductCopyWithImpl<$Res, Product>;
_$ProductCopyWithImpl<$Res, Product>;
@useResult
$Res call({int id, String name});
}
@@ -43,6 +46,7 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product>
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -56,31 +60,29 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
as String,
) as $Val);
}
}
/// @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>
class __$$ProductImplCopyWithImpl<$Res> extends _$ProductCopyWithImpl<$Res, _$ProductImpl>
implements _$$ProductImplCopyWith<$Res> {
__$$ProductImplCopyWithImpl(
_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
__$$ProductImplCopyWithImpl(_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -93,11 +95,11 @@ class __$$ProductImplCopyWithImpl<$Res>
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
as String,
));
}
}
@@ -149,14 +151,16 @@ class _$ProductImpl implements _Product {
abstract class _Product implements Product {
const factory _Product({required final int id, required final String name}) =
_$ProductImpl;
_$ProductImpl;
factory _Product.fromJson(Map<String, dynamic> json) = _$ProductImpl.fromJson;
@override
int get id;
@override
String get name;
@override
@JsonKey(ignore: true)
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>