forked from eatvio/eatvio_app
feat(personal diets): added personal diet option to plans
This commit is contained in:
@@ -67,11 +67,19 @@ abstract class PacketOptions with _$PacketOptions {
|
||||
@JsonKey(name: "price") required dynamic price,
|
||||
@JsonKey(name: "short") required String short,
|
||||
@JsonKey(name: "description_md") required String description,
|
||||
@JsonKey(name: "has_personal_diet", fromJson: _parseHasPersonalDietField) required bool hasPersonalDiet,
|
||||
}) = _PacketOptions;
|
||||
|
||||
factory PacketOptions.fromJson(Map<String, dynamic> json) => _$PacketOptionsFromJson(json);
|
||||
|
||||
factory PacketOptions.empty() => PacketOptions(items: [], price: double.parse('1200'), short: '', description: '');
|
||||
factory PacketOptions.empty() => PacketOptions(items: [], price: double.parse('1200'), short: '', description: '', hasPersonalDiet: false);
|
||||
}
|
||||
|
||||
bool _parseHasPersonalDietField(dynamic json) {
|
||||
if (json == null) return false;
|
||||
if (json == '1') return true;
|
||||
if (json == '0') return false;
|
||||
return json as bool;
|
||||
}
|
||||
|
||||
List<String> _parseItems(dynamic json) {
|
||||
|
||||
Reference in New Issue
Block a user