create diet screen

This commit is contained in:
Username1548
2024-11-25 16:01:02 +07:00
parent c3cb55f8a2
commit c78a90b603
42 changed files with 1742 additions and 918 deletions

View File

@@ -1,7 +1,9 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'create_diet_model.freezed.dart';
@@ -15,8 +17,8 @@ class CreateDietModel with _$CreateDietModel{
String? details,
String? state,
int? duration,
List<String>? type,
File? image,
required List<bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule,
}) = _CreateDietModel;
@@ -26,7 +28,7 @@ class CreateDietModel with _$CreateDietModel{
'state': state,
'type': type,
'details': details,
'image': image != null ? await ImageCompressUtility.compressFile(image!) : null,
'image': image != null ? await MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image!.path))).path, filename: image!.name) : null,
};
Map<String, dynamic> toDailyScheduleCreationJson() => {

View File

@@ -20,8 +20,8 @@ mixin _$CreateDietModel {
String? get details => throw _privateConstructorUsedError;
String? get state => throw _privateConstructorUsedError;
int? get duration => throw _privateConstructorUsedError;
List<String>? get type => throw _privateConstructorUsedError;
File? get image => throw _privateConstructorUsedError;
List<bool> get type => throw _privateConstructorUsedError;
XFile? get image => throw _privateConstructorUsedError;
List<List<List<DailySchedule>>>? get dailySchedule =>
throw _privateConstructorUsedError;
@@ -43,8 +43,8 @@ abstract class $CreateDietModelCopyWith<$Res> {
String? details,
String? state,
int? duration,
List<String>? type,
File? image,
List<bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
@@ -67,7 +67,7 @@ class _$CreateDietModelCopyWithImpl<$Res, $Val extends CreateDietModel>
Object? details = freezed,
Object? state = freezed,
Object? duration = freezed,
Object? type = freezed,
Object? type = null,
Object? image = freezed,
Object? dailySchedule = freezed,
}) {
@@ -88,14 +88,14 @@ class _$CreateDietModelCopyWithImpl<$Res, $Val extends CreateDietModel>
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type: freezed == type
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as List<String>?,
as List<bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
as XFile?,
dailySchedule: freezed == dailySchedule
? _value.dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
@@ -117,8 +117,8 @@ abstract class _$$CreateDietModelImplCopyWith<$Res>
String? details,
String? state,
int? duration,
List<String>? type,
File? image,
List<bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
@@ -139,7 +139,7 @@ class __$$CreateDietModelImplCopyWithImpl<$Res>
Object? details = freezed,
Object? state = freezed,
Object? duration = freezed,
Object? type = freezed,
Object? type = null,
Object? image = freezed,
Object? dailySchedule = freezed,
}) {
@@ -160,14 +160,14 @@ class __$$CreateDietModelImplCopyWithImpl<$Res>
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int?,
type: freezed == type
type: null == type
? _value._type
: type // ignore: cast_nullable_to_non_nullable
as List<String>?,
as List<bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
as XFile?,
dailySchedule: freezed == dailySchedule
? _value._dailySchedule
: dailySchedule // ignore: cast_nullable_to_non_nullable
@@ -184,7 +184,7 @@ class _$CreateDietModelImpl extends _CreateDietModel {
this.details,
this.state,
this.duration,
final List<String>? type,
required final List<bool> type,
this.image,
final List<List<List<DailySchedule>>>? dailySchedule})
: _type = type,
@@ -199,18 +199,16 @@ class _$CreateDietModelImpl extends _CreateDietModel {
final String? state;
@override
final int? duration;
final List<String>? _type;
final List<bool> _type;
@override
List<String>? get type {
final value = _type;
if (value == null) return null;
List<bool> get type {
if (_type is EqualUnmodifiableListView) return _type;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
return EqualUnmodifiableListView(_type);
}
@override
final File? image;
final XFile? image;
final List<List<List<DailySchedule>>>? _dailySchedule;
@override
List<List<List<DailySchedule>>>? get dailySchedule {
@@ -269,8 +267,8 @@ abstract class _CreateDietModel extends CreateDietModel {
final String? details,
final String? state,
final int? duration,
final List<String>? type,
final File? image,
required final List<bool> type,
final XFile? image,
final List<List<List<DailySchedule>>>? dailySchedule}) =
_$CreateDietModelImpl;
const _CreateDietModel._() : super._();
@@ -284,9 +282,9 @@ abstract class _CreateDietModel extends CreateDietModel {
@override
int? get duration;
@override
List<String>? get type;
List<bool> get type;
@override
File? get image;
XFile? get image;
@override
List<List<List<DailySchedule>>>? get dailySchedule;