forked from eatvio/eatvio_app
feat(Лента): фильтрация рецептов по тегам, поиск по строке
This commit is contained in:
@@ -1,68 +1,30 @@
|
||||
import 'package:eatvio_app/core/models/base_models.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'comment_model.freezed.dart';
|
||||
part 'comment_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class Comment with _$Comment {
|
||||
const factory Comment({
|
||||
@JsonKey(name: "data") required List<Datum> data,
|
||||
class CommentModel with _$CommentModel {
|
||||
const factory CommentModel({
|
||||
@JsonKey(name: "data") required List<Comment> data,
|
||||
@JsonKey(name: "links") required Links links,
|
||||
@JsonKey(name: "meta") required Meta meta,
|
||||
}) = _Comment;
|
||||
}) = _CommentModel;
|
||||
|
||||
factory Comment.fromJson(Map<String, Object?> json) => _$CommentFromJson(json);
|
||||
factory CommentModel.fromJson(Map<String, Object?> json) => _$CommentModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Datum with _$Datum {
|
||||
const factory Datum({
|
||||
class Comment with _$Comment {
|
||||
const factory Comment({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "author_name") required String authorName,
|
||||
@JsonKey(name: "author_profile_icon") required String authorProfileIcon,
|
||||
@JsonKey(name: "body") required String body,
|
||||
@JsonKey(name: "children_comments") required List<Datum> childrenComments,
|
||||
@JsonKey(name: "children_comments") required List<Comment> childrenComments,
|
||||
@JsonKey(name: "created_at") required DateTime createdAt,
|
||||
}) = _Datum;
|
||||
}) = _Comment;
|
||||
|
||||
factory Datum.fromJson(Map<String, Object?> json) => _$DatumFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Links with _$Links {
|
||||
const factory Links({
|
||||
@JsonKey(name: "first") required String first,
|
||||
@JsonKey(name: "last") required String last,
|
||||
@JsonKey(name: "prev") required dynamic prev,
|
||||
@JsonKey(name: "next") required dynamic next,
|
||||
}) = _Links;
|
||||
|
||||
factory Links.fromJson(Map<String, Object?> json) => _$LinksFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Meta with _$Meta {
|
||||
const factory Meta({
|
||||
@JsonKey(name: "current_page") required int currentPage,
|
||||
@JsonKey(name: "from") required int from,
|
||||
@JsonKey(name: "last_page") required int lastPage,
|
||||
@JsonKey(name: "links") required List<Link> links,
|
||||
@JsonKey(name: "path") required String path,
|
||||
@JsonKey(name: "per_page") required int perPage,
|
||||
@JsonKey(name: "to") required int to,
|
||||
@JsonKey(name: "total") required int total,
|
||||
}) = _Meta;
|
||||
|
||||
factory Meta.fromJson(Map<String, Object?> json) => _$MetaFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Link with _$Link {
|
||||
const factory Link({
|
||||
@JsonKey(name: "url") required String? url,
|
||||
@JsonKey(name: "label") required String label,
|
||||
@JsonKey(name: "active") required bool active,
|
||||
}) = _Link;
|
||||
|
||||
factory Link.fromJson(Map<String, Object?> json) => _$LinkFromJson(json);
|
||||
factory Comment.fromJson(Map<String, Object?> json) => _$CommentFromJson(json);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,34 +6,35 @@ part of 'comment_model.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$CommentImpl _$$CommentImplFromJson(Map<String, dynamic> json) =>
|
||||
_$CommentImpl(
|
||||
_$CommentModelImpl _$$CommentModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$CommentModelImpl(
|
||||
data: (json['data'] as List<dynamic>)
|
||||
.map((e) => Datum.fromJson(e as Map<String, dynamic>))
|
||||
.map((e) => Comment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
links: Links.fromJson(json['links'] as Map<String, dynamic>),
|
||||
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CommentImplToJson(_$CommentImpl instance) =>
|
||||
Map<String, dynamic> _$$CommentModelImplToJson(_$CommentModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'data': instance.data,
|
||||
'links': instance.links,
|
||||
'meta': instance.meta,
|
||||
};
|
||||
|
||||
_$DatumImpl _$$DatumImplFromJson(Map<String, dynamic> json) => _$DatumImpl(
|
||||
_$CommentImpl _$$CommentImplFromJson(Map<String, dynamic> json) =>
|
||||
_$CommentImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
authorName: json['author_name'] as String,
|
||||
authorProfileIcon: json['author_profile_icon'] as String,
|
||||
body: json['body'] as String,
|
||||
childrenComments: (json['children_comments'] as List<dynamic>)
|
||||
.map((e) => Datum.fromJson(e as Map<String, dynamic>))
|
||||
.map((e) => Comment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DatumImplToJson(_$DatumImpl instance) =>
|
||||
Map<String, dynamic> _$$CommentImplToJson(_$CommentImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'author_name': instance.authorName,
|
||||
@@ -42,56 +43,3 @@ Map<String, dynamic> _$$DatumImplToJson(_$DatumImpl instance) =>
|
||||
'children_comments': instance.childrenComments,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
};
|
||||
|
||||
_$LinksImpl _$$LinksImplFromJson(Map<String, dynamic> json) => _$LinksImpl(
|
||||
first: json['first'] as String,
|
||||
last: json['last'] as String,
|
||||
prev: json['prev'],
|
||||
next: json['next'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'first': instance.first,
|
||||
'last': instance.last,
|
||||
'prev': instance.prev,
|
||||
'next': instance.next,
|
||||
};
|
||||
|
||||
_$MetaImpl _$$MetaImplFromJson(Map<String, dynamic> json) => _$MetaImpl(
|
||||
currentPage: (json['current_page'] as num).toInt(),
|
||||
from: (json['from'] as num).toInt(),
|
||||
lastPage: (json['last_page'] as num).toInt(),
|
||||
links: (json['links'] as List<dynamic>)
|
||||
.map((e) => Link.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
path: json['path'] as String,
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
to: (json['to'] as num).toInt(),
|
||||
total: (json['total'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'current_page': instance.currentPage,
|
||||
'from': instance.from,
|
||||
'last_page': instance.lastPage,
|
||||
'links': instance.links,
|
||||
'path': instance.path,
|
||||
'per_page': instance.perPage,
|
||||
'to': instance.to,
|
||||
'total': instance.total,
|
||||
};
|
||||
|
||||
_$LinkImpl _$$LinkImplFromJson(Map<String, dynamic> json) => _$LinkImpl(
|
||||
url: json['url'] as String?,
|
||||
label: json['label'] as String,
|
||||
active: json['active'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinkImplToJson(_$LinkImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'url': instance.url,
|
||||
'label': instance.label,
|
||||
'active': instance.active,
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/core/models/base_models.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'diets_pagination_model.freezed.dart';
|
||||
@@ -6,7 +7,7 @@ part 'diets_pagination_model.g.dart';
|
||||
@freezed
|
||||
class DietsPagination with _$DietsPagination {
|
||||
const factory DietsPagination({
|
||||
@JsonKey(name: "data") required List<Datum> data,
|
||||
@JsonKey(name: "data") required List<Diet> data,
|
||||
@JsonKey(name: "links") required Links links,
|
||||
@JsonKey(name: "meta") required Meta meta,
|
||||
}) = _DietsPagination;
|
||||
@@ -15,23 +16,23 @@ class DietsPagination with _$DietsPagination {
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Datum with _$Datum {
|
||||
const factory Datum({
|
||||
class Diet with _$Diet {
|
||||
const factory Diet({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "name") required String name,
|
||||
@JsonKey(name: "image") required String image,
|
||||
@JsonKey(name: "duration") required int duration,
|
||||
@JsonKey(name: "state") required String state,
|
||||
@JsonKey(name: "type") required Type type,
|
||||
@JsonKey(name: "type") required DietType type,
|
||||
@JsonKey(name: "details") required String details,
|
||||
@JsonKey(name: "daily_schedule") required List<List<List<DailySchedule>>> dailySchedule,
|
||||
@JsonKey(name: "author") required Author author,
|
||||
@JsonKey(name: "total_likes") required int totalLikes,
|
||||
@JsonKey(name: "total_views") required int totalViews,
|
||||
@JsonKey(name: "total_comments") required int totalComments,
|
||||
}) = _Datum;
|
||||
}) = _Diet;
|
||||
|
||||
factory Datum.fromJson(Map<String, dynamic> json) => _$DatumFromJson(json);
|
||||
factory Diet.fromJson(Map<String, dynamic> json) => _$DietFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
@@ -70,54 +71,15 @@ enum Portion {
|
||||
final portionValues = EnumValues({"grams": Portion.GRAMS, "milliliters": Portion.MILLILITERS, "pcs": Portion.PCS});
|
||||
|
||||
@freezed
|
||||
class Type with _$Type {
|
||||
const factory Type({
|
||||
class DietType with _$DietType {
|
||||
const factory DietType({
|
||||
@JsonKey(name: "alko") bool? alko,
|
||||
@JsonKey(name: "veg") bool? veg,
|
||||
@JsonKey(name: "corb") bool? corb,
|
||||
@JsonKey(name: "meat") bool? meat,
|
||||
}) = _Type;
|
||||
}) = _DietType;
|
||||
|
||||
factory Type.fromJson(Map<String, dynamic> json) => _$TypeFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Links with _$Links {
|
||||
const factory Links({
|
||||
@JsonKey(name: "first") required String first,
|
||||
@JsonKey(name: "last") required String last,
|
||||
@JsonKey(name: "prev") required dynamic prev,
|
||||
@JsonKey(name: "next") required dynamic next,
|
||||
}) = _Links;
|
||||
|
||||
factory Links.fromJson(Map<String, dynamic> json) => _$LinksFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Meta with _$Meta {
|
||||
const factory Meta({
|
||||
@JsonKey(name: "current_page") required int currentPage,
|
||||
@JsonKey(name: "from") required int from,
|
||||
@JsonKey(name: "last_page") required int lastPage,
|
||||
@JsonKey(name: "links") required List<Link> links,
|
||||
@JsonKey(name: "path") required String path,
|
||||
@JsonKey(name: "per_page") required int perPage,
|
||||
@JsonKey(name: "to") required int to,
|
||||
@JsonKey(name: "total") required int total,
|
||||
}) = _Meta;
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => _$MetaFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Link with _$Link {
|
||||
const factory Link({
|
||||
@JsonKey(name: "url") required String? url,
|
||||
@JsonKey(name: "label") required String label,
|
||||
@JsonKey(name: "active") required bool active,
|
||||
}) = _Link;
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => _$LinkFromJson(json);
|
||||
factory DietType.fromJson(Map<String, dynamic> json) => _$DietTypeFromJson(json);
|
||||
}
|
||||
|
||||
class EnumValues<T> {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ _$DietsPaginationImpl _$$DietsPaginationImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$DietsPaginationImpl(
|
||||
data: (json['data'] as List<dynamic>)
|
||||
.map((e) => Datum.fromJson(e as Map<String, dynamic>))
|
||||
.map((e) => Diet.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
links: Links.fromJson(json['links'] as Map<String, dynamic>),
|
||||
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
|
||||
@@ -24,13 +24,13 @@ Map<String, dynamic> _$$DietsPaginationImplToJson(
|
||||
'meta': instance.meta,
|
||||
};
|
||||
|
||||
_$DatumImpl _$$DatumImplFromJson(Map<String, dynamic> json) => _$DatumImpl(
|
||||
_$DietImpl _$$DietImplFromJson(Map<String, dynamic> json) => _$DietImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
name: json['name'] as String,
|
||||
image: json['image'] as String,
|
||||
duration: (json['duration'] as num).toInt(),
|
||||
state: json['state'] as String,
|
||||
type: Type.fromJson(json['type'] as Map<String, dynamic>),
|
||||
type: DietType.fromJson(json['type'] as Map<String, dynamic>),
|
||||
details: json['details'] as String,
|
||||
dailySchedule: (json['daily_schedule'] as List<dynamic>)
|
||||
.map((e) => (e as List<dynamic>)
|
||||
@@ -45,7 +45,7 @@ _$DatumImpl _$$DatumImplFromJson(Map<String, dynamic> json) => _$DatumImpl(
|
||||
totalComments: (json['total_comments'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DatumImplToJson(_$DatumImpl instance) =>
|
||||
Map<String, dynamic> _$$DietImplToJson(_$DietImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
@@ -98,70 +98,18 @@ const _$PortionEnumMap = {
|
||||
Portion.PCS: 'pcs',
|
||||
};
|
||||
|
||||
_$TypeImpl _$$TypeImplFromJson(Map<String, dynamic> json) => _$TypeImpl(
|
||||
_$DietTypeImpl _$$DietTypeImplFromJson(Map<String, dynamic> json) =>
|
||||
_$DietTypeImpl(
|
||||
alko: json['alko'] as bool?,
|
||||
veg: json['veg'] as bool?,
|
||||
corb: json['corb'] as bool?,
|
||||
meat: json['meat'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$TypeImplToJson(_$TypeImpl instance) =>
|
||||
Map<String, dynamic> _$$DietTypeImplToJson(_$DietTypeImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'alko': instance.alko,
|
||||
'veg': instance.veg,
|
||||
'corb': instance.corb,
|
||||
'meat': instance.meat,
|
||||
};
|
||||
|
||||
_$LinksImpl _$$LinksImplFromJson(Map<String, dynamic> json) => _$LinksImpl(
|
||||
first: json['first'] as String,
|
||||
last: json['last'] as String,
|
||||
prev: json['prev'],
|
||||
next: json['next'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'first': instance.first,
|
||||
'last': instance.last,
|
||||
'prev': instance.prev,
|
||||
'next': instance.next,
|
||||
};
|
||||
|
||||
_$MetaImpl _$$MetaImplFromJson(Map<String, dynamic> json) => _$MetaImpl(
|
||||
currentPage: (json['current_page'] as num).toInt(),
|
||||
from: (json['from'] as num).toInt(),
|
||||
lastPage: (json['last_page'] as num).toInt(),
|
||||
links: (json['links'] as List<dynamic>)
|
||||
.map((e) => Link.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
path: json['path'] as String,
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
to: (json['to'] as num).toInt(),
|
||||
total: (json['total'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'current_page': instance.currentPage,
|
||||
'from': instance.from,
|
||||
'last_page': instance.lastPage,
|
||||
'links': instance.links,
|
||||
'path': instance.path,
|
||||
'per_page': instance.perPage,
|
||||
'to': instance.to,
|
||||
'total': instance.total,
|
||||
};
|
||||
|
||||
_$LinkImpl _$$LinkImplFromJson(Map<String, dynamic> json) => _$LinkImpl(
|
||||
url: json['url'] as String?,
|
||||
label: json['label'] as String,
|
||||
active: json['active'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinkImplToJson(_$LinkImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'url': instance.url,
|
||||
'label': instance.label,
|
||||
'active': instance.active,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/core/models/base_models.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user