forked from eatvio/eatvio_app
35 lines
951 B
Dart
35 lines
951 B
Dart
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,
|
|
};
|
|
} |