forked from eatvio/eatvio_app
diet creation page
This commit is contained in:
35
lib/features/create_diet/models/create_diet_model.dart
Normal file
35
lib/features/create_diet/models/create_diet_model.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'create_diet_model.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class CreateDietModel with _$CreateDietModel{
|
||||
const CreateDietModel._();
|
||||
|
||||
const factory CreateDietModel({
|
||||
String? name,
|
||||
String? details,
|
||||
String? state,
|
||||
int? duration,
|
||||
List<String>? type,
|
||||
File? image,
|
||||
List<List<List<DailySchedule>>>? dailySchedule,
|
||||
}) = _CreateDietModel;
|
||||
|
||||
Future<Map<String, dynamic>> toCreationJson() async => {
|
||||
'name': name,
|
||||
'duration': duration,
|
||||
'state': state,
|
||||
'type': type,
|
||||
'details': details,
|
||||
'image': image != null ? await ImageCompressUtility.compressFile(image!) : null,
|
||||
};
|
||||
|
||||
Map<String, dynamic> toDailyScheduleCreationJson() => {
|
||||
'daily_schedule': dailySchedule,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user