forked from eatvio/eatvio_app
fix(diary): UI errors fix
This commit is contained in:
@@ -342,9 +342,10 @@ class DiaryScreen extends StatelessWidget {
|
||||
return null;
|
||||
},
|
||||
builder: (context, diary) {
|
||||
List<SelectionPopupModel> meals = mealsToDropdown(diary!.meals);
|
||||
return CustomDropDown(
|
||||
hintText: "Прием пищи",
|
||||
items: mealsToDropdown(diary!.meals),
|
||||
hintText: meals[0].title,
|
||||
items: meals,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10.h,
|
||||
vertical: 9.v,
|
||||
@@ -442,10 +443,8 @@ class DiaryScreen extends StatelessWidget {
|
||||
},
|
||||
builder: (context, diary) {
|
||||
return CustomDropDown(
|
||||
items: [
|
||||
SelectionPopupModel(title: "gr"),
|
||||
SelectionPopupModel(title: "pcs")
|
||||
],
|
||||
items: state.portionList,
|
||||
defaultValue: state.portionController,
|
||||
onChanged: changePortion(context, state),
|
||||
);
|
||||
},
|
||||
@@ -576,11 +575,11 @@ class DiaryScreen extends StatelessWidget {
|
||||
TextButton(
|
||||
onPressed: triggerModeration(
|
||||
context,
|
||||
state.productNameController!.text,
|
||||
state.caloriesController!.text,
|
||||
state.proteinsController!.text,
|
||||
state.fatsController!.text,
|
||||
state.carbsController!.text,
|
||||
state.productNameController.text,
|
||||
state.caloriesController.text,
|
||||
state.proteinsController.text,
|
||||
state.fatsController.text,
|
||||
state.carbsController.text,
|
||||
dialogContext,
|
||||
),
|
||||
child: Text('Отправить'),
|
||||
@@ -630,7 +629,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
|
||||
selectProduct(AutocompleteOnSelected<String> onSelected, String option,
|
||||
DiaryStateLoaded state) {
|
||||
state.productNameController?.text = option;
|
||||
state.productNameController.text = option;
|
||||
return () {
|
||||
onSelected(option);
|
||||
};
|
||||
@@ -638,9 +637,6 @@ class DiaryScreen extends StatelessWidget {
|
||||
|
||||
getAutocomplete(BuildContext context, FocusNode focusNode) {
|
||||
return (value) {
|
||||
/*print(state.autocompleteList
|
||||
?.map((dynamic item) => item as String)
|
||||
.toList());*/
|
||||
if (value.length > 2) {
|
||||
context.read<DiaryBloc>().add(ProductInput(value));
|
||||
}
|
||||
@@ -663,7 +659,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
};
|
||||
}
|
||||
|
||||
changePortion(BuildContext context, DiaryState state) {
|
||||
changePortion(BuildContext context, DiaryStateLoaded state) {
|
||||
return (value) {
|
||||
context.read<DiaryBloc>().add(ChangePortion(value: value));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user