forked from eatvio/eatvio_app
fix(diary): Remove portion API call fixed
This commit is contained in:
@@ -7,7 +7,7 @@ part 'portion.g.dart';
|
|||||||
class Portion with _$Portion {
|
class Portion with _$Portion {
|
||||||
const factory Portion({
|
const factory Portion({
|
||||||
required int id,
|
required int id,
|
||||||
required String productName,
|
required String product_name,
|
||||||
required int quantity,
|
required int quantity,
|
||||||
required String portion,
|
required String portion,
|
||||||
}) = _Portion;
|
}) = _Portion;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Portion _$PortionFromJson(Map<String, dynamic> json) {
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$Portion {
|
mixin _$Portion {
|
||||||
int get id => throw _privateConstructorUsedError;
|
int get id => throw _privateConstructorUsedError;
|
||||||
String get productName => throw _privateConstructorUsedError;
|
String get product_name => throw _privateConstructorUsedError;
|
||||||
int get quantity => throw _privateConstructorUsedError;
|
int get quantity => throw _privateConstructorUsedError;
|
||||||
String get portion => throw _privateConstructorUsedError;
|
String get portion => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ abstract class $PortionCopyWith<$Res> {
|
|||||||
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) =
|
factory $PortionCopyWith(Portion value, $Res Function(Portion) then) =
|
||||||
_$PortionCopyWithImpl<$Res, Portion>;
|
_$PortionCopyWithImpl<$Res, Portion>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({int id, String productName, int quantity, String portion});
|
$Res call({int id, String product_name, int quantity, String portion});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -52,7 +52,7 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? id = null,
|
Object? id = null,
|
||||||
Object? productName = null,
|
Object? product_name = null,
|
||||||
Object? quantity = null,
|
Object? quantity = null,
|
||||||
Object? portion = null,
|
Object? portion = null,
|
||||||
}) {
|
}) {
|
||||||
@@ -61,9 +61,9 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
|
|||||||
? _value.id
|
? _value.id
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
: id // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int,
|
||||||
productName: null == productName
|
product_name: null == product_name
|
||||||
? _value.productName
|
? _value.product_name
|
||||||
: productName // ignore: cast_nullable_to_non_nullable
|
: product_name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
quantity: null == quantity
|
quantity: null == quantity
|
||||||
? _value.quantity
|
? _value.quantity
|
||||||
@@ -84,7 +84,7 @@ abstract class _$$PortionImplCopyWith<$Res> implements $PortionCopyWith<$Res> {
|
|||||||
__$$PortionImplCopyWithImpl<$Res>;
|
__$$PortionImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({int id, String productName, int quantity, String portion});
|
$Res call({int id, String product_name, int quantity, String portion});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -99,7 +99,7 @@ class __$$PortionImplCopyWithImpl<$Res>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? id = null,
|
Object? id = null,
|
||||||
Object? productName = null,
|
Object? product_name = null,
|
||||||
Object? quantity = null,
|
Object? quantity = null,
|
||||||
Object? portion = null,
|
Object? portion = null,
|
||||||
}) {
|
}) {
|
||||||
@@ -108,9 +108,9 @@ class __$$PortionImplCopyWithImpl<$Res>
|
|||||||
? _value.id
|
? _value.id
|
||||||
: id // ignore: cast_nullable_to_non_nullable
|
: id // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int,
|
||||||
productName: null == productName
|
product_name: null == product_name
|
||||||
? _value.productName
|
? _value.product_name
|
||||||
: productName // ignore: cast_nullable_to_non_nullable
|
: product_name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
quantity: null == quantity
|
quantity: null == quantity
|
||||||
? _value.quantity
|
? _value.quantity
|
||||||
@@ -129,7 +129,7 @@ class __$$PortionImplCopyWithImpl<$Res>
|
|||||||
class _$PortionImpl implements _Portion {
|
class _$PortionImpl implements _Portion {
|
||||||
const _$PortionImpl(
|
const _$PortionImpl(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
required this.productName,
|
required this.product_name,
|
||||||
required this.quantity,
|
required this.quantity,
|
||||||
required this.portion});
|
required this.portion});
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ class _$PortionImpl implements _Portion {
|
|||||||
@override
|
@override
|
||||||
final int id;
|
final int id;
|
||||||
@override
|
@override
|
||||||
final String productName;
|
final String product_name;
|
||||||
@override
|
@override
|
||||||
final int quantity;
|
final int quantity;
|
||||||
@override
|
@override
|
||||||
@@ -147,7 +147,7 @@ class _$PortionImpl implements _Portion {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Portion(id: $id, productName: $productName, quantity: $quantity, portion: $portion)';
|
return 'Portion(id: $id, product_name: $product_name, quantity: $quantity, portion: $portion)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -156,8 +156,8 @@ class _$PortionImpl implements _Portion {
|
|||||||
(other.runtimeType == runtimeType &&
|
(other.runtimeType == runtimeType &&
|
||||||
other is _$PortionImpl &&
|
other is _$PortionImpl &&
|
||||||
(identical(other.id, id) || other.id == id) &&
|
(identical(other.id, id) || other.id == id) &&
|
||||||
(identical(other.productName, productName) ||
|
(identical(other.product_name, product_name) ||
|
||||||
other.productName == productName) &&
|
other.product_name == product_name) &&
|
||||||
(identical(other.quantity, quantity) ||
|
(identical(other.quantity, quantity) ||
|
||||||
other.quantity == quantity) &&
|
other.quantity == quantity) &&
|
||||||
(identical(other.portion, portion) || other.portion == portion));
|
(identical(other.portion, portion) || other.portion == portion));
|
||||||
@@ -166,7 +166,7 @@ class _$PortionImpl implements _Portion {
|
|||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
Object.hash(runtimeType, id, productName, quantity, portion);
|
Object.hash(runtimeType, id, product_name, quantity, portion);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@@ -185,7 +185,7 @@ class _$PortionImpl implements _Portion {
|
|||||||
abstract class _Portion implements Portion {
|
abstract class _Portion implements Portion {
|
||||||
const factory _Portion(
|
const factory _Portion(
|
||||||
{required final int id,
|
{required final int id,
|
||||||
required final String productName,
|
required final String product_name,
|
||||||
required final int quantity,
|
required final int quantity,
|
||||||
required final String portion}) = _$PortionImpl;
|
required final String portion}) = _$PortionImpl;
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ abstract class _Portion implements Portion {
|
|||||||
@override
|
@override
|
||||||
int get id;
|
int get id;
|
||||||
@override
|
@override
|
||||||
String get productName;
|
String get product_name;
|
||||||
@override
|
@override
|
||||||
int get quantity;
|
int get quantity;
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ part of 'portion.dart';
|
|||||||
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
|
_$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$PortionImpl(
|
_$PortionImpl(
|
||||||
id: (json['id'] as num).toInt(),
|
id: (json['id'] as num).toInt(),
|
||||||
productName: json['productName'] as String,
|
product_name: json['product_name'] as String,
|
||||||
quantity: (json['quantity'] as num).toInt(),
|
quantity: (json['quantity'] as num).toInt(),
|
||||||
portion: json['portion'] as String,
|
portion: json['portion'] as String,
|
||||||
);
|
);
|
||||||
@@ -17,7 +17,7 @@ _$PortionImpl _$$PortionImplFromJson(Map<String, dynamic> json) =>
|
|||||||
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) =>
|
Map<String, dynamic> _$$PortionImplToJson(_$PortionImpl instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'productName': instance.productName,
|
'product_name': instance.product_name,
|
||||||
'quantity': instance.quantity,
|
'quantity': instance.quantity,
|
||||||
'portion': instance.portion,
|
'portion': instance.portion,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/meal.dart';
|
import 'package:eatvio_app/features/diary/models/meal.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/models/portion.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/product.dart';
|
import 'package:eatvio_app/features/diary/models/product.dart';
|
||||||
import 'package:eatvio_app/features/diary/repositories/diary_repository.dart';
|
import 'package:eatvio_app/features/diary/repositories/diary_repository.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@@ -82,7 +83,7 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
|||||||
selectedMood: currentMeal.mood,
|
selectedMood: currentMeal.mood,
|
||||||
selectedSatiety: currentMeal.satiety,
|
selectedSatiety: currentMeal.satiety,
|
||||||
commentController: TextEditingController(),
|
commentController: TextEditingController(),
|
||||||
productNameController: TextEditingController(),
|
product_nameController: TextEditingController(),
|
||||||
productQuantityController: TextEditingController(),
|
productQuantityController: TextEditingController(),
|
||||||
caloriesController: TextEditingController(),
|
caloriesController: TextEditingController(),
|
||||||
fatsController: TextEditingController(),
|
fatsController: TextEditingController(),
|
||||||
@@ -259,15 +260,14 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
|||||||
Emitter<DiaryState> emit,
|
Emitter<DiaryState> emit,
|
||||||
) async {
|
) async {
|
||||||
if (state is DiaryStateLoaded) {
|
if (state is DiaryStateLoaded) {
|
||||||
//var currentState = state as DiaryStateLoaded;
|
var currentState = state as DiaryStateLoaded;
|
||||||
|
|
||||||
print(await diaryRepository.inputProduct(event.input));
|
|
||||||
final Map<String, List<Product>> productNutritionalValues =
|
final Map<String, List<Product>> productNutritionalValues =
|
||||||
await diaryRepository.inputProduct(event.input);
|
await diaryRepository.inputProduct(event.input);
|
||||||
// Create a new controller with the input text and update the autocomplete list
|
var updatedState = currentState.copyWith(
|
||||||
/*var updatedState = currentState.copyWith(
|
product_nameController: TextEditingController(text: event.input),
|
||||||
productNameController: TextEditingController(text: event.input),
|
autocompleteList:
|
||||||
autocompleteList: productNutritionalValues.map((product) => product['name']).toList(),
|
productNutritionalValues['product_nutritional_value'] ?? [],
|
||||||
);
|
);
|
||||||
if (event.input.length > 3) {
|
if (event.input.length > 3) {
|
||||||
updatedState = updatedState.copyWith(moderationExpanded: true);
|
updatedState = updatedState.copyWith(moderationExpanded: true);
|
||||||
@@ -275,7 +275,7 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
|||||||
updatedState = updatedState.copyWith(moderationExpanded: false);
|
updatedState = updatedState.copyWith(moderationExpanded: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(updatedState); */
|
emit(updatedState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,16 +331,25 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
|||||||
) async {
|
) async {
|
||||||
if (state is DiaryStateLoaded) {
|
if (state is DiaryStateLoaded) {
|
||||||
var currentState = state as DiaryStateLoaded;
|
var currentState = state as DiaryStateLoaded;
|
||||||
|
print(currentState.diary.id);
|
||||||
|
print(currentState.currentMeal.id);
|
||||||
|
print(currentState.product_nameController.text);
|
||||||
|
print(currentState.portionController.title);
|
||||||
|
print(currentState.productQuantityController.text);
|
||||||
|
|
||||||
await diaryRepository.addPortion(
|
Map<String, Portion> data = await diaryRepository.addPortion(
|
||||||
currentState.diary.id,
|
currentState.diary.id,
|
||||||
currentState.currentMeal.id,
|
currentState.currentMeal.id,
|
||||||
currentState.productNameController.text,
|
currentState.product_nameController.text,
|
||||||
currentState.portionController.value,
|
currentState.portionController.title,
|
||||||
int.parse(currentState.productQuantityController.text),
|
int.parse(currentState.productQuantityController.text),
|
||||||
);
|
);
|
||||||
|
List<Portion> newPortions = currentState.portions;
|
||||||
|
|
||||||
emit(currentState.copyWith(isAdded: true));
|
final Portion newPortion = data['portion'] ??
|
||||||
|
new Portion(id: 1, portion: 'gr', product_name: '1', quantity: 1);
|
||||||
|
newPortions.add(newPortion);
|
||||||
|
emit(currentState.copyWith(isAdded: true, portions: newPortions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,45 +359,14 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
|||||||
) async {
|
) async {
|
||||||
if (state is DiaryStateLoaded) {
|
if (state is DiaryStateLoaded) {
|
||||||
var currentState = state as DiaryStateLoaded;
|
var currentState = state as DiaryStateLoaded;
|
||||||
|
await diaryRepository.removePortion(
|
||||||
int? mealId =
|
|
||||||
currentState.currentMeal.id; // Rename id to mealId for clarity
|
|
||||||
|
|
||||||
var response = await sendRemovePortion(
|
|
||||||
event.portionId,
|
|
||||||
mealId,
|
|
||||||
currentState.diary.id,
|
currentState.diary.id,
|
||||||
|
currentState.currentMeal.id,
|
||||||
|
event.portionId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 204) {
|
|
||||||
await reloadScreen(event, emit);
|
|
||||||
} else {
|
|
||||||
print(
|
|
||||||
'Failed to add portion. Status Code: ${response.statusCode} ${response.body}',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<http.Response> sendRemovePortion(
|
|
||||||
int? portionID,
|
|
||||||
int? mealID,
|
|
||||||
int diaryID,
|
|
||||||
) async {
|
|
||||||
String url =
|
|
||||||
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/portions/$portionID/delete';
|
|
||||||
|
|
||||||
var response = await http.delete(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
encoding: utf8,
|
|
||||||
);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
FutureOr<void> _removeImage(
|
FutureOr<void> _removeImage(
|
||||||
RemoveImageEvent event,
|
RemoveImageEvent event,
|
||||||
Emitter<DiaryState> emit,
|
Emitter<DiaryState> emit,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
|||||||
import 'package:eatvio_app/features/diary/models/meal.dart';
|
import 'package:eatvio_app/features/diary/models/meal.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/photo.dart';
|
import 'package:eatvio_app/features/diary/models/photo.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/portion.dart';
|
import 'package:eatvio_app/features/diary/models/portion.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/models/product.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
@@ -18,20 +19,20 @@ abstract class DiaryState with _$DiaryState {
|
|||||||
const factory DiaryState.loaded({
|
const factory DiaryState.loaded({
|
||||||
required DiaryModel diary,
|
required DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
required List<dynamic> autocompleteList,
|
|
||||||
required List<int> recommendedChartValues,
|
required List<int> recommendedChartValues,
|
||||||
required List<int> consumedChartValues,
|
required List<int> consumedChartValues,
|
||||||
required List<Portion> portions,
|
required List<Portion> portions,
|
||||||
required List<Photo> photos,
|
required List<Photo> photos,
|
||||||
required List<SelectionPopupModel> mealList,
|
required List<SelectionPopupModel> mealList,
|
||||||
required List<SelectionPopupModel> portionList,
|
required List<SelectionPopupModel> portionList,
|
||||||
|
required List<Product> autocompleteList,
|
||||||
required Meal currentMeal,
|
required Meal currentMeal,
|
||||||
required SelectionPopupModel portionController,
|
required SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
required TextEditingController commentController,
|
required TextEditingController commentController,
|
||||||
required TextEditingController productNameController,
|
required TextEditingController product_nameController,
|
||||||
required TextEditingController productQuantityController,
|
required TextEditingController productQuantityController,
|
||||||
required TextEditingController caloriesController,
|
required TextEditingController caloriesController,
|
||||||
required TextEditingController fatsController,
|
required TextEditingController fatsController,
|
||||||
|
|||||||
@@ -23,20 +23,20 @@ mixin _$DiaryState {
|
|||||||
required TResult Function(
|
required TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -60,20 +60,20 @@ mixin _$DiaryState {
|
|||||||
TResult? Function(
|
TResult? Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -97,20 +97,20 @@ mixin _$DiaryState {
|
|||||||
TResult Function(
|
TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -216,20 +216,20 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
required TResult Function(
|
required TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -256,20 +256,20 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
TResult? Function(
|
TResult? Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -296,20 +296,20 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
TResult Function(
|
TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -417,20 +417,20 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
required TResult Function(
|
required TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -457,20 +457,20 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
TResult? Function(
|
TResult? Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -497,20 +497,20 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
TResult Function(
|
TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -584,20 +584,20 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
|
|||||||
$Res call(
|
$Res call(
|
||||||
{DiaryModel diary,
|
{DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -628,20 +628,20 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? diary = null,
|
Object? diary = null,
|
||||||
Object? diaryDate = freezed,
|
Object? diaryDate = freezed,
|
||||||
Object? autocompleteList = null,
|
|
||||||
Object? recommendedChartValues = null,
|
Object? recommendedChartValues = null,
|
||||||
Object? consumedChartValues = null,
|
Object? consumedChartValues = null,
|
||||||
Object? portions = null,
|
Object? portions = null,
|
||||||
Object? photos = null,
|
Object? photos = null,
|
||||||
Object? mealList = null,
|
Object? mealList = null,
|
||||||
Object? portionList = null,
|
Object? portionList = null,
|
||||||
|
Object? autocompleteList = null,
|
||||||
Object? currentMeal = null,
|
Object? currentMeal = null,
|
||||||
Object? portionController = null,
|
Object? portionController = null,
|
||||||
Object? wakeupController = freezed,
|
Object? wakeupController = freezed,
|
||||||
Object? retireController = freezed,
|
Object? retireController = freezed,
|
||||||
Object? mealTimeController = freezed,
|
Object? mealTimeController = freezed,
|
||||||
Object? commentController = null,
|
Object? commentController = null,
|
||||||
Object? productNameController = null,
|
Object? product_nameController = null,
|
||||||
Object? productQuantityController = null,
|
Object? productQuantityController = null,
|
||||||
Object? caloriesController = null,
|
Object? caloriesController = null,
|
||||||
Object? fatsController = null,
|
Object? fatsController = null,
|
||||||
@@ -664,10 +664,6 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
|||||||
? _value.diaryDate
|
? _value.diaryDate
|
||||||
: diaryDate // ignore: cast_nullable_to_non_nullable
|
: diaryDate // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
autocompleteList: null == autocompleteList
|
|
||||||
? _value._autocompleteList
|
|
||||||
: autocompleteList // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<dynamic>,
|
|
||||||
recommendedChartValues: null == recommendedChartValues
|
recommendedChartValues: null == recommendedChartValues
|
||||||
? _value._recommendedChartValues
|
? _value._recommendedChartValues
|
||||||
: recommendedChartValues // ignore: cast_nullable_to_non_nullable
|
: recommendedChartValues // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -692,6 +688,10 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
|||||||
? _value._portionList
|
? _value._portionList
|
||||||
: portionList // ignore: cast_nullable_to_non_nullable
|
: portionList // ignore: cast_nullable_to_non_nullable
|
||||||
as List<SelectionPopupModel>,
|
as List<SelectionPopupModel>,
|
||||||
|
autocompleteList: null == autocompleteList
|
||||||
|
? _value._autocompleteList
|
||||||
|
: autocompleteList // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<Product>,
|
||||||
currentMeal: null == currentMeal
|
currentMeal: null == currentMeal
|
||||||
? _value.currentMeal
|
? _value.currentMeal
|
||||||
: currentMeal // ignore: cast_nullable_to_non_nullable
|
: currentMeal // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -716,9 +716,9 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
|||||||
? _value.commentController
|
? _value.commentController
|
||||||
: commentController // ignore: cast_nullable_to_non_nullable
|
: commentController // ignore: cast_nullable_to_non_nullable
|
||||||
as TextEditingController,
|
as TextEditingController,
|
||||||
productNameController: null == productNameController
|
product_nameController: null == product_nameController
|
||||||
? _value.productNameController
|
? _value.product_nameController
|
||||||
: productNameController // ignore: cast_nullable_to_non_nullable
|
: product_nameController // ignore: cast_nullable_to_non_nullable
|
||||||
as TextEditingController,
|
as TextEditingController,
|
||||||
productQuantityController: null == productQuantityController
|
productQuantityController: null == productQuantityController
|
||||||
? _value.productQuantityController
|
? _value.productQuantityController
|
||||||
@@ -794,20 +794,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
const _$DiaryStateLoadedImpl(
|
const _$DiaryStateLoadedImpl(
|
||||||
{required this.diary,
|
{required this.diary,
|
||||||
this.diaryDate,
|
this.diaryDate,
|
||||||
required final List<dynamic> autocompleteList,
|
|
||||||
required final List<int> recommendedChartValues,
|
required final List<int> recommendedChartValues,
|
||||||
required final List<int> consumedChartValues,
|
required final List<int> consumedChartValues,
|
||||||
required final List<Portion> portions,
|
required final List<Portion> portions,
|
||||||
required final List<Photo> photos,
|
required final List<Photo> photos,
|
||||||
required final List<SelectionPopupModel> mealList,
|
required final List<SelectionPopupModel> mealList,
|
||||||
required final List<SelectionPopupModel> portionList,
|
required final List<SelectionPopupModel> portionList,
|
||||||
|
required final List<Product> autocompleteList,
|
||||||
required this.currentMeal,
|
required this.currentMeal,
|
||||||
required this.portionController,
|
required this.portionController,
|
||||||
this.wakeupController,
|
this.wakeupController,
|
||||||
this.retireController,
|
this.retireController,
|
||||||
this.mealTimeController,
|
this.mealTimeController,
|
||||||
required this.commentController,
|
required this.commentController,
|
||||||
required this.productNameController,
|
required this.product_nameController,
|
||||||
required this.productQuantityController,
|
required this.productQuantityController,
|
||||||
required this.caloriesController,
|
required this.caloriesController,
|
||||||
required this.fatsController,
|
required this.fatsController,
|
||||||
@@ -820,27 +820,18 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
required this.moodExpanded,
|
required this.moodExpanded,
|
||||||
required this.isLoading,
|
required this.isLoading,
|
||||||
required this.isAdded})
|
required this.isAdded})
|
||||||
: _autocompleteList = autocompleteList,
|
: _recommendedChartValues = recommendedChartValues,
|
||||||
_recommendedChartValues = recommendedChartValues,
|
|
||||||
_consumedChartValues = consumedChartValues,
|
_consumedChartValues = consumedChartValues,
|
||||||
_portions = portions,
|
_portions = portions,
|
||||||
_photos = photos,
|
_photos = photos,
|
||||||
_mealList = mealList,
|
_mealList = mealList,
|
||||||
_portionList = portionList;
|
_portionList = portionList,
|
||||||
|
_autocompleteList = autocompleteList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final DiaryModel diary;
|
final DiaryModel diary;
|
||||||
@override
|
@override
|
||||||
final String? diaryDate;
|
final String? diaryDate;
|
||||||
final List<dynamic> _autocompleteList;
|
|
||||||
@override
|
|
||||||
List<dynamic> get autocompleteList {
|
|
||||||
if (_autocompleteList is EqualUnmodifiableListView)
|
|
||||||
return _autocompleteList;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableListView(_autocompleteList);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<int> _recommendedChartValues;
|
final List<int> _recommendedChartValues;
|
||||||
@override
|
@override
|
||||||
List<int> get recommendedChartValues {
|
List<int> get recommendedChartValues {
|
||||||
@@ -891,6 +882,15 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
return EqualUnmodifiableListView(_portionList);
|
return EqualUnmodifiableListView(_portionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Product> _autocompleteList;
|
||||||
|
@override
|
||||||
|
List<Product> get autocompleteList {
|
||||||
|
if (_autocompleteList is EqualUnmodifiableListView)
|
||||||
|
return _autocompleteList;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_autocompleteList);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Meal currentMeal;
|
final Meal currentMeal;
|
||||||
@override
|
@override
|
||||||
@@ -904,7 +904,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
@override
|
@override
|
||||||
final TextEditingController commentController;
|
final TextEditingController commentController;
|
||||||
@override
|
@override
|
||||||
final TextEditingController productNameController;
|
final TextEditingController product_nameController;
|
||||||
@override
|
@override
|
||||||
final TextEditingController productQuantityController;
|
final TextEditingController productQuantityController;
|
||||||
@override
|
@override
|
||||||
@@ -932,7 +932,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'DiaryState.loaded(diary: $diary, diaryDate: $diaryDate, autocompleteList: $autocompleteList, recommendedChartValues: $recommendedChartValues, consumedChartValues: $consumedChartValues, portions: $portions, photos: $photos, mealList: $mealList, portionList: $portionList, currentMeal: $currentMeal, portionController: $portionController, wakeupController: $wakeupController, retireController: $retireController, mealTimeController: $mealTimeController, commentController: $commentController, productNameController: $productNameController, productQuantityController: $productQuantityController, caloriesController: $caloriesController, fatsController: $fatsController, proteinsController: $proteinsController, carbsController: $carbsController, selectedMood: $selectedMood, selectedSatiety: $selectedSatiety, wakeupExpanded: $wakeupExpanded, moderationExpanded: $moderationExpanded, moodExpanded: $moodExpanded, isLoading: $isLoading, isAdded: $isAdded)';
|
return 'DiaryState.loaded(diary: $diary, diaryDate: $diaryDate, recommendedChartValues: $recommendedChartValues, consumedChartValues: $consumedChartValues, portions: $portions, photos: $photos, mealList: $mealList, portionList: $portionList, autocompleteList: $autocompleteList, currentMeal: $currentMeal, portionController: $portionController, wakeupController: $wakeupController, retireController: $retireController, mealTimeController: $mealTimeController, commentController: $commentController, product_nameController: $product_nameController, productQuantityController: $productQuantityController, caloriesController: $caloriesController, fatsController: $fatsController, proteinsController: $proteinsController, carbsController: $carbsController, selectedMood: $selectedMood, selectedSatiety: $selectedSatiety, wakeupExpanded: $wakeupExpanded, moderationExpanded: $moderationExpanded, moodExpanded: $moodExpanded, isLoading: $isLoading, isAdded: $isAdded)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -943,8 +943,6 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
(identical(other.diary, diary) || other.diary == diary) &&
|
(identical(other.diary, diary) || other.diary == diary) &&
|
||||||
(identical(other.diaryDate, diaryDate) ||
|
(identical(other.diaryDate, diaryDate) ||
|
||||||
other.diaryDate == diaryDate) &&
|
other.diaryDate == diaryDate) &&
|
||||||
const DeepCollectionEquality()
|
|
||||||
.equals(other._autocompleteList, _autocompleteList) &&
|
|
||||||
const DeepCollectionEquality().equals(
|
const DeepCollectionEquality().equals(
|
||||||
other._recommendedChartValues, _recommendedChartValues) &&
|
other._recommendedChartValues, _recommendedChartValues) &&
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
@@ -954,6 +952,8 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
const DeepCollectionEquality().equals(other._mealList, _mealList) &&
|
const DeepCollectionEquality().equals(other._mealList, _mealList) &&
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other._portionList, _portionList) &&
|
.equals(other._portionList, _portionList) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._autocompleteList, _autocompleteList) &&
|
||||||
(identical(other.currentMeal, currentMeal) ||
|
(identical(other.currentMeal, currentMeal) ||
|
||||||
other.currentMeal == currentMeal) &&
|
other.currentMeal == currentMeal) &&
|
||||||
(identical(other.portionController, portionController) ||
|
(identical(other.portionController, portionController) ||
|
||||||
@@ -966,8 +966,8 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
other.mealTimeController == mealTimeController) &&
|
other.mealTimeController == mealTimeController) &&
|
||||||
(identical(other.commentController, commentController) ||
|
(identical(other.commentController, commentController) ||
|
||||||
other.commentController == commentController) &&
|
other.commentController == commentController) &&
|
||||||
(identical(other.productNameController, productNameController) ||
|
(identical(other.product_nameController, product_nameController) ||
|
||||||
other.productNameController == productNameController) &&
|
other.product_nameController == product_nameController) &&
|
||||||
(identical(other.productQuantityController,
|
(identical(other.productQuantityController,
|
||||||
productQuantityController) ||
|
productQuantityController) ||
|
||||||
other.productQuantityController == productQuantityController) &&
|
other.productQuantityController == productQuantityController) &&
|
||||||
@@ -999,20 +999,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
runtimeType,
|
runtimeType,
|
||||||
diary,
|
diary,
|
||||||
diaryDate,
|
diaryDate,
|
||||||
const DeepCollectionEquality().hash(_autocompleteList),
|
|
||||||
const DeepCollectionEquality().hash(_recommendedChartValues),
|
const DeepCollectionEquality().hash(_recommendedChartValues),
|
||||||
const DeepCollectionEquality().hash(_consumedChartValues),
|
const DeepCollectionEquality().hash(_consumedChartValues),
|
||||||
const DeepCollectionEquality().hash(_portions),
|
const DeepCollectionEquality().hash(_portions),
|
||||||
const DeepCollectionEquality().hash(_photos),
|
const DeepCollectionEquality().hash(_photos),
|
||||||
const DeepCollectionEquality().hash(_mealList),
|
const DeepCollectionEquality().hash(_mealList),
|
||||||
const DeepCollectionEquality().hash(_portionList),
|
const DeepCollectionEquality().hash(_portionList),
|
||||||
|
const DeepCollectionEquality().hash(_autocompleteList),
|
||||||
currentMeal,
|
currentMeal,
|
||||||
portionController,
|
portionController,
|
||||||
wakeupController,
|
wakeupController,
|
||||||
retireController,
|
retireController,
|
||||||
mealTimeController,
|
mealTimeController,
|
||||||
commentController,
|
commentController,
|
||||||
productNameController,
|
product_nameController,
|
||||||
productQuantityController,
|
productQuantityController,
|
||||||
caloriesController,
|
caloriesController,
|
||||||
fatsController,
|
fatsController,
|
||||||
@@ -1042,20 +1042,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
required TResult Function(
|
required TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -1074,20 +1074,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
return loaded(
|
return loaded(
|
||||||
diary,
|
diary,
|
||||||
diaryDate,
|
diaryDate,
|
||||||
autocompleteList,
|
|
||||||
recommendedChartValues,
|
recommendedChartValues,
|
||||||
consumedChartValues,
|
consumedChartValues,
|
||||||
portions,
|
portions,
|
||||||
photos,
|
photos,
|
||||||
mealList,
|
mealList,
|
||||||
portionList,
|
portionList,
|
||||||
|
autocompleteList,
|
||||||
currentMeal,
|
currentMeal,
|
||||||
portionController,
|
portionController,
|
||||||
wakeupController,
|
wakeupController,
|
||||||
retireController,
|
retireController,
|
||||||
mealTimeController,
|
mealTimeController,
|
||||||
commentController,
|
commentController,
|
||||||
productNameController,
|
product_nameController,
|
||||||
productQuantityController,
|
productQuantityController,
|
||||||
caloriesController,
|
caloriesController,
|
||||||
fatsController,
|
fatsController,
|
||||||
@@ -1110,20 +1110,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
TResult? Function(
|
TResult? Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -1142,20 +1142,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
return loaded?.call(
|
return loaded?.call(
|
||||||
diary,
|
diary,
|
||||||
diaryDate,
|
diaryDate,
|
||||||
autocompleteList,
|
|
||||||
recommendedChartValues,
|
recommendedChartValues,
|
||||||
consumedChartValues,
|
consumedChartValues,
|
||||||
portions,
|
portions,
|
||||||
photos,
|
photos,
|
||||||
mealList,
|
mealList,
|
||||||
portionList,
|
portionList,
|
||||||
|
autocompleteList,
|
||||||
currentMeal,
|
currentMeal,
|
||||||
portionController,
|
portionController,
|
||||||
wakeupController,
|
wakeupController,
|
||||||
retireController,
|
retireController,
|
||||||
mealTimeController,
|
mealTimeController,
|
||||||
commentController,
|
commentController,
|
||||||
productNameController,
|
product_nameController,
|
||||||
productQuantityController,
|
productQuantityController,
|
||||||
caloriesController,
|
caloriesController,
|
||||||
fatsController,
|
fatsController,
|
||||||
@@ -1178,20 +1178,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
TResult Function(
|
TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -1212,20 +1212,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
return loaded(
|
return loaded(
|
||||||
diary,
|
diary,
|
||||||
diaryDate,
|
diaryDate,
|
||||||
autocompleteList,
|
|
||||||
recommendedChartValues,
|
recommendedChartValues,
|
||||||
consumedChartValues,
|
consumedChartValues,
|
||||||
portions,
|
portions,
|
||||||
photos,
|
photos,
|
||||||
mealList,
|
mealList,
|
||||||
portionList,
|
portionList,
|
||||||
|
autocompleteList,
|
||||||
currentMeal,
|
currentMeal,
|
||||||
portionController,
|
portionController,
|
||||||
wakeupController,
|
wakeupController,
|
||||||
retireController,
|
retireController,
|
||||||
mealTimeController,
|
mealTimeController,
|
||||||
commentController,
|
commentController,
|
||||||
productNameController,
|
product_nameController,
|
||||||
productQuantityController,
|
productQuantityController,
|
||||||
caloriesController,
|
caloriesController,
|
||||||
fatsController,
|
fatsController,
|
||||||
@@ -1284,20 +1284,20 @@ abstract class DiaryStateLoaded implements DiaryState {
|
|||||||
const factory DiaryStateLoaded(
|
const factory DiaryStateLoaded(
|
||||||
{required final DiaryModel diary,
|
{required final DiaryModel diary,
|
||||||
final String? diaryDate,
|
final String? diaryDate,
|
||||||
required final List<dynamic> autocompleteList,
|
|
||||||
required final List<int> recommendedChartValues,
|
required final List<int> recommendedChartValues,
|
||||||
required final List<int> consumedChartValues,
|
required final List<int> consumedChartValues,
|
||||||
required final List<Portion> portions,
|
required final List<Portion> portions,
|
||||||
required final List<Photo> photos,
|
required final List<Photo> photos,
|
||||||
required final List<SelectionPopupModel> mealList,
|
required final List<SelectionPopupModel> mealList,
|
||||||
required final List<SelectionPopupModel> portionList,
|
required final List<SelectionPopupModel> portionList,
|
||||||
|
required final List<Product> autocompleteList,
|
||||||
required final Meal currentMeal,
|
required final Meal currentMeal,
|
||||||
required final SelectionPopupModel portionController,
|
required final SelectionPopupModel portionController,
|
||||||
final TimeOfDay? wakeupController,
|
final TimeOfDay? wakeupController,
|
||||||
final TimeOfDay? retireController,
|
final TimeOfDay? retireController,
|
||||||
final TimeOfDay? mealTimeController,
|
final TimeOfDay? mealTimeController,
|
||||||
required final TextEditingController commentController,
|
required final TextEditingController commentController,
|
||||||
required final TextEditingController productNameController,
|
required final TextEditingController product_nameController,
|
||||||
required final TextEditingController productQuantityController,
|
required final TextEditingController productQuantityController,
|
||||||
required final TextEditingController caloriesController,
|
required final TextEditingController caloriesController,
|
||||||
required final TextEditingController fatsController,
|
required final TextEditingController fatsController,
|
||||||
@@ -1313,20 +1313,20 @@ abstract class DiaryStateLoaded implements DiaryState {
|
|||||||
|
|
||||||
DiaryModel get diary;
|
DiaryModel get diary;
|
||||||
String? get diaryDate;
|
String? get diaryDate;
|
||||||
List<dynamic> get autocompleteList;
|
|
||||||
List<int> get recommendedChartValues;
|
List<int> get recommendedChartValues;
|
||||||
List<int> get consumedChartValues;
|
List<int> get consumedChartValues;
|
||||||
List<Portion> get portions;
|
List<Portion> get portions;
|
||||||
List<Photo> get photos;
|
List<Photo> get photos;
|
||||||
List<SelectionPopupModel> get mealList;
|
List<SelectionPopupModel> get mealList;
|
||||||
List<SelectionPopupModel> get portionList;
|
List<SelectionPopupModel> get portionList;
|
||||||
|
List<Product> get autocompleteList;
|
||||||
Meal get currentMeal;
|
Meal get currentMeal;
|
||||||
SelectionPopupModel get portionController;
|
SelectionPopupModel get portionController;
|
||||||
TimeOfDay? get wakeupController;
|
TimeOfDay? get wakeupController;
|
||||||
TimeOfDay? get retireController;
|
TimeOfDay? get retireController;
|
||||||
TimeOfDay? get mealTimeController;
|
TimeOfDay? get mealTimeController;
|
||||||
TextEditingController get commentController;
|
TextEditingController get commentController;
|
||||||
TextEditingController get productNameController;
|
TextEditingController get product_nameController;
|
||||||
TextEditingController get productQuantityController;
|
TextEditingController get productQuantityController;
|
||||||
TextEditingController get caloriesController;
|
TextEditingController get caloriesController;
|
||||||
TextEditingController get fatsController;
|
TextEditingController get fatsController;
|
||||||
@@ -1415,20 +1415,20 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
required TResult Function(
|
required TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -1455,20 +1455,20 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
TResult? Function(
|
TResult? Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
@@ -1495,20 +1495,20 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
TResult Function(
|
TResult Function(
|
||||||
DiaryModel diary,
|
DiaryModel diary,
|
||||||
String? diaryDate,
|
String? diaryDate,
|
||||||
List<dynamic> autocompleteList,
|
|
||||||
List<int> recommendedChartValues,
|
List<int> recommendedChartValues,
|
||||||
List<int> consumedChartValues,
|
List<int> consumedChartValues,
|
||||||
List<Portion> portions,
|
List<Portion> portions,
|
||||||
List<Photo> photos,
|
List<Photo> photos,
|
||||||
List<SelectionPopupModel> mealList,
|
List<SelectionPopupModel> mealList,
|
||||||
List<SelectionPopupModel> portionList,
|
List<SelectionPopupModel> portionList,
|
||||||
|
List<Product> autocompleteList,
|
||||||
Meal currentMeal,
|
Meal currentMeal,
|
||||||
SelectionPopupModel portionController,
|
SelectionPopupModel portionController,
|
||||||
TimeOfDay? wakeupController,
|
TimeOfDay? wakeupController,
|
||||||
TimeOfDay? retireController,
|
TimeOfDay? retireController,
|
||||||
TimeOfDay? mealTimeController,
|
TimeOfDay? mealTimeController,
|
||||||
TextEditingController commentController,
|
TextEditingController commentController,
|
||||||
TextEditingController productNameController,
|
TextEditingController product_nameController,
|
||||||
TextEditingController productQuantityController,
|
TextEditingController productQuantityController,
|
||||||
TextEditingController caloriesController,
|
TextEditingController caloriesController,
|
||||||
TextEditingController fatsController,
|
TextEditingController fatsController,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
|||||||
import 'package:eatvio_app/features/diary/models/meal.dart';
|
import 'package:eatvio_app/features/diary/models/meal.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/photo.dart';
|
import 'package:eatvio_app/features/diary/models/photo.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/portion.dart';
|
import 'package:eatvio_app/features/diary/models/portion.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/models/product.dart';
|
||||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
|
||||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -247,7 +248,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
borderRadius: BorderRadiusStyle.roundedBorder5,
|
borderRadius: BorderRadiusStyle.roundedBorder5,
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator(color: appTheme.blueGray300), // Замените на свой прелоадер при необходимости
|
child: CircularProgressIndicator(
|
||||||
|
color: appTheme
|
||||||
|
.blueGray300), // Замените на свой прелоадер при необходимости
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -271,7 +274,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
|
|
||||||
_buildMeal(BuildContext context, DiaryStateLoaded state) {
|
_buildMeal(BuildContext context, DiaryStateLoaded state) {
|
||||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||||
List<String> _options = state.autocompleteList.map((dynamic item) => item as String).toList();
|
List<String> _options =
|
||||||
|
state.autocompleteList.map((Product item) => item.name).toList();
|
||||||
FocusNode focusNodeName = FocusNode();
|
FocusNode focusNodeName = FocusNode();
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16.h),
|
margin: EdgeInsets.symmetric(horizontal: 16.h),
|
||||||
@@ -315,7 +319,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
onTap: () => _selectMealTime(context, state),
|
onTap: () => _selectMealTime(context, state),
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: CustomTextFormField(
|
child: CustomTextFormField(
|
||||||
hintText: state.mealTimeController?.format(context).toString(),
|
hintText: state.mealTimeController
|
||||||
|
?.format(context)
|
||||||
|
.toString(),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -451,7 +457,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
SizedBox(height: 30.v),
|
SizedBox(height: 30.v),
|
||||||
_buildAddProduct(context, state),
|
_buildAddProduct(context, state),
|
||||||
SizedBox(height: 30.v),
|
SizedBox(height: 30.v),
|
||||||
...state.portions.map((portion) => _buildProduct(context, portion)).toList(),
|
...state.portions
|
||||||
|
.map((portion) => _buildProduct(context, portion))
|
||||||
|
.toList(),
|
||||||
SizedBox(height: 30.v),
|
SizedBox(height: 30.v),
|
||||||
/*...state.photos != null
|
/*...state.photos != null
|
||||||
? state.photos!.isEmpty
|
? state.photos!.isEmpty
|
||||||
@@ -531,7 +539,7 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
hintText: "Название",
|
hintText: "Название",
|
||||||
controller: state.productNameController,
|
controller: state.product_nameController,
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.v),
|
SizedBox(height: 10.v),
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
@@ -567,7 +575,7 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: triggerModeration(
|
onPressed: triggerModeration(
|
||||||
context,
|
context,
|
||||||
state.productNameController.text,
|
state.product_nameController.text,
|
||||||
state.caloriesController.text,
|
state.caloriesController.text,
|
||||||
state.proteinsController.text,
|
state.proteinsController.text,
|
||||||
state.fatsController.text,
|
state.fatsController.text,
|
||||||
@@ -608,7 +616,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
|
|
||||||
popDialog(BuildContext dialogContext) {
|
popDialog(BuildContext dialogContext) {
|
||||||
return () {
|
return () {
|
||||||
Navigator.of(dialogContext).pop(); // Dismiss the dialog on Cancel button press
|
Navigator.of(dialogContext)
|
||||||
|
.pop(); // Dismiss the dialog on Cancel button press
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +627,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
selectProduct(AutocompleteOnSelected<String> onSelected, String option, DiaryStateLoaded state) {
|
selectProduct(AutocompleteOnSelected<String> onSelected, String option,
|
||||||
state.productNameController.text = option;
|
DiaryStateLoaded state) {
|
||||||
|
state.product_nameController.text = option;
|
||||||
return () {
|
return () {
|
||||||
onSelected(option);
|
onSelected(option);
|
||||||
};
|
};
|
||||||
@@ -660,7 +670,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
return CarouselSlider(
|
return CarouselSlider(
|
||||||
options: CarouselOptions(height: 340.0),
|
options: CarouselOptions(height: 340.0),
|
||||||
items: state.currentMeal.photos.map<Widget>((photo) {
|
items: state.currentMeal.photos.map<Widget>((photo) {
|
||||||
return _buildPhoto(context, photo); // Assuming photos are stored as strings
|
return _buildPhoto(
|
||||||
|
context, photo); // Assuming photos are stored as strings
|
||||||
}).toList(),
|
}).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -686,7 +697,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
top: 5.v,
|
top: 5.v,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
portion.productName.length > 8 ? portion.productName.substring(0, 8) : portion.productName,
|
portion.product_name.length > 8
|
||||||
|
? portion.product_name.substring(0, 8)
|
||||||
|
: portion.product_name,
|
||||||
style: CustomTextStyles.titleMedium16,
|
style: CustomTextStyles.titleMedium16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -758,12 +771,15 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
|
|
||||||
removePhoto(BuildContext context, Photo photo) {
|
removePhoto(BuildContext context, Photo photo) {
|
||||||
return () {
|
return () {
|
||||||
context.read<DiaryBloc>().add(RemoveImageEvent(photo.id.toString(), photo.path));
|
context
|
||||||
|
.read<DiaryBloc>()
|
||||||
|
.add(RemoveImageEvent(photo.id.toString(), photo.path));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildNutritionChart(BuildContext context, DiaryStateLoaded state) {
|
_buildNutritionChart(BuildContext context, DiaryStateLoaded state) {
|
||||||
final List<int> recommendedValues = state.recommendedChartValues; // Рекомендуемые значения: калории, жиры, белки, углеводы
|
final List<int> recommendedValues = state
|
||||||
|
.recommendedChartValues; // Рекомендуемые значения: калории, жиры, белки, углеводы
|
||||||
final List<int> consumedValues = state.consumedChartValues; //
|
final List<int> consumedValues = state.consumedChartValues; //
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16.h),
|
margin: EdgeInsets.symmetric(horizontal: 16.h),
|
||||||
@@ -827,7 +843,10 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(
|
BarChartRodData(
|
||||||
toY: consumedValues[0] / recommendedValues[0] * 100,
|
toY: consumedValues[0] / recommendedValues[0] * 100,
|
||||||
color: checkConsumedValues([recommendedValues[0]], [consumedValues[1]]) ? Colors.red : Colors.blue,
|
color: checkConsumedValues(
|
||||||
|
[recommendedValues[0]], [consumedValues[1]])
|
||||||
|
? Colors.red
|
||||||
|
: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -836,7 +855,10 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(
|
BarChartRodData(
|
||||||
toY: consumedValues[1] / recommendedValues[1] * 100,
|
toY: consumedValues[1] / recommendedValues[1] * 100,
|
||||||
color: checkConsumedValues([recommendedValues[1]], [consumedValues[1]]) ? Colors.red : Colors.blue,
|
color: checkConsumedValues(
|
||||||
|
[recommendedValues[1]], [consumedValues[1]])
|
||||||
|
? Colors.red
|
||||||
|
: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -845,7 +867,10 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(
|
BarChartRodData(
|
||||||
toY: consumedValues[2] / recommendedValues[2] * 100,
|
toY: consumedValues[2] / recommendedValues[2] * 100,
|
||||||
color: checkConsumedValues([recommendedValues[2]], [consumedValues[2]]) ? Colors.red : Colors.blue,
|
color: checkConsumedValues(
|
||||||
|
[recommendedValues[2]], [consumedValues[2]])
|
||||||
|
? Colors.red
|
||||||
|
: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -854,7 +879,10 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(
|
BarChartRodData(
|
||||||
toY: consumedValues[3] / recommendedValues[3] * 100,
|
toY: consumedValues[3] / recommendedValues[3] * 100,
|
||||||
color: checkConsumedValues([recommendedValues[3]], [consumedValues[3]]) ? Colors.red : Colors.blue,
|
color: checkConsumedValues(
|
||||||
|
[recommendedValues[3]], [consumedValues[3]])
|
||||||
|
? Colors.red
|
||||||
|
: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1045,7 +1073,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
r"Подъем \ отход ко сну",
|
r"Подъем \ отход ко сну",
|
||||||
style: CustomTextStyles.bodyMediumBlack900,
|
style: CustomTextStyles.bodyMediumBlack900,
|
||||||
),
|
),
|
||||||
Icon(state.wakeupExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
|
Icon(state.wakeupExpanded
|
||||||
|
? Icons.arrow_drop_up
|
||||||
|
: Icons.arrow_drop_down),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1059,7 +1089,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
onTap: () => _selectWakeupTime(context, state),
|
onTap: () => _selectWakeupTime(context, state),
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: CustomTextFormField(
|
child: CustomTextFormField(
|
||||||
hintText: state.wakeupController?.format(context).toString(),
|
hintText:
|
||||||
|
state.wakeupController?.format(context).toString(),
|
||||||
prefix: Icon(Icons.sunny),
|
prefix: Icon(Icons.sunny),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
@@ -1070,7 +1101,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
onTap: () => _selectRetireTime(context, state),
|
onTap: () => _selectRetireTime(context, state),
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: CustomTextFormField(
|
child: CustomTextFormField(
|
||||||
hintText: state.retireController?.format(context).toString(),
|
hintText:
|
||||||
|
state.retireController?.format(context).toString(),
|
||||||
prefix: Icon(Icons.bed),
|
prefix: Icon(Icons.bed),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
@@ -1117,7 +1149,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Function() sendFinishDayData(BuildContext dialogContext, BuildContext context) {
|
Function() sendFinishDayData(
|
||||||
|
BuildContext dialogContext, BuildContext context) {
|
||||||
return () {
|
return () {
|
||||||
closeDialog(dialogContext);
|
closeDialog(dialogContext);
|
||||||
context.read<DiaryBloc>().add(FinishDay());
|
context.read<DiaryBloc>().add(FinishDay());
|
||||||
@@ -1160,7 +1193,9 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
"Ваше настроение после приема пищи",
|
"Ваше настроение после приема пищи",
|
||||||
style: CustomTextStyles.bodyMediumBlack900,
|
style: CustomTextStyles.bodyMediumBlack900,
|
||||||
),
|
),
|
||||||
Icon(state.moodExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
|
Icon(state.moodExpanded
|
||||||
|
? Icons.arrow_drop_up
|
||||||
|
: Icons.arrow_drop_down),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1220,7 +1255,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectWakeupTime(BuildContext context, DiaryStateLoaded state) async {
|
Future<void> _selectWakeupTime(
|
||||||
|
BuildContext context, DiaryStateLoaded state) async {
|
||||||
final TimeOfDay? pickedTime = await showTimePicker(
|
final TimeOfDay? pickedTime = await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialTime: state.wakeupController ?? TimeOfDay.now(),
|
initialTime: state.wakeupController ?? TimeOfDay.now(),
|
||||||
@@ -1230,7 +1266,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectRetireTime(BuildContext context, DiaryStateLoaded state) async {
|
Future<void> _selectRetireTime(
|
||||||
|
BuildContext context, DiaryStateLoaded state) async {
|
||||||
final TimeOfDay? pickedTime = await showTimePicker(
|
final TimeOfDay? pickedTime = await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialTime: state.retireController ?? TimeOfDay.now(),
|
initialTime: state.retireController ?? TimeOfDay.now(),
|
||||||
@@ -1240,7 +1277,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectMealTime(BuildContext context, DiaryStateLoaded state) async {
|
Future<void> _selectMealTime(
|
||||||
|
BuildContext context, DiaryStateLoaded state) async {
|
||||||
final TimeOfDay? pickedTime = await showTimePicker(
|
final TimeOfDay? pickedTime = await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialTime: state.mealTimeController ?? TimeOfDay.now(),
|
initialTime: state.mealTimeController ?? TimeOfDay.now(),
|
||||||
@@ -1251,7 +1289,8 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkConsumedValues(List<int> recommendedValues, List<int> consumedValues) {
|
bool checkConsumedValues(
|
||||||
|
List<int> recommendedValues, List<int> consumedValues) {
|
||||||
for (int i = 0; i < recommendedValues.length; i++) {
|
for (int i = 0; i < recommendedValues.length; i++) {
|
||||||
if (consumedValues[i] > recommendedValues[i]) {
|
if (consumedValues[i] > recommendedValues[i]) {
|
||||||
// Если хотя бы одно потребленное значение превышает рекомендованное
|
// Если хотя бы одно потребленное значение превышает рекомендованное
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/models/portion.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/product.dart';
|
import 'package:eatvio_app/features/diary/models/product.dart';
|
||||||
import 'package:eatvio_app/features/diary/services/diary_service.dart';
|
import 'package:eatvio_app/features/diary/services/diary_service.dart';
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ class DiaryRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addPortion(
|
Future<Map<String, Portion>> addPortion(
|
||||||
int diaryID,
|
int diaryID,
|
||||||
int mealID,
|
int mealID,
|
||||||
String name,
|
String name,
|
||||||
@@ -91,7 +92,8 @@ class DiaryRepository {
|
|||||||
int quantity,
|
int quantity,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
await diaryService.sendPortionData(
|
print(name);
|
||||||
|
return await diaryService.sendPortionData(
|
||||||
diaryID,
|
diaryID,
|
||||||
mealID,
|
mealID,
|
||||||
name,
|
name,
|
||||||
@@ -109,6 +111,9 @@ class DiaryRepository {
|
|||||||
int portionID,
|
int portionID,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
|
print(diaryID);
|
||||||
|
print(mealID);
|
||||||
|
print(portionID);
|
||||||
await diaryService.sendRemovePortionData(
|
await diaryService.sendRemovePortionData(
|
||||||
diaryID,
|
diaryID,
|
||||||
mealID,
|
mealID,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
import 'package:eatvio_app/features/diary/models/diary_model.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/models/portion.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/product.dart';
|
import 'package:eatvio_app/features/diary/models/product.dart';
|
||||||
import 'package:retrofit/retrofit.dart';
|
import 'package:retrofit/retrofit.dart';
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ abstract class DiaryService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@POST('/diary/{diary_id}/meal/{meal_id}/portions/create')
|
@POST('/diary/{diary_id}/meal/{meal_id}/portions/create')
|
||||||
Future<Map<String, int>> sendPortionData(
|
Future<Map<String, Portion>> sendPortionData(
|
||||||
@Path() int diary_id,
|
@Path() int diary_id,
|
||||||
@Path() int meal_id,
|
@Path() int meal_id,
|
||||||
@Query('product_name') String product_name,
|
@Query('product_name') String product_name,
|
||||||
@@ -57,8 +58,8 @@ abstract class DiaryService {
|
|||||||
@Query('quantity') int quantity,
|
@Query('quantity') int quantity,
|
||||||
);
|
);
|
||||||
|
|
||||||
@POST('/diary/{diary_id}/meal/{meal_id}/portions/{portion_id}/delete')
|
@DELETE('/diary/{diary_id}/meal/{meal_id}/portions/{portion_id}/delete')
|
||||||
Future<Map<String, int>> sendRemovePortionData(
|
Future<void> sendRemovePortionData(
|
||||||
@Path() int diary_id,
|
@Path() int diary_id,
|
||||||
@Path() int meal_id,
|
@Path() int meal_id,
|
||||||
@Path() int portion_id,
|
@Path() int portion_id,
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class _DiaryService implements DiaryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map<String, int>> sendPortionData(
|
Future<Map<String, Portion>> sendPortionData(
|
||||||
int diary_id,
|
int diary_id,
|
||||||
int meal_id,
|
int meal_id,
|
||||||
String product_name,
|
String product_name,
|
||||||
@@ -269,8 +269,8 @@ class _DiaryService implements DiaryService {
|
|||||||
};
|
};
|
||||||
final _headers = <String, dynamic>{};
|
final _headers = <String, dynamic>{};
|
||||||
const Map<String, dynamic>? _data = null;
|
const Map<String, dynamic>? _data = null;
|
||||||
final _result = await _dio
|
final _result = await _dio.fetch<Map<String, dynamic>>(
|
||||||
.fetch<Map<String, dynamic>>(_setStreamType<Map<String, int>>(Options(
|
_setStreamType<Map<String, Portion>>(Options(
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: _headers,
|
headers: _headers,
|
||||||
extra: _extra,
|
extra: _extra,
|
||||||
@@ -286,12 +286,13 @@ class _DiaryService implements DiaryService {
|
|||||||
_dio.options.baseUrl,
|
_dio.options.baseUrl,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
))));
|
))));
|
||||||
final _value = _result.data!.cast<String, int>();
|
var _value = _result.data!.map((k, dynamic v) =>
|
||||||
|
MapEntry(k, Portion.fromJson(v as Map<String, dynamic>)));
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map<String, int>> sendRemovePortionData(
|
Future<void> sendRemovePortionData(
|
||||||
int diary_id,
|
int diary_id,
|
||||||
int meal_id,
|
int meal_id,
|
||||||
int portion_id,
|
int portion_id,
|
||||||
@@ -300,25 +301,22 @@ class _DiaryService implements DiaryService {
|
|||||||
final queryParameters = <String, dynamic>{};
|
final queryParameters = <String, dynamic>{};
|
||||||
final _headers = <String, dynamic>{};
|
final _headers = <String, dynamic>{};
|
||||||
const Map<String, dynamic>? _data = null;
|
const Map<String, dynamic>? _data = null;
|
||||||
final _result = await _dio
|
await _dio.fetch<void>(_setStreamType<void>(Options(
|
||||||
.fetch<Map<String, dynamic>>(_setStreamType<Map<String, int>>(Options(
|
method: 'DELETE',
|
||||||
method: 'POST',
|
|
||||||
headers: _headers,
|
headers: _headers,
|
||||||
extra: _extra,
|
extra: _extra,
|
||||||
)
|
)
|
||||||
.compose(
|
.compose(
|
||||||
_dio.options,
|
_dio.options,
|
||||||
'/diary/${diary_id}/meal/${meal_id}/portions/${portion_id}/delete',
|
'/diary/${diary_id}/meal/${meal_id}/portions/${portion_id}/delete',
|
||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
data: _data,
|
data: _data,
|
||||||
)
|
)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
baseUrl: _combineBaseUrls(
|
baseUrl: _combineBaseUrls(
|
||||||
_dio.options.baseUrl,
|
_dio.options.baseUrl,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
))));
|
))));
|
||||||
final _value = _result.data!.cast<String, int>();
|
|
||||||
return _value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user