forked from eatvio/eatvio_app
plans filters ready
This commit is contained in:
@@ -13,8 +13,8 @@ class FeedBlogPostModel with _$FeedBlogPostModel {
|
||||
required String description,
|
||||
required Author author,
|
||||
@JsonKey(name: "video_url") required String videoUrl,
|
||||
@JsonKey(name: "created_at") required DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required DateTime updatedAt,
|
||||
@JsonKey(name: "created_at", fromJson: parseDate) required DateTime createdAt,
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate) required DateTime updatedAt,
|
||||
required String title,
|
||||
@JsonKey(name: "total_likes") required int totalLikes,
|
||||
@JsonKey(name: "total_views") required int totalViews,
|
||||
@@ -24,3 +24,5 @@ class FeedBlogPostModel with _$FeedBlogPostModel {
|
||||
|
||||
factory FeedBlogPostModel.fromJson(Map<String, Object?> json) => _$FeedBlogPostModelFromJson(json);
|
||||
}
|
||||
|
||||
DateTime parseDate(String date) => DateTime.parse(date).toLocal();
|
||||
@@ -27,9 +27,9 @@ mixin _$FeedBlogPostModel {
|
||||
Author get author => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "video_url")
|
||||
String get videoUrl => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "created_at")
|
||||
@JsonKey(name: "created_at", fromJson: parseDate)
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "updated_at")
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate)
|
||||
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total_likes")
|
||||
@@ -64,8 +64,8 @@ abstract class $FeedBlogPostModelCopyWith<$Res> {
|
||||
String description,
|
||||
Author author,
|
||||
@JsonKey(name: "video_url") String videoUrl,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt,
|
||||
@JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt,
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt,
|
||||
String title,
|
||||
@JsonKey(name: "total_likes") int totalLikes,
|
||||
@JsonKey(name: "total_views") int totalViews,
|
||||
@@ -186,8 +186,8 @@ abstract class _$$FeedBlogPostModelImplCopyWith<$Res>
|
||||
String description,
|
||||
Author author,
|
||||
@JsonKey(name: "video_url") String videoUrl,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt,
|
||||
@JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt,
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt,
|
||||
String title,
|
||||
@JsonKey(name: "total_likes") int totalLikes,
|
||||
@JsonKey(name: "total_views") int totalViews,
|
||||
@@ -292,8 +292,8 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
|
||||
required this.description,
|
||||
required this.author,
|
||||
@JsonKey(name: "video_url") required this.videoUrl,
|
||||
@JsonKey(name: "created_at") required this.createdAt,
|
||||
@JsonKey(name: "updated_at") required this.updatedAt,
|
||||
@JsonKey(name: "created_at", fromJson: parseDate) required this.createdAt,
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate) required this.updatedAt,
|
||||
required this.title,
|
||||
@JsonKey(name: "total_likes") required this.totalLikes,
|
||||
@JsonKey(name: "total_views") required this.totalViews,
|
||||
@@ -317,10 +317,10 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
|
||||
@JsonKey(name: "video_url")
|
||||
final String videoUrl;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
@JsonKey(name: "created_at", fromJson: parseDate)
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate)
|
||||
final DateTime updatedAt;
|
||||
@override
|
||||
final String title;
|
||||
@@ -413,8 +413,10 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel {
|
||||
required final String description,
|
||||
required final Author author,
|
||||
@JsonKey(name: "video_url") required final String videoUrl,
|
||||
@JsonKey(name: "created_at") required final DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required final DateTime updatedAt,
|
||||
@JsonKey(name: "created_at", fromJson: parseDate)
|
||||
required final DateTime createdAt,
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate)
|
||||
required final DateTime updatedAt,
|
||||
required final String title,
|
||||
@JsonKey(name: "total_likes") required final int totalLikes,
|
||||
@JsonKey(name: "total_views") required final int totalViews,
|
||||
@@ -439,10 +441,10 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel {
|
||||
@JsonKey(name: "video_url")
|
||||
String get videoUrl;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
@JsonKey(name: "created_at", fromJson: parseDate)
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
@JsonKey(name: "updated_at", fromJson: parseDate)
|
||||
DateTime get updatedAt;
|
||||
@override
|
||||
String get title;
|
||||
|
||||
@@ -15,8 +15,8 @@ _$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson(
|
||||
description: json['description'] as String,
|
||||
author: Author.fromJson(json['author'] as Map<String, dynamic>),
|
||||
videoUrl: json['video_url'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
createdAt: parseDate(json['created_at'] as String),
|
||||
updatedAt: parseDate(json['updated_at'] as String),
|
||||
title: json['title'] as String,
|
||||
totalLikes: (json['total_likes'] as num).toInt(),
|
||||
totalViews: (json['total_views'] as num).toInt(),
|
||||
|
||||
@@ -37,6 +37,7 @@ class PlanModel with _$PlanModel {
|
||||
@JsonKey(name: "total_views") required int totalViews,
|
||||
@JsonKey(name: "total_comments") required int totalComments,
|
||||
@JsonKey(name: "is_favorite") required bool isFavorite,
|
||||
@Default(false) bool wasLikedByMe,
|
||||
}) = _PlanModel;
|
||||
|
||||
factory PlanModel.fromJson(Map<String, dynamic> json) => _$PlanModelFromJson(json);
|
||||
|
||||
@@ -294,6 +294,7 @@ mixin _$PlanModel {
|
||||
int get totalComments => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "is_favorite")
|
||||
bool get isFavorite => throw _privateConstructorUsedError;
|
||||
bool get wasLikedByMe => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this PlanModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -327,7 +328,8 @@ abstract class $PlanModelCopyWith<$Res> {
|
||||
@JsonKey(name: "total_likes") int totalLikes,
|
||||
@JsonKey(name: "total_views") int totalViews,
|
||||
@JsonKey(name: "total_comments") int totalComments,
|
||||
@JsonKey(name: "is_favorite") bool isFavorite});
|
||||
@JsonKey(name: "is_favorite") bool isFavorite,
|
||||
bool wasLikedByMe});
|
||||
|
||||
$PlanTypeCopyWith<$Res> get type;
|
||||
$PacketOptionsCopyWith<$Res>? get packet1Options;
|
||||
@@ -368,6 +370,7 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
|
||||
Object? totalViews = null,
|
||||
Object? totalComments = null,
|
||||
Object? isFavorite = null,
|
||||
Object? wasLikedByMe = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
@@ -438,6 +441,10 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
|
||||
? _value.isFavorite
|
||||
: isFavorite // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
wasLikedByMe: null == wasLikedByMe
|
||||
? _value.wasLikedByMe
|
||||
: wasLikedByMe // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@@ -529,7 +536,8 @@ abstract class _$$PlanModelImplCopyWith<$Res>
|
||||
@JsonKey(name: "total_likes") int totalLikes,
|
||||
@JsonKey(name: "total_views") int totalViews,
|
||||
@JsonKey(name: "total_comments") int totalComments,
|
||||
@JsonKey(name: "is_favorite") bool isFavorite});
|
||||
@JsonKey(name: "is_favorite") bool isFavorite,
|
||||
bool wasLikedByMe});
|
||||
|
||||
@override
|
||||
$PlanTypeCopyWith<$Res> get type;
|
||||
@@ -573,6 +581,7 @@ class __$$PlanModelImplCopyWithImpl<$Res>
|
||||
Object? totalViews = null,
|
||||
Object? totalComments = null,
|
||||
Object? isFavorite = null,
|
||||
Object? wasLikedByMe = null,
|
||||
}) {
|
||||
return _then(_$PlanModelImpl(
|
||||
id: null == id
|
||||
@@ -643,6 +652,10 @@ class __$$PlanModelImplCopyWithImpl<$Res>
|
||||
? _value.isFavorite
|
||||
: isFavorite // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
wasLikedByMe: null == wasLikedByMe
|
||||
? _value.wasLikedByMe
|
||||
: wasLikedByMe // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -667,7 +680,8 @@ class _$PlanModelImpl implements _PlanModel {
|
||||
@JsonKey(name: "total_likes") required this.totalLikes,
|
||||
@JsonKey(name: "total_views") required this.totalViews,
|
||||
@JsonKey(name: "total_comments") required this.totalComments,
|
||||
@JsonKey(name: "is_favorite") required this.isFavorite});
|
||||
@JsonKey(name: "is_favorite") required this.isFavorite,
|
||||
this.wasLikedByMe = false});
|
||||
|
||||
factory _$PlanModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$PlanModelImplFromJson(json);
|
||||
@@ -723,10 +737,13 @@ class _$PlanModelImpl implements _PlanModel {
|
||||
@override
|
||||
@JsonKey(name: "is_favorite")
|
||||
final bool isFavorite;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool wasLikedByMe;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PlanModel(id: $id, slug: $slug, name: $name, image: $image, duration: $duration, state: $state, type: $type, details: $details, packetsCount: $packetsCount, packet1Options: $packet1Options, packet2Options: $packet2Options, packet3Options: $packet3Options, author: $author, totalLikes: $totalLikes, totalViews: $totalViews, totalComments: $totalComments, isFavorite: $isFavorite)';
|
||||
return 'PlanModel(id: $id, slug: $slug, name: $name, image: $image, duration: $duration, state: $state, type: $type, details: $details, packetsCount: $packetsCount, packet1Options: $packet1Options, packet2Options: $packet2Options, packet3Options: $packet3Options, author: $author, totalLikes: $totalLikes, totalViews: $totalViews, totalComments: $totalComments, isFavorite: $isFavorite, wasLikedByMe: $wasLikedByMe)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -759,7 +776,9 @@ class _$PlanModelImpl implements _PlanModel {
|
||||
(identical(other.totalComments, totalComments) ||
|
||||
other.totalComments == totalComments) &&
|
||||
(identical(other.isFavorite, isFavorite) ||
|
||||
other.isFavorite == isFavorite));
|
||||
other.isFavorite == isFavorite) &&
|
||||
(identical(other.wasLikedByMe, wasLikedByMe) ||
|
||||
other.wasLikedByMe == wasLikedByMe));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -782,7 +801,8 @@ class _$PlanModelImpl implements _PlanModel {
|
||||
totalLikes,
|
||||
totalViews,
|
||||
totalComments,
|
||||
isFavorite);
|
||||
isFavorite,
|
||||
wasLikedByMe);
|
||||
|
||||
/// Create a copy of PlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -802,24 +822,24 @@ class _$PlanModelImpl implements _PlanModel {
|
||||
|
||||
abstract class _PlanModel implements PlanModel {
|
||||
const factory _PlanModel(
|
||||
{@JsonKey(name: "id") required final int id,
|
||||
@JsonKey(name: "slug") required final String slug,
|
||||
@JsonKey(name: "name") required final String name,
|
||||
@JsonKey(name: "image") required final String image,
|
||||
@JsonKey(name: "duration") required final int duration,
|
||||
@JsonKey(name: "state") required final String state,
|
||||
@JsonKey(name: "type") required final PlanType type,
|
||||
@JsonKey(name: "details") required final String details,
|
||||
@JsonKey(name: "packets_count") required final int packetsCount,
|
||||
@JsonKey(name: "packet1_options") final PacketOptions? packet1Options,
|
||||
@JsonKey(name: "packet2_options") final PacketOptions? packet2Options,
|
||||
@JsonKey(name: "packet3_options") final PacketOptions? packet3Options,
|
||||
@JsonKey(name: "author") required final Author author,
|
||||
@JsonKey(name: "total_likes") required final int totalLikes,
|
||||
@JsonKey(name: "total_views") required final int totalViews,
|
||||
@JsonKey(name: "total_comments") required final int totalComments,
|
||||
@JsonKey(name: "is_favorite") required final bool isFavorite}) =
|
||||
_$PlanModelImpl;
|
||||
{@JsonKey(name: "id") required final int id,
|
||||
@JsonKey(name: "slug") required final String slug,
|
||||
@JsonKey(name: "name") required final String name,
|
||||
@JsonKey(name: "image") required final String image,
|
||||
@JsonKey(name: "duration") required final int duration,
|
||||
@JsonKey(name: "state") required final String state,
|
||||
@JsonKey(name: "type") required final PlanType type,
|
||||
@JsonKey(name: "details") required final String details,
|
||||
@JsonKey(name: "packets_count") required final int packetsCount,
|
||||
@JsonKey(name: "packet1_options") final PacketOptions? packet1Options,
|
||||
@JsonKey(name: "packet2_options") final PacketOptions? packet2Options,
|
||||
@JsonKey(name: "packet3_options") final PacketOptions? packet3Options,
|
||||
@JsonKey(name: "author") required final Author author,
|
||||
@JsonKey(name: "total_likes") required final int totalLikes,
|
||||
@JsonKey(name: "total_views") required final int totalViews,
|
||||
@JsonKey(name: "total_comments") required final int totalComments,
|
||||
@JsonKey(name: "is_favorite") required final bool isFavorite,
|
||||
final bool wasLikedByMe}) = _$PlanModelImpl;
|
||||
|
||||
factory _PlanModel.fromJson(Map<String, dynamic> json) =
|
||||
_$PlanModelImpl.fromJson;
|
||||
@@ -875,6 +895,8 @@ abstract class _PlanModel implements PlanModel {
|
||||
@override
|
||||
@JsonKey(name: "is_favorite")
|
||||
bool get isFavorite;
|
||||
@override
|
||||
bool get wasLikedByMe;
|
||||
|
||||
/// Create a copy of PlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -52,6 +52,7 @@ _$PlanModelImpl _$$PlanModelImplFromJson(Map<String, dynamic> json) =>
|
||||
totalViews: (json['total_views'] as num).toInt(),
|
||||
totalComments: (json['total_comments'] as num).toInt(),
|
||||
isFavorite: json['is_favorite'] as bool,
|
||||
wasLikedByMe: json['wasLikedByMe'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$PlanModelImplToJson(_$PlanModelImpl instance) =>
|
||||
@@ -73,6 +74,7 @@ Map<String, dynamic> _$$PlanModelImplToJson(_$PlanModelImpl instance) =>
|
||||
'total_views': instance.totalViews,
|
||||
'total_comments': instance.totalComments,
|
||||
'is_favorite': instance.isFavorite,
|
||||
'wasLikedByMe': instance.wasLikedByMe,
|
||||
};
|
||||
|
||||
_$PacketOptionsImpl _$$PacketOptionsImplFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
Reference in New Issue
Block a user