forked from eatvio/eatvio_app
feat(chats,diary): added logic for chosen diet portions and added banner to finish plan to chats
This commit is contained in:
@@ -30,9 +30,9 @@ class PlanModel with _$PlanModel {
|
||||
@JsonKey(name: "type", fromJson: planTypeFromJson) required PlanType type,
|
||||
@JsonKey(name: "description_md") required String details,
|
||||
@JsonKey(name: "packets_count") required int packetsCount,
|
||||
@JsonKey(name: "packet1_options") PacketOptions? packet1Options,
|
||||
@JsonKey(name: "packet2_options") PacketOptions? packet2Options,
|
||||
@JsonKey(name: "packet3_options") PacketOptions? packet3Options,
|
||||
@JsonKey(name: "packet1_options", fromJson: parseOption) PacketOptions? packet1Options,
|
||||
@JsonKey(name: "packet2_options", fromJson: parseOption) PacketOptions? packet2Options,
|
||||
@JsonKey(name: "packet3_options", fromJson: parseOption) PacketOptions? packet3Options,
|
||||
@JsonKey(name: "author") required Author author,
|
||||
@JsonKey(name: "total_likes") required int totalLikes,
|
||||
@JsonKey(name: "total_views") required int totalViews,
|
||||
@@ -46,6 +46,13 @@ class PlanModel with _$PlanModel {
|
||||
factory PlanModel.fromJson(Map<String, dynamic> json) => _$PlanModelFromJson(json);
|
||||
}
|
||||
|
||||
PacketOptions? parseOption(json) {
|
||||
if (json is Map<String, dynamic>) {
|
||||
return PacketOptions.fromJson(json);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanType planTypeFromJson(dynamic json) {
|
||||
if (json is List<dynamic>) {
|
||||
return const PlanType(fit: false, slim: false, behavior: false, wellness: false);
|
||||
|
||||
Reference in New Issue
Block a user