meal plan continued

merge-update-with-lab-changes
haroon amjad 3 years ago
parent 38648df897
commit 94296cec0d

@ -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_meal_items_schedule_response_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_meals_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/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -71,38 +72,47 @@ class _MealPlanPageState extends State<MealPlanPage> {
getDivider(), getDivider(),
ListView.separated( ListView.separated(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 12),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
padding: EdgeInsets.all(21.0), padding: EdgeInsets.all(21.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
LargeAvatar( LargeAvatar(
name: getMealItemsScheduleResponseModelBreakfast[index].description, name: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description,
url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg",
width: 60, width: 60,
height: 60, height: 60,
radius: 5,
disableProfileView: true,
), ),
SizedBox(width: 11), SizedBox(width: 11),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
MyRichText( MyRichText(
"", "",
projectViewModel.isArabic ? _getMealItemsScheduleResponseModelBreakfast[index].filterName : _getMealItemsScheduleResponseModelBreakfast[index].filterName, projectViewModel.isArabic
? _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].descriptionN
: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description,
projectViewModel.isArabic), projectViewModel.isArabic),
// MyRichText(
// "",
// projectViewModel.isArabic
// ? getMealItemsScheduleResponseModelBreakfast[index].categoryDescriptionN
// : getMealItemsScheduleResponseModelBreakfast[index].categoryDescription ?? "",
// projectViewModel.isArabic),
], ],
), ),
), ),
@ -110,6 +120,21 @@ class _MealPlanPageState extends State<MealPlanPage> {
), ),
); );
}, },
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),
],
),
);
},
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return Padding( return Padding(
padding: EdgeInsets.only(left: 15, right: 15), padding: EdgeInsets.only(left: 15, right: 15),
@ -268,36 +293,42 @@ class _MealPlanPageState extends State<MealPlanPage> {
void sortMealsByCategoryBreakfast() { void sortMealsByCategoryBreakfast() {
getMealItemsScheduleResponseModelBreakfast.forEach((element) { getMealItemsScheduleResponseModelBreakfast.forEach((element) {
List<GetMealItemsScheduleResponseModelList> breakfastMealItems = List<GetMealItemsScheduleResponseModelList> breakfastMealItems = _getMealItemsScheduleResponseModelBreakfast
_getMealItemsScheduleResponseModelBreakfast.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription))
.toList();
if (breakfastMealItems.length != 0) { if (breakfastMealItems.length != 0) {
_getMealItemsScheduleResponseModelBreakfast[_getMealItemsScheduleResponseModelBreakfast.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); _getMealItemsScheduleResponseModelBreakfast[_getMealItemsScheduleResponseModelBreakfast.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element);
} else { } else {
_getMealItemsScheduleResponseModelBreakfast.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); _getMealItemsScheduleResponseModelBreakfast
.add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element));
} }
}); });
} }
void sortMealsByCategoryLunch() { void sortMealsByCategoryLunch() {
getMealItemsScheduleResponseModelLunch.forEach((element) { getMealItemsScheduleResponseModelLunch.forEach((element) {
List<GetMealItemsScheduleResponseModelList> breakfastMealItems = List<GetMealItemsScheduleResponseModelList> breakfastMealItems = _getMealItemsScheduleResponseModelLunch
_getMealItemsScheduleResponseModelLunch.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription))
.toList();
if (breakfastMealItems.length != 0) { if (breakfastMealItems.length != 0) {
_getMealItemsScheduleResponseModelLunch[_getMealItemsScheduleResponseModelLunch.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); _getMealItemsScheduleResponseModelLunch[_getMealItemsScheduleResponseModelLunch.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element);
} else { } else {
_getMealItemsScheduleResponseModelLunch.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); _getMealItemsScheduleResponseModelLunch
.add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element));
} }
}); });
} }
void sortMealsByCategoryDinner() { void sortMealsByCategoryDinner() {
getMealItemsScheduleResponseModelDinner.forEach((element) { getMealItemsScheduleResponseModelDinner.forEach((element) {
List<GetMealItemsScheduleResponseModelList> breakfastMealItems = List<GetMealItemsScheduleResponseModelList> breakfastMealItems = _getMealItemsScheduleResponseModelDinner
_getMealItemsScheduleResponseModelDinner.where((elementClinic) => elementClinic.filterName == element.categoryDescription).toList(); .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription))
.toList();
if (breakfastMealItems.length != 0) { if (breakfastMealItems.length != 0) {
_getMealItemsScheduleResponseModelDinner[_getMealItemsScheduleResponseModelDinner.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); _getMealItemsScheduleResponseModelDinner[_getMealItemsScheduleResponseModelDinner.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element);
} else { } else {
_getMealItemsScheduleResponseModelDinner.add(GetMealItemsScheduleResponseModelList(filterName: element.categoryDescription, getMealItemsScheduleResponseModel: element)); _getMealItemsScheduleResponseModelDinner
.add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element));
} }
}); });
} }

Loading…
Cancel
Save