@ -10,6 +10,8 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
 
		
	
		
			
				import  ' package:hmg_patient_app_new/extensions/widget_extensions.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/generated/locale_keys.g.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/services/dialog_service.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/services/navigation_service.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/theme/colors.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/widgets/buttons/custom_button.dart ' ;  
		
	
		
			
				import  ' package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart ' ;  
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
			
			@ -42,10 +44,9 @@ class FamilyCards extends StatefulWidget {
 
		
	
		
			
				class  _FamilyCardsState  extends  State < FamilyCards >  {  
		
	
		
			
				  AppState  appState  =  getIt < AppState > ( ) ; 
 
		
	
		
			
				
 
		
	
		
			
				  / /  bool  isShowActions  =  true ; 
 
		
	
		
			
				
 
		
	
		
			
				  @ override 
 
		
	
		
			
				  Widget  build ( BuildContext  context )  { 
 
		
	
		
			
				    DialogService  dialogService  =  getIt . get < DialogService > ( ) ; 
 
		
	
		
			
				    if  ( widget . isRequestDesign )  { 
 
		
	
		
			
				      return  Column ( 
 
		
	
		
			
				        children:  [ 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -53,7 +54,14 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				            children:  [ 
 
		
	
		
			
				              Utils . buildSvgWithAssets ( icon:  AppAssets . alertSquare ) , 
 
		
	
		
			
				              SizedBox ( width:  8. h ) , 
 
		
	
		
			
				              " Sent Requests " . needTranslation . toText14 ( color:  AppColors . textColor ,  isUnderLine:  true ,  weight:  FontWeight . w500 ) , 
 
		
	
		
			
				              " Who can view my medical file ? " . needTranslation . toText14 ( color:  AppColors . textColor ,  isUnderLine:  true ,  weight:  FontWeight . w500 ) . onPress ( ( )  { 
 
		
	
		
			
				                dialogService . showFamilyBottomSheetWithoutHWithChild ( 
 
		
	
		
			
				                  label:  " Manage Family " . needTranslation , 
 
		
	
		
			
				                  message:  " " , 
 
		
	
		
			
				                  child:  manageFamily ( ) , 
 
		
	
		
			
				                  onOkPressed:  ( )  { } , 
 
		
	
		
			
				                ) ; 
 
		
	
		
			
				              } ) , 
 
		
	
		
			
				              SizedBox ( width:  4. h ) , 
 
		
	
		
			
				              Utils . buildSvgWithAssets ( icon:  AppAssets . arrowRight ) , 
 
		
	
		
			
				            ] , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -67,15 +75,9 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				            itemBuilder:  ( context ,  index )  { 
 
		
	
		
			
				              final  mySideProfiles  =  widget . profiles . where ( ( profile )  = >  profile . isRequestFromMySide  ? ?  false ) . toList ( ) ; 
 
		
	
		
			
				              FamilyFileResponseModelLists  profile  =  mySideProfiles [ index ] ; 
 
		
	
		
			
				
 
		
	
		
			
				              return  Container ( 
 
		
	
		
			
				                margin:  EdgeInsets . only ( 
 
		
	
		
			
				                  bottom:  12. h , 
 
		
	
		
			
				                ) , 
 
		
	
		
			
				                padding:  EdgeInsets . symmetric ( 
 
		
	
		
			
				                  vertical:  15. h , 
 
		
	
		
			
				                  horizontal:  15. h , 
 
		
	
		
			
				                ) , 
 
		
	
		
			
				                margin:  EdgeInsets . only ( bottom:  12. h ) , 
 
		
	
		
			
				                padding:  EdgeInsets . symmetric ( vertical:  15. h ,  horizontal:  15. h ) , 
 
		
	
		
			
				                decoration:  RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color:  AppColors . whiteColor ,  borderRadius:  24 ) , 
 
		
	
		
			
				                child:  Opacity ( 
 
		
	
		
			
				                  opacity:  1.0 , 
 
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
			
			@ -104,27 +106,14 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                                  ?  AppColors . primaryRedColor 
 
		
	
		
			
				                                  :  profile . status  = =  FamilyFileEnum . active . toInt 
 
		
	
		
			
				                                      ?  AppColors . textGreenColor 
 
		
	
		
			
				                                    :  AppColors . alertColor , 
 
		
	
		
			
				                      ) , 
 
		
	
		
			
				                      Wrap ( 
 
		
	
		
			
				                        alignment:  WrapAlignment . start , 
 
		
	
		
			
				                        children:  [ 
 
		
	
		
			
				                          ( profile . patientName  ? ?  " " ) . toText16 ( 
 
		
	
		
			
				                            isBold:  false , 
 
		
	
		
			
				                            isCenter:  true , 
 
		
	
		
			
				                            maxlines:  1 , 
 
		
	
		
			
				                            weight:  FontWeight . w600 , 
 
		
	
		
			
				                          ) , 
 
		
	
		
			
				                          ( " has  ${ ( profile . statusDescription  ? ?  " " ) . toLowerCase ( ) }  your family member request " ) . toText14 ( 
 
		
	
		
			
				                            isBold:  false , 
 
		
	
		
			
				                            isCenter:  true , 
 
		
	
		
			
				                            maxlines:  1 , 
 
		
	
		
			
				                            weight:  FontWeight . w500 , 
 
		
	
		
			
				                            color:  AppColors . greyTextColor , 
 
		
	
		
			
				                          ) , 
 
		
	
		
			
				                        ] , 
 
		
	
		
			
				                      ) , 
 
		
	
		
			
				                      SizedBox ( height:  4. h ) , 
 
		
	
		
			
				                                      :  AppColors . alertColor ) , 
 
		
	
		
			
				                      SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                      Wrap ( alignment:  WrapAlignment . start ,  crossAxisAlignment:  WrapCrossAlignment . start ,  runAlignment:  WrapAlignment . start ,  spacing:  0. h ,  children:  [ 
 
		
	
		
			
				                        ( profile . patientName  ? ?  " " ) . toText14 ( isBold:  false ,  isCenter:  false ,  maxlines:  1 ,  weight:  FontWeight . w600 ) , 
 
		
	
		
			
				                        ( getStatusTextByRequest ( FamilyFileEnum . values . firstWhere ( ( e )  = >  e . toInt  = =  profile . status ) ,  profile . isRequestFromMySide  ? ?  false ) ) 
 
		
	
		
			
				                            . toText14 ( isBold:  false ,  isCenter:  false ,  maxlines:  1 ,  weight:  FontWeight . w500 ,  color:  AppColors . greyTextColor ) , 
 
		
	
		
			
				                      ] ) , 
 
		
	
		
			
				                      SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                      CustomChipWidget ( 
 
		
	
		
			
				                          height:  30. h , 
 
		
	
		
			
				                          chipType:  ChipTypeEnum . alert , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -133,8 +122,7 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                          iconAsset:  null , 
 
		
	
		
			
				                          isShowBorder:  false , 
 
		
	
		
			
				                          borderRadius:  8. h , 
 
		
	
		
			
				                        textColor:  AppColors . textColor , 
 
		
	
		
			
				                      ) , 
 
		
	
		
			
				                          textColor:  AppColors . textColor ) , 
 
		
	
		
			
				                    ] , 
 
		
	
		
			
				                  ) , 
 
		
	
		
			
				                ) , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -142,21 +130,111 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				            } , 
 
		
	
		
			
				          ) , 
 
		
	
		
			
				          SizedBox ( height:  20. h ) , 
 
		
	
		
			
				          if  ( widget . profiles . where ( ( profile )  = >  ! ( profile . isRequestFromMySide  ? ?  false ) ) . isNotEmpty ) 
 
		
	
		
			
				            Row ( 
 
		
	
		
			
				        ] , 
 
		
	
		
			
				      ) ; 
 
		
	
		
			
				    }  else  { 
 
		
	
		
			
				      return  GridView . builder ( 
 
		
	
		
			
				        shrinkWrap:  true , 
 
		
	
		
			
				        physics:  NeverScrollableScrollPhysics ( ) , 
 
		
	
		
			
				        itemCount:  widget . profiles . length , 
 
		
	
		
			
				        gridDelegate:  SliverGridDelegateWithFixedCrossAxisCount ( 
 
		
	
		
			
				          crossAxisCount:  2 , 
 
		
	
		
			
				          crossAxisSpacing:  10. h , 
 
		
	
		
			
				          mainAxisSpacing:  10. h , 
 
		
	
		
			
				          childAspectRatio:  widget . isShowDetails  ?  0.56 . h  :  0.65 . h , 
 
		
	
		
			
				        ) , 
 
		
	
		
			
				        padding:  EdgeInsets . only ( bottom:  20. h ) , 
 
		
	
		
			
				        itemBuilder:  ( context ,  index )  { 
 
		
	
		
			
				          final  profile  =  widget . profiles [ index ] ; 
 
		
	
		
			
				          final  isActive  =  ( profile . responseId  = =  appState . getAuthenticatedUser ( ) ? . patientId ) ; 
 
		
	
		
			
				          final  isParentUser  =  appState . getAuthenticatedUser ( ) ? . isParentUser  ? ?  false ; 
 
		
	
		
			
				          final  canSwitch  =  isParentUser  | |  ( ! isParentUser  & &  profile . responseId  = =  appState . getSuperUserID ) ; 
 
		
	
		
			
				          return  Container ( 
 
		
	
		
			
				            padding:  EdgeInsets . symmetric ( vertical:  15. h ,  horizontal:  15. h ) , 
 
		
	
		
			
				            decoration:  RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color:  AppColors . whiteColor ,  borderRadius:  24 ) , 
 
		
	
		
			
				            child:  Opacity ( 
 
		
	
		
			
				              opacity:  isActive  | |  profile . status  = =  FamilyFileEnum . pending . toInt  | |  ! canSwitch  ?  0.4  :  1.0 ,  / /  Fade  all  content  if  active 
 
		
	
		
			
				              child:  Stack ( 
 
		
	
		
			
				                children:  [ 
 
		
	
		
			
				                Utils . buildSvgWithAssets ( icon:  AppAssets . alertSquare ) , 
 
		
	
		
			
				                SizedBox ( width:  8. h ) , 
 
		
	
		
			
				                " Users who want to view your profile " . needTranslation . toText14 ( color:  AppColors . textColor ,  isUnderLine:  true ,  weight:  FontWeight . w500 ) , 
 
		
	
		
			
				                SizedBox ( width:  4. h ) , 
 
		
	
		
			
				                Utils . buildSvgWithAssets ( icon:  AppAssets . arrowRight ) , 
 
		
	
		
			
				                  Column ( 
 
		
	
		
			
				                    mainAxisSize:  MainAxisSize . min , 
 
		
	
		
			
				                    children:  [ 
 
		
	
		
			
				                      Utils . buildImgWithAssets ( 
 
		
	
		
			
				                          icon:  profile . gender  = =  null 
 
		
	
		
			
				                              ?  AppAssets . dummy_user 
 
		
	
		
			
				                              :  profile . gender  = =  1 
 
		
	
		
			
				                                  ?  ( ( profile . age  ? ?  0 )  <  7  ?  AppAssets . babyBoyImg  :  AppAssets . male_img ) 
 
		
	
		
			
				                                  :  ( profile . age !  <  7  ?  AppAssets . babyGirlImg  :  AppAssets . femaleImg ) , 
 
		
	
		
			
				                          width:  80. h , 
 
		
	
		
			
				                          height:  78. h ) , 
 
		
	
		
			
				                      SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                      ( profile . patientName  ? ?  " Unknown " ) . toText14 ( isBold:  false ,  isCenter:  true ,  maxlines:  1 ,  weight:  FontWeight . w600 ) , 
 
		
	
		
			
				                      SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                      CustomChipWidget ( 
 
		
	
		
			
				                          chipType:  ChipTypeEnum . alert , 
 
		
	
		
			
				                          backgroundColor:  AppColors . lightGrayBGColor , 
 
		
	
		
			
				                          chipText:  " Relation: ${ profile . relationship  ? ?  " N/A " } " , 
 
		
	
		
			
				                          iconAsset:  AppAssets . heart , 
 
		
	
		
			
				                          isShowBorder:  false , 
 
		
	
		
			
				                          borderRadius:  8. h , 
 
		
	
		
			
				                          textColor:  AppColors . textColor ) , 
 
		
	
		
			
				                      widget . isShowDetails  ?  SizedBox ( height:  4. h )  :  SizedBox ( ) , 
 
		
	
		
			
				                      widget . isShowDetails 
 
		
	
		
			
				                          ?  CustomChipWidget ( 
 
		
	
		
			
				                              chipType:  ChipTypeEnum . alert , 
 
		
	
		
			
				                              backgroundColor:  AppColors . lightGrayBGColor , 
 
		
	
		
			
				                              chipText:  " Age: ${ profile . age  ? ?  " N/A " }  Years " , 
 
		
	
		
			
				                              isShowBorder:  false , 
 
		
	
		
			
				                              borderRadius:  8. h , 
 
		
	
		
			
				                              textColor:  AppColors . textColor , 
 
		
	
		
			
				                            ) 
 
		
	
		
			
				                          :  SizedBox ( ) , 
 
		
	
		
			
				                      widget . isShowDetails 
 
		
	
		
			
				                          ?  SizedBox ( height:  8. h ) 
 
		
	
		
			
				                          :  SizedBox ( 
 
		
	
		
			
				                              height:  4. h , 
 
		
	
		
			
				                            ) , 
 
		
	
		
			
				                      Spacer ( ) , 
 
		
	
		
			
				                      CustomButton ( 
 
		
	
		
			
				                        height:  40. h , 
 
		
	
		
			
				                        onPressed:  ( )  { 
 
		
	
		
			
				                          if  ( canSwitch )  widget . onSelect ( profile ) ; 
 
		
	
		
			
				                        } , 
 
		
	
		
			
				                        text:  isActive  ?  " Active " . needTranslation  :  " Switch " . needTranslation , 
 
		
	
		
			
				                        backgroundColor:  isActive  | |  ! canSwitch  ?  Colors . grey . shade200  :  AppColors . secondaryLightRedColor , 
 
		
	
		
			
				                        borderColor:  isActive  | |  ! canSwitch  ?  Colors . grey . shade200  :  AppColors . secondaryLightRedColor , 
 
		
	
		
			
				                        textColor:  isActive  | |  ! canSwitch  ?  AppColors . greyTextColor  :  AppColors . primaryRedColor , 
 
		
	
		
			
				                        fontSize:  13. h , 
 
		
	
		
			
				                        icon:  isActive  ?  AppAssets . activeCheck  :  AppAssets . switch_user , 
 
		
	
		
			
				                        iconColor:  isActive  | |  ! canSwitch  ?  ( isActive  ?  null  :  AppColors . greyTextColor )  :  AppColors . primaryRedColor , 
 
		
	
		
			
				                        padding:  EdgeInsets . symmetric ( vertical:  0 ,  horizontal:  0 ) , 
 
		
	
		
			
				                      ) . paddingOnly ( top:  0 ,  bottom:  0 ) , 
 
		
	
		
			
				                    ] , 
 
		
	
		
			
				                  ) , 
 
		
	
		
			
				                  if  ( widget . isShowRemoveButton )  . . . [ 
 
		
	
		
			
				                    Positioned ( 
 
		
	
		
			
				                      top:  0 , 
 
		
	
		
			
				                      right:  0 , 
 
		
	
		
			
				                      child:  Utils . buildSvgWithAssets ( icon:  AppAssets . deleteIcon ) . onPress ( ( )  { 
 
		
	
		
			
				                        if  ( ! isActive )  widget . onRemove ( profile ) ; 
 
		
	
		
			
				                      } ) , 
 
		
	
		
			
				                    ) , 
 
		
	
		
			
				                  ] , 
 
		
	
		
			
				                ] , 
 
		
	
		
			
				              ) , 
 
		
	
		
			
				            ) , 
 
		
	
		
			
				          ) ; 
 
		
	
		
			
				        } , 
 
		
	
		
			
				      ) ; 
 
		
	
		
			
				    } 
 
		
	
		
			
				  } 
 
		
	
		
			
				
 
		
	
		
			
				          / /  Items  for  second  group  ( requests  from  others ) 
 
		
	
		
			
				          ListView . builder ( 
 
		
	
		
			
				  Widget  manageFamily ( )  { 
 
		
	
		
			
				    NavigationService  navigationService  =  getIt < NavigationService > ( ) ; 
 
		
	
		
			
				    return  ListView . builder ( 
 
		
	
		
			
				      shrinkWrap:  true , 
 
		
	
		
			
				      physics:  NeverScrollableScrollPhysics ( ) , 
 
		
	
		
			
				      padding:  EdgeInsetsGeometry . zero , 
 
		
	
		
			
				      itemCount:  widget . profiles . where ( ( profile )  = >  ! ( profile . isRequestFromMySide  ? ?  false ) ) . length , 
 
		
	
		
			
				      itemBuilder:  ( context ,  index )  { 
 
		
	
		
			
				        final  otherProfiles  =  widget . profiles . where ( ( profile )  = >  ! ( profile . isRequestFromMySide  ? ?  false ) ) . toList ( ) ; 
 
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
			
			@ -194,11 +272,12 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                              ?  AppColors . textGreenColor 
 
		
	
		
			
				                              :  AppColors . alertColor , 
 
		
	
		
			
				                ) , 
 
		
	
		
			
				                SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                Wrap ( 
 
		
	
		
			
				                  alignment:  WrapAlignment . start , 
 
		
	
		
			
				                  children:  [ 
 
		
	
		
			
				                           ( profile . patientName  ? ?  " " ) . toText1 6 ( isBold:  false ,  isCenter:  true ,  maxlines:  1 ,  weight:  FontWeight . w600 ) , 
 
		
	
		
			
				                          ( profile . status  = =  FamilyFileEnum . active . toInt  ?  " can view your family " . needTranslation  :  " wants to add you as their family member " . needTranslation  ) . toText14 ( 
 
		
	
		
			
				                    ( profile . patientName  ? ?  " " ) . toText1 4 ( isBold:  false ,  isCenter:  true ,  maxlines:  1 ,  weight:  FontWeight . w600 ) , 
 
		
	
		
			
				                    ( getStatusTextByRequest ( FamilyFileEnum . values . firstWhere ( ( e )  = >  e . toInt  = =  profile . status ) ,  profile . isRequestFromMySide  ? ?  false ) ) . toText14 ( 
 
		
	
		
			
				                      isBold:  false , 
 
		
	
		
			
				                      isCenter:  true , 
 
		
	
		
			
				                      maxlines:  1 , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -207,7 +286,7 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                    ) , 
 
		
	
		
			
				                  ] , 
 
		
	
		
			
				                ) , 
 
		
	
		
			
				                      SizedBox ( height:  4  .h ) , 
 
		
	
		
			
				                SizedBox ( height:  8 h ) , 
 
		
	
		
			
				                CustomChipWidget ( 
 
		
	
		
			
				                  height:  30. h , 
 
		
	
		
			
				                  chipType:  ChipTypeEnum . alert , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -228,6 +307,7 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                              height:  40. h , 
 
		
	
		
			
				                              text:  LocaleKeys . confirm . tr ( ) , 
 
		
	
		
			
				                              onPressed:  ( )  { 
 
		
	
		
			
				                                navigationService . pop ( ) ; 
 
		
	
		
			
				                                widget . onSelect ( profile ) ; 
 
		
	
		
			
				                              } , 
 
		
	
		
			
				                              backgroundColor:  AppColors . lightGreenButtonColor , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -242,6 +322,7 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				                        height:  40. h , 
 
		
	
		
			
				                        text:  profile . status  = =  FamilyFileEnum . active . toInt  ?  LocaleKeys . removeMember . tr ( )  :  LocaleKeys . cancel . tr ( ) , 
 
		
	
		
			
				                        onPressed:  ( )  { 
 
		
	
		
			
				                          navigationService . pop ( ) ; 
 
		
	
		
			
				                          widget . onRemove ( profile ) ; 
 
		
	
		
			
				                        } , 
 
		
	
		
			
				                        backgroundColor:  AppColors . secondaryLightRedColor , 
 
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
			
			@ -258,99 +339,33 @@ class _FamilyCardsState extends State<FamilyCards> {
 
		
	
		
			
				          ) , 
 
		
	
		
			
				        ) ; 
 
		
	
		
			
				      } , 
 
		
	
		
			
				          ) , 
 
		
	
		
			
				        ] , 
 
		
	
		
			
				    ) ; 
 
		
	
		
			
				  } 
 
		
	
		
			
				
 
		
	
		
			
				  String  getStatusTextByRequest ( FamilyFileEnum  status ,  bool  isRequestFromMySide )  { 
 
		
	
		
			
				    switch  ( status )  { 
 
		
	
		
			
				      case  FamilyFileEnum . active: 
 
		
	
		
			
				        if  ( isRequestFromMySide )  { 
 
		
	
		
			
				          return  " ${ status . displayName }  your request to be your family member " . needTranslation ; 
 
		
	
		
			
				        }  else  { 
 
		
	
		
			
				      return  GridView . builder ( 
 
		
	
		
			
				        shrinkWrap:  true , 
 
		
	
		
			
				        physics:  NeverScrollableScrollPhysics ( ) , 
 
		
	
		
			
				        itemCount:  widget . profiles . length , 
 
		
	
		
			
				        gridDelegate:  SliverGridDelegateWithFixedCrossAxisCount ( 
 
		
	
		
			
				          crossAxisCount:  2 , 
 
		
	
		
			
				          crossAxisSpacing:  10. h , 
 
		
	
		
			
				          mainAxisSpacing:  10. h , 
 
		
	
		
			
				          childAspectRatio:  widget . isShowDetails  ?  0.56 . h  :  0.66 . h , 
 
		
	
		
			
				        ) , 
 
		
	
		
			
				        padding:  EdgeInsets . only ( bottom:  20. h ) , 
 
		
	
		
			
				        itemBuilder:  ( context ,  index )  { 
 
		
	
		
			
				          final  profile  =  widget . profiles [ index ] ; 
 
		
	
		
			
				          final  isActive  =  ( profile . responseId  = =  appState . getAuthenticatedUser ( ) ? . patientId ) ; 
 
		
	
		
			
				          final  isParentUser  =  appState . getAuthenticatedUser ( ) ? . isParentUser  ? ?  false ; 
 
		
	
		
			
				          final  canSwitch  =  isParentUser  | |  ( ! isParentUser  & &  profile . responseId  = =  appState . getSuperUserID ) ; 
 
		
	
		
			
				          return  Container ( 
 
		
	
		
			
				            padding:  EdgeInsets . symmetric ( vertical:  15. h ,  horizontal:  15. h ) , 
 
		
	
		
			
				            decoration:  RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color:  AppColors . whiteColor ,  borderRadius:  24 ) , 
 
		
	
		
			
				            child:  Opacity ( 
 
		
	
		
			
				              opacity:  isActive  | |  profile . status  = =  FamilyFileEnum . pending . toInt  | |  ! canSwitch  ?  0.4  :  1.0 ,  / /  Fade  all  content  if  active 
 
		
	
		
			
				              child:  Stack ( 
 
		
	
		
			
				                children:  [ 
 
		
	
		
			
				                  Column ( 
 
		
	
		
			
				                    mainAxisSize:  MainAxisSize . min , 
 
		
	
		
			
				                    children:  [ 
 
		
	
		
			
				                      Utils . buildImgWithAssets ( 
 
		
	
		
			
				                          icon:  profile . gender  = =  null 
 
		
	
		
			
				                              ?  AppAssets . dummy_user 
 
		
	
		
			
				                              :  profile . gender  = =  1 
 
		
	
		
			
				                                  ?  ( ( profile . age  ? ?  0 )  <  7  ?  AppAssets . babyBoyImg  :  AppAssets . male_img ) 
 
		
	
		
			
				                                  :  ( profile . age !  <  7  ?  AppAssets . babyGirlImg  :  AppAssets . femaleImg ) , 
 
		
	
		
			
				                          width:  80. h , 
 
		
	
		
			
				                          height:  78. h ) , 
 
		
	
		
			
				                      SizedBox ( height:  8. h ) , 
 
		
	
		
			
				                      ( profile . patientName  ? ?  " Unknown " ) . toText16 ( isBold:  false ,  isCenter:  true ,  maxlines:  1 ,  weight:  FontWeight . w600 ) , 
 
		
	
		
			
				                      SizedBox ( height:  4. h ) , 
 
		
	
		
			
				                      CustomChipWidget ( 
 
		
	
		
			
				                          chipType:  ChipTypeEnum . alert , 
 
		
	
		
			
				                          backgroundColor:  AppColors . lightGrayBGColor , 
 
		
	
		
			
				                          chipText:  " Relation: ${ profile . relationship  ? ?  " N/A " } " , 
 
		
	
		
			
				                          iconAsset:  AppAssets . heart , 
 
		
	
		
			
				                          isShowBorder:  false , 
 
		
	
		
			
				                          borderRadius:  8. h , 
 
		
	
		
			
				                          textColor:  AppColors . textColor ) , 
 
		
	
		
			
				                      widget . isShowDetails  ?  SizedBox ( height:  4. h )  :  SizedBox ( ) , 
 
		
	
		
			
				                      widget . isShowDetails 
 
		
	
		
			
				                          ?  CustomChipWidget ( 
 
		
	
		
			
				                              chipType:  ChipTypeEnum . alert , 
 
		
	
		
			
				                              backgroundColor:  AppColors . lightGrayBGColor , 
 
		
	
		
			
				                              chipText:  " Age: ${ profile . age  ? ?  " N/A " }  Years " , 
 
		
	
		
			
				                              isShowBorder:  false , 
 
		
	
		
			
				                              borderRadius:  8. h , 
 
		
	
		
			
				                              textColor:  AppColors . textColor , 
 
		
	
		
			
				                            ) 
 
		
	
		
			
				                          :  SizedBox ( ) , 
 
		
	
		
			
				                      widget . isShowDetails  ?  SizedBox ( height:  8. h )  :  SizedBox ( ) , 
 
		
	
		
			
				                      Spacer ( ) , 
 
		
	
		
			
				                      CustomButton ( 
 
		
	
		
			
				                        height:  40. h , 
 
		
	
		
			
				                        onPressed:  ( )  { 
 
		
	
		
			
				                          if  ( canSwitch )  widget . onSelect ( profile ) ; 
 
		
	
		
			
				                        } , 
 
		
	
		
			
				                        text:  isActive  ?  " Active " . needTranslation  :  " Switch " . needTranslation , 
 
		
	
		
			
				                        backgroundColor:  isActive  | |  ! canSwitch  ?  Colors . grey . shade200  :  AppColors . secondaryLightRedColor , 
 
		
	
		
			
				                        borderColor:  isActive  | |  ! canSwitch  ?  Colors . grey . shade200  :  AppColors . secondaryLightRedColor , 
 
		
	
		
			
				                        textColor:  isActive  | |  ! canSwitch  ?  AppColors . greyTextColor  :  AppColors . primaryRedColor , 
 
		
	
		
			
				                        fontSize:  13. h , 
 
		
	
		
			
				                        icon:  isActive  ?  AppAssets . activeCheck  :  AppAssets . switch_user , 
 
		
	
		
			
				                        iconColor:  isActive  | |  ! canSwitch  ?  ( isActive  ?  null  :  AppColors . greyTextColor )  :  AppColors . primaryRedColor , 
 
		
	
		
			
				                        padding:  EdgeInsets . symmetric ( vertical:  0 ,  horizontal:  0 ) , 
 
		
	
		
			
				                      ) . paddingOnly ( top:  0 ,  bottom:  0 ) , 
 
		
	
		
			
				                    ] , 
 
		
	
		
			
				                  ) , 
 
		
	
		
			
				                  if  ( widget . isShowRemoveButton )  . . . [ 
 
		
	
		
			
				                    Positioned ( 
 
		
	
		
			
				                      top:  0 , 
 
		
	
		
			
				                      right:  0 , 
 
		
	
		
			
				                      child:  Utils . buildSvgWithAssets ( icon:  AppAssets . deleteIcon ) . onPress ( ( )  { 
 
		
	
		
			
				                        if  ( ! isActive )  widget . onRemove ( profile ) ; 
 
		
	
		
			
				                      } ) , 
 
		
	
		
			
				                    ) , 
 
		
	
		
			
				                  ] , 
 
		
	
		
			
				                ] , 
 
		
	
		
			
				              ) , 
 
		
	
		
			
				            ) , 
 
		
	
		
			
				          ) ; 
 
		
	
		
			
				        } , 
 
		
	
		
			
				      ) ; 
 
		
	
		
			
				          return  " can view your file " . needTranslation ; 
 
		
	
		
			
				        } 
 
		
	
		
			
				      case  FamilyFileEnum . pending: 
 
		
	
		
			
				        if  ( isRequestFromMySide )  { 
 
		
	
		
			
				          return  " has a request  ${ status . displayName }  to be your family member " . needTranslation ; 
 
		
	
		
			
				        }  else  { 
 
		
	
		
			
				          return  " wants to add you as their family member " . needTranslation ; 
 
		
	
		
			
				        } 
 
		
	
		
			
				      case  FamilyFileEnum . rejected: 
 
		
	
		
			
				        if  ( isRequestFromMySide )  { 
 
		
	
		
			
				          return  " ${ status . displayName }  your request to be your family member " . needTranslation ; 
 
		
	
		
			
				        }  else  { 
 
		
	
		
			
				          return  " ${ status . displayName }  your family member request " . needTranslation ; 
 
		
	
		
			
				        } 
 
		
	
		
			
				      case  FamilyFileEnum . inactive: 
 
		
	
		
			
				        return  " Inactive " . needTranslation ; 
 
		
	
		
			
				      default : 
 
		
	
		
			
				        return  " N/A " . needTranslation ; 
 
		
	
		
			
				    } 
 
		
	
		
			
				  } 
 
		
	
		
			
				}