diff --git a/lib/pages/InPatientServices/meal_plan.dart b/lib/pages/InPatientServices/meal_plan.dart index 0f9e5b90..98a50700 100644 --- a/lib/pages/InPatientServices/meal_plan.dart +++ b/lib/pages/InPatientServices/meal_plan.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/InPatientServices/get_admitted_patie import 'package:diplomaticquarterapp/models/InPatientServices/get_meal_items_schedule_response_model.dart'; import 'package:diplomaticquarterapp/models/InPatientServices/get_meals_schedule_response_model.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -71,41 +72,65 @@ class _MealPlanPageState extends State { getDivider(), ListView.separated( physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(top: 12), shrinkWrap: true, itemBuilder: (context, index) { return Container( padding: EdgeInsets.all(21.0), - child: Row( - mainAxisSize: MainAxisSize.min, + child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LargeAvatar( - name: getMealItemsScheduleResponseModelBreakfast[index].description, - url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", - width: 60, - height: 60, - ), - SizedBox(width: 11), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - MyRichText( - "", - projectViewModel.isArabic ? _getMealItemsScheduleResponseModelBreakfast[index].filterName : _getMealItemsScheduleResponseModelBreakfast[index].filterName, - projectViewModel.isArabic), - // MyRichText( - // "", - // projectViewModel.isArabic - // ? getMealItemsScheduleResponseModelBreakfast[index].categoryDescriptionN - // : getMealItemsScheduleResponseModelBreakfast[index].categoryDescription ?? "", - // projectViewModel.isArabic), - ], - ), + children: [ + Text(_getMealItemsScheduleResponseModelBreakfast[index].filterName, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + SizedBox( + height: 12.0, ), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index2) { + return Container( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LargeAvatar( + name: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description, + url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", + width: 60, + height: 60, + radius: 5, + disableProfileView: true, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText( + "", + projectViewModel.isArabic + ? _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].descriptionN + : _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description, + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(16.0), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList.length), ], ), ); @@ -268,36 +293,42 @@ class _MealPlanPageState extends State { void sortMealsByCategoryBreakfast() { getMealItemsScheduleResponseModelBreakfast.forEach((element) { - List breakfastMealItems = - _getMealItemsScheduleResponseModelBreakfast.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); + List breakfastMealItems = _getMealItemsScheduleResponseModelBreakfast + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); if (breakfastMealItems.length != 0) { _getMealItemsScheduleResponseModelBreakfast[_getMealItemsScheduleResponseModelBreakfast.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); } else { - _getMealItemsScheduleResponseModelBreakfast.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); + _getMealItemsScheduleResponseModelBreakfast + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); } }); } void sortMealsByCategoryLunch() { getMealItemsScheduleResponseModelLunch.forEach((element) { - List breakfastMealItems = - _getMealItemsScheduleResponseModelLunch.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); + List breakfastMealItems = _getMealItemsScheduleResponseModelLunch + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); if (breakfastMealItems.length != 0) { _getMealItemsScheduleResponseModelLunch[_getMealItemsScheduleResponseModelLunch.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); } else { - _getMealItemsScheduleResponseModelLunch.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); + _getMealItemsScheduleResponseModelLunch + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); } }); } void sortMealsByCategoryDinner() { getMealItemsScheduleResponseModelDinner.forEach((element) { - List breakfastMealItems = - _getMealItemsScheduleResponseModelDinner.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); + List breakfastMealItems = _getMealItemsScheduleResponseModelDinner + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); if (breakfastMealItems.length != 0) { _getMealItemsScheduleResponseModelDinner[_getMealItemsScheduleResponseModelDinner.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); } else { - _getMealItemsScheduleResponseModelDinner.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); + _getMealItemsScheduleResponseModelDinner + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); } }); }