forked from eatvio/eatvio_app
refactor(diary): Fix
This commit is contained in:
@@ -274,8 +274,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
_buildMeal(BuildContext context, DiaryStateLoaded state) {
|
||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||
List<String> _options =
|
||||
state.autocompleteList!.map((dynamic item) => item as String).toList();
|
||||
//print(_options);
|
||||
state.autocompleteList.map((dynamic item) => item as String).toList();
|
||||
FocusNode focusNodeName = FocusNode();
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16.h),
|
||||
@@ -350,7 +349,6 @@ class DiaryScreen extends StatelessWidget {
|
||||
horizontal: 10.h,
|
||||
vertical: 9.v,
|
||||
),
|
||||
defaultValue: mealsToDropdown(diary.meals)[0],
|
||||
onChanged: changeMeal(context, state),
|
||||
);
|
||||
},
|
||||
@@ -448,7 +446,6 @@ class DiaryScreen extends StatelessWidget {
|
||||
SelectionPopupModel(title: "gr"),
|
||||
SelectionPopupModel(title: "pcs")
|
||||
],
|
||||
defaultValue: SelectionPopupModel(title: "gr"),
|
||||
onChanged: changePortion(context, state),
|
||||
);
|
||||
},
|
||||
@@ -461,7 +458,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
SizedBox(height: 30.v),
|
||||
_buildAddProduct(context, state),
|
||||
SizedBox(height: 30.v),
|
||||
...state.portions!
|
||||
...state.portions
|
||||
.map((portion) => _buildProduct(context, portion))
|
||||
.toList(),
|
||||
SizedBox(height: 30.v),
|
||||
@@ -673,12 +670,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(),
|
||||
@@ -1314,7 +1311,7 @@ List<SelectionPopupModel> mealsToDropdown(List<Meal>? meals) {
|
||||
return meals!
|
||||
.map((meal) => SelectionPopupModel(
|
||||
id: meal.id,
|
||||
title: "Прием пищи ${meal.id}",
|
||||
title: "Прием пищи ${meal.type}",
|
||||
isSelected: false,
|
||||
))
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user