@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/avatar/large_avatar.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/my_rich_text.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
@ -39,6 +40,11 @@ class _MealPlanPageState extends State<MealPlanPage> {
int currentDay = 0 ;
int currentWeek = 0 ;
int selectedMealScheduleID = 0 ;
final ValueNotifier < bool > isFasting = ValueNotifier ( false ) ;
bool isFastingVal = false ;
@ override
void initState ( ) {
super . initState ( ) ;
@ -59,298 +65,405 @@ class _MealPlanPageState extends State<MealPlanPage> {
body: SingleChildScrollView (
child: Padding (
padding: EdgeInsets . all ( 21.0 ) ,
child: Column (
children: [
Container (
decoration: containerRadius ( getMealsScheduleResponseModelList [ 0 ] . isShow ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Breakfast TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 0 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isDisabled: ! getMealsScheduleResponseModelList [ 0 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
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 (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
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 ,
child: getMealsScheduleResponseModelList . length ! = 0
? Column (
children: [
Container (
decoration: containerRadius ( ( getMealsScheduleResponseModelList [ 0 ] . isShow ) ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Breakfast TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 0 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isExpand: getMealsScheduleResponseModelList [ 0 ] . isShow ,
isDisabled: ! getMealsScheduleResponseModelList [ 0 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
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 (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
MyRichText (
" " ,
projectViewModel . isArabic
? _getMealItemsScheduleResponseModelBreakfast [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . descriptionN
: _getMealItemsScheduleResponseModelBreakfast [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . description ,
projectViewModel . isArabic ) ,
ValueListenableBuilder < int > (
valueListenable: _getMealItemsScheduleResponseModelBreakfast [ index ] . selectedItemID ,
builder: ( context , val , child ) {
return Radio (
value: _getMealItemsScheduleResponseModelBreakfast [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . itemID ,
groupValue: _getMealItemsScheduleResponseModelBreakfast [ index ] . selectedItemID . value ,
activeColor: Colors . red [ 800 ] ,
onChanged: ( value ) {
_getMealItemsScheduleResponseModelBreakfast [ index ] . selectedItemID . value = value ;
} ,
) ;
} ) ,
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: < Widget > [
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 ) ,
] ,
) ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelBreakfast . length ) ,
] ,
) ,
) ,
) ,
mHeight ( 21 ) ,
Container (
decoration: containerRadius ( getMealsScheduleResponseModelList [ 1 ] . isShow ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Lunch TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 1 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isDisabled: ! getMealsScheduleResponseModelList [ 1 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
padding: EdgeInsets . all ( 21.0 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text ( _getMealItemsScheduleResponseModelLunch [ 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: < Widget > [
LargeAvatar (
name: _getMealItemsScheduleResponseModelLunch [ 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 ,
) ;
} ,
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 ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelBreakfast . length ) ,
] ,
) ,
) ,
) ,
mHeight ( 21 ) ,
Container (
decoration: containerRadius ( getMealsScheduleResponseModelList [ 1 ] . isShow ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Lunch TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 1 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isExpand: getMealsScheduleResponseModelList [ 1 ] . isShow ,
isDisabled: ! getMealsScheduleResponseModelList [ 1 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
padding: EdgeInsets . all ( 21.0 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text ( _getMealItemsScheduleResponseModelLunch [ 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: < Widget > [
MyRichText (
" " ,
projectViewModel . isArabic
? _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . descriptionN
: _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . description ,
projectViewModel . isArabic ) ,
ValueListenableBuilder < int > (
valueListenable: _getMealItemsScheduleResponseModelLunch [ index ] . selectedItemID ,
builder: ( context , val , child ) {
return Radio (
value: _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . itemID ,
groupValue: _getMealItemsScheduleResponseModelLunch [ index ] . selectedItemID . value ,
activeColor: Colors . red [ 800 ] ,
onChanged: ( value ) {
_getMealItemsScheduleResponseModelLunch [ index ] . selectedItemID . value = value ;
} ,
) ;
} ) ,
LargeAvatar (
name: _getMealItemsScheduleResponseModelLunch [ 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: < Widget > [
MyRichText (
" " ,
projectViewModel . isArabic
? _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . descriptionN
: _getMealItemsScheduleResponseModelLunch [ 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: _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList . length ) ,
] ,
) ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelLunch . length ) ,
] ,
) ,
) ,
) ,
mHeight ( 21 ) ,
Container (
decoration: containerRadius ( getMealsScheduleResponseModelList [ 2 ] . isShow ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Dinner TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 2 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isDisabled: ! getMealsScheduleResponseModelList [ 2 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
padding: EdgeInsets . all ( 21.0 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text ( _getMealItemsScheduleResponseModelDinner [ 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: < Widget > [
Radio (
value: index ,
groupValue: _getMealItemsScheduleResponseModelDinner [ index ] . filterName ,
activeColor: Colors . red [ 800 ] ,
onChanged: ( value ) {
/ / setState ( ( ) {
/ / selected = value ;
/ / parameterCode = model . askDoctorReqTypes [ index ] . parameterCode ;
/ / } ) ;
} ,
) ,
LargeAvatar (
name: _getMealItemsScheduleResponseModelDinner [ 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 ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . all ( 16.0 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelLunch [ index ] . getMealItemsScheduleResponseModelList . length ) ,
] ,
) ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelLunch . length ) ,
] ,
) ,
) ,
) ,
mHeight ( 21 ) ,
Container (
decoration: containerRadius ( getMealsScheduleResponseModelList [ 2 ] . isShow ? Colors . white : Colors . grey [ 300 ] , 12 ) ,
child: AppExpandableNotifier (
title: " Dinner TAT: " + DateUtil . convertTime ( getMealsScheduleResponseModelList [ 2 ] . tATTime ) ,
isTitleSingleLine: false ,
widgetColor: Colors . transparent ,
isExpand: getMealsScheduleResponseModelList [ 2 ] . isShow ,
isDisabled: ! getMealsScheduleResponseModelList [ 2 ] . isShow ,
bodyWidget: Column (
children: [
getDivider ( ) ,
ListView . separated (
physics: BouncingScrollPhysics ( ) ,
shrinkWrap: true ,
itemBuilder: ( context , index ) {
return Container (
padding: EdgeInsets . all ( 21.0 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text ( _getMealItemsScheduleResponseModelDinner [ 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: < Widget > [
MyRichText (
" " ,
projectViewModel . isArabic
? _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . descriptionN
: _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . description ,
projectViewModel . isArabic ) ,
ValueListenableBuilder < int > (
valueListenable: _getMealItemsScheduleResponseModelDinner [ index ] . selectedItemID ,
builder: ( context , val , child ) {
return Radio (
value: _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . itemID ,
groupValue: _getMealItemsScheduleResponseModelDinner [ index ] . selectedItemID . value ,
activeColor: Colors . red [ 800 ] ,
onChanged: ( value ) {
_getMealItemsScheduleResponseModelDinner [ index ] . selectedItemID . value = value ;
} ,
) ;
} ) ,
LargeAvatar (
name: _getMealItemsScheduleResponseModelDinner [ 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: < Widget > [
MyRichText (
" " ,
projectViewModel . isArabic
? _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList [ index2 ] . descriptionN
: _getMealItemsScheduleResponseModelDinner [ 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: _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList . length ) ,
] ,
) ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelDinner . length ) ,
] ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . all ( 16.0 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelDinner [ index ] . getMealItemsScheduleResponseModelList . length ) ,
] ,
) ,
) ;
} ,
separatorBuilder: ( context , index ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
child: Divider (
height: 1.5 ,
thickness: 1.0 ,
color: Colors . grey . shade200 ,
) ,
) ;
} ,
itemCount: _getMealItemsScheduleResponseModelDinner . length ) ,
] ,
) ,
) ,
) ,
] ,
)
: Container ( ) ,
) ,
) ,
bottomSheet: Container (
color: Colors . white ,
width: double . infinity ,
padding: EdgeInsets . all ( 20 ) ,
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Row (
children: [
ValueListenableBuilder < bool > (
valueListenable: isFasting ,
builder: ( context , val , child ) {
return Checkbox (
onChanged: ( bool value ) {
isFasting . value = value ;
isFastingVal = value ;
} ,
value: isFastingVal ,
activeColor: Color ( 0xFFc5272d ) ,
) ;
} ) ,
Text (
TranslationBase . of ( context ) . isFasting ,
style: TextStyle (
fontSize: 14 ,
letterSpacing: - 0.48 ,
) ,
) ,
) ,
] ,
) ,
] ,
) ,
mHeight ( 12 ) ,
DefaultButton (
TranslationBase . of ( context ) . placeOrder ,
( ) {
placeOrder ( ) ;
} ,
color: Color ( 0xff359846 ) ,
disabledColor: Colors . grey ,
) ,
] ,
) ,
) ,
) ;
}
void placeOrder ( ) {
List < String > selectedItemIDs = [ ] ;
if ( _getMealItemsScheduleResponseModelBreakfast . isNotEmpty ) {
_getMealItemsScheduleResponseModelBreakfast . forEach ( ( element ) {
selectedItemIDs . add ( element . selectedItemID . value . toString ( ) ) ;
} ) ;
}
if ( _getMealItemsScheduleResponseModelLunch . isNotEmpty ) {
_getMealItemsScheduleResponseModelLunch . forEach ( ( element ) {
selectedItemIDs . add ( element . selectedItemID . value . toString ( ) ) ;
} ) ;
}
if ( _getMealItemsScheduleResponseModelDinner . isNotEmpty ) {
_getMealItemsScheduleResponseModelDinner . forEach ( ( element ) {
selectedItemIDs . add ( element . selectedItemID . value . toString ( ) ) ;
} ) ;
}
ClinicListService service = new ClinicListService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
. placeMealPlanOrder ( getAdmittedPatientsResponseModel . projectID , selectedMealScheduleID , selectedItemIDs . join ( " , " ) , projectViewModel . user . patientID ,
getAdmittedPatientsResponseModel . admissionNo , getAdmittedPatientsResponseModel . isHasCompanion , isFastingVal , context )
. then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showSuccessToast ( message: " Your meal order has been received successfully " ) ;
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( err ) ;
} ) ;
}
Widget getDivider ( ) {
return Padding (
padding: EdgeInsets . only ( left: 15 , right: 15 ) ,
@ -405,9 +518,18 @@ class _MealPlanPageState extends State<MealPlanPage> {
res [ ' List_MOP_MealsOfScheduleID_Mobile ' ] . forEach ( ( scheduleItem ) {
getMealsScheduleResponseModelList . add ( GetMealsScheduleResponseModel . fromJson ( scheduleItem ) ) ;
} ) ;
if ( getMealsScheduleResponseModelList [ 0 ] . isShow ) getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 0 ] . scheduleID , 1 ) ;
if ( getMealsScheduleResponseModelList [ 1 ] . isShow ) getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 1 ] . scheduleID , 2 ) ;
if ( getMealsScheduleResponseModelList [ 2 ] . isShow ) getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 2 ] . scheduleID , 3 ) ;
if ( getMealsScheduleResponseModelList [ 0 ] . isShow ) {
selectedMealScheduleID = getMealsScheduleResponseModelList [ 0 ] . scheduleID ;
getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 0 ] . scheduleID , 1 ) ;
}
if ( getMealsScheduleResponseModelList [ 1 ] . isShow ) {
selectedMealScheduleID = getMealsScheduleResponseModelList [ 1 ] . scheduleID ;
getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 1 ] . scheduleID , 2 ) ;
}
if ( getMealsScheduleResponseModelList [ 2 ] . isShow ) {
selectedMealScheduleID = getMealsScheduleResponseModelList [ 2 ] . scheduleID ;
getDefaultItemsOfScheduleID ( getMealsScheduleResponseModelList [ 2 ] . scheduleID , 3 ) ;
}
} else {
AppToast . showErrorToast ( message: " No meal schedule found for admitted patient " ) ;
}
@ -463,6 +585,14 @@ class _MealPlanPageState extends State<MealPlanPage> {
. add ( GetMealItemsScheduleResponseModelList ( filterName: projectViewModel . isArabic ? element . categoryDescriptionN : element . categoryDescription , getMealItemsScheduleResponseModel: element ) ) ;
}
} ) ;
_getMealItemsScheduleResponseModelBreakfast . forEach ( ( element ) {
element . getMealItemsScheduleResponseModelList . forEach ( ( elementInner ) {
if ( elementInner . isDefault ) {
element . selectedItemID . value = elementInner . itemID ;
}
} ) ;
} ) ;
}
void sortMealsByCategoryLunch ( ) {
@ -477,6 +607,14 @@ class _MealPlanPageState extends State<MealPlanPage> {
. add ( GetMealItemsScheduleResponseModelList ( filterName: projectViewModel . isArabic ? element . categoryDescriptionN : element . categoryDescription , getMealItemsScheduleResponseModel: element ) ) ;
}
} ) ;
_getMealItemsScheduleResponseModelLunch . forEach ( ( element ) {
element . getMealItemsScheduleResponseModelList . forEach ( ( elementInner ) {
if ( elementInner . isDefault ) {
element . selectedItemID . value = elementInner . itemID ;
}
} ) ;
} ) ;
}
void sortMealsByCategoryDinner ( ) {
@ -491,5 +629,12 @@ class _MealPlanPageState extends State<MealPlanPage> {
. add ( GetMealItemsScheduleResponseModelList ( filterName: projectViewModel . isArabic ? element . categoryDescriptionN : element . categoryDescription , getMealItemsScheduleResponseModel: element ) ) ;
}
} ) ;
_getMealItemsScheduleResponseModelDinner . forEach ( ( element ) {
element . getMealItemsScheduleResponseModelList . forEach ( ( elementInner ) {
if ( elementInner . isDefault ) {
element . selectedItemID . value = elementInner . itemID ;
}
} ) ;
} ) ;
}
}