forked from eatvio/eatvio_app
refactor(diary): API connect attempt
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
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/photo.dart';
|
||||
import 'package:eatvio_app/features/diary/models/portion.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/locator_service.dart';
|
||||
@@ -674,12 +677,12 @@ class DiaryScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
_buildCarousel(BuildContext context, DiaryStateLoaded state) {
|
||||
if (state.currentMeal!.photos!.isEmpty) {
|
||||
if (state.currentMeal!.photos.isEmpty) {
|
||||
return Text("Фото нет");
|
||||
} else {
|
||||
return CarouselSlider(
|
||||
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
|
||||
}).toList(),
|
||||
@@ -1311,8 +1314,8 @@ bool checkConsumedValues(
|
||||
return false; // Возвращаем true
|
||||
}
|
||||
|
||||
List<SelectionPopupModel> mealsToDropdown(List<Meal> meals) {
|
||||
return meals
|
||||
List<SelectionPopupModel> mealsToDropdown(List<Meal>? meals) {
|
||||
return meals!
|
||||
.map((meal) => SelectionPopupModel(
|
||||
id: meal.id,
|
||||
title: "Прием пищи ${meal.id}",
|
||||
|
||||
Reference in New Issue
Block a user