added plan pagination and updated plans creation screen

This commit is contained in:
Username1548
2024-12-04 22:03:31 +07:00
parent 4a57c72297
commit bc0b3829c9
50 changed files with 1504 additions and 959 deletions

View File

@@ -1,7 +1,3 @@
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';
@@ -17,21 +13,8 @@ class CreateDietModel with _$CreateDietModel {
String? details,
String? state,
int? duration,
required List<bool> type,
required Map<String, bool> type,
XFile? 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 MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image!.path))).path, filename: image!.name) : null,
};
Map<String, dynamic> toDailyScheduleCreationJson() => {
'daily_schedule': dailySchedule?.map((element) => element.map((element) => element.map((element) => element.toJson()).toList()).toList()).toList(),
};
}

View File

@@ -20,7 +20,7 @@ mixin _$CreateDietModel {
String? get details => throw _privateConstructorUsedError;
String? get state => throw _privateConstructorUsedError;
int? get duration => throw _privateConstructorUsedError;
List<bool> get type => throw _privateConstructorUsedError;
Map<String, bool> get type => throw _privateConstructorUsedError;
XFile? get image => throw _privateConstructorUsedError;
List<List<List<DailySchedule>>>? get dailySchedule =>
throw _privateConstructorUsedError;
@@ -43,7 +43,7 @@ abstract class $CreateDietModelCopyWith<$Res> {
String? details,
String? state,
int? duration,
List<bool> type,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
@@ -91,7 +91,7 @@ class _$CreateDietModelCopyWithImpl<$Res, $Val extends CreateDietModel>
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as List<bool>,
as Map<String, bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
@@ -117,7 +117,7 @@ abstract class _$$CreateDietModelImplCopyWith<$Res>
String? details,
String? state,
int? duration,
List<bool> type,
Map<String, bool> type,
XFile? image,
List<List<List<DailySchedule>>>? dailySchedule});
}
@@ -163,7 +163,7 @@ class __$$CreateDietModelImplCopyWithImpl<$Res>
type: null == type
? _value._type
: type // ignore: cast_nullable_to_non_nullable
as List<bool>,
as Map<String, bool>,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
@@ -184,7 +184,7 @@ class _$CreateDietModelImpl extends _CreateDietModel {
this.details,
this.state,
this.duration,
required final List<bool> type,
required final Map<String, bool> type,
this.image,
final List<List<List<DailySchedule>>>? dailySchedule})
: _type = type,
@@ -199,12 +199,12 @@ class _$CreateDietModelImpl extends _CreateDietModel {
final String? state;
@override
final int? duration;
final List<bool> _type;
final Map<String, bool> _type;
@override
List<bool> get type {
if (_type is EqualUnmodifiableListView) return _type;
Map<String, bool> get type {
if (_type is EqualUnmodifiableMapView) return _type;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_type);
return EqualUnmodifiableMapView(_type);
}
@override
@@ -267,7 +267,7 @@ abstract class _CreateDietModel extends CreateDietModel {
final String? details,
final String? state,
final int? duration,
required final List<bool> type,
required final Map<String, bool> type,
final XFile? image,
final List<List<List<DailySchedule>>>? dailySchedule}) =
_$CreateDietModelImpl;
@@ -282,7 +282,7 @@ abstract class _CreateDietModel extends CreateDietModel {
@override
int? get duration;
@override
List<bool> get type;
Map<String, bool> get type;
@override
XFile? get image;
@override