family screen & widgets

pull/76/head
aamir-csol 3 weeks ago
parent aaa8222b1a
commit 24362f67cb

@ -24,6 +24,7 @@ import 'package:hmg_patient_app_new/features/payfort/payfort_repo.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_repo.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_repo.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
@ -166,6 +167,7 @@ class AppDependencies {
() => AuthenticationViewModel( () => AuthenticationViewModel(
authenticationRepo: getIt(), cacheService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt(), errorHandlerService: getIt(), localAuthService: getIt()), authenticationRepo: getIt(), cacheService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt(), errorHandlerService: getIt(), localAuthService: getIt()),
); );
getIt.registerLazySingleton<ProfileSettingsViewModel>(() => ProfileSettingsViewModel());
// Screen-specific VMs Factory // Screen-specific VMs Factory
// getIt.registerFactory<BookAppointmentsViewModel>( // getIt.registerFactory<BookAppointmentsViewModel>(

@ -275,7 +275,7 @@ class AuthenticationRepoImp implements AuthenticationRepo {
'PatientShareRequestID': patientShareRequestID, 'PatientShareRequestID': patientShareRequestID,
'ResponseID': responseID, 'ResponseID': responseID,
'Status': 3, 'Status': 3,
'PatientID': appState.getAuthenticatedUser()?.patientId ?? 0, // 'PatientID': appState.getAuthenticatedUser()?.patientId ?? 0,
'LogInTokenID': appState.getFamilyFileTokenID, 'LogInTokenID': appState.getFamilyFileTokenID,
'activationCode': activationCode ?? "0000", 'activationCode': activationCode ?? "0000",
'PatientMobileNumber': newRequest.patientMobileNumber, 'PatientMobileNumber': newRequest.patientMobileNumber,

@ -550,7 +550,7 @@ class AuthenticationViewModel extends ChangeNotifier {
if (!_appState.getIsChildLoggedIn) { if (!_appState.getIsChildLoggedIn) {
await medicalVm.getFamilyFiles(status: 0); await medicalVm.getFamilyFiles(status: 0);
await medicalVm.getAllPendingRecordsByResponseId(); await medicalVm.getAllPendingRecordsByResponseId();
_navigationService.popUntilNamed(AppRoutes.medicalFilePage); _navigationService.popUntilNamed(AppRoutes.landingScreen);
} }
} else { } else {
if (activation.list != null && activation.list!.isNotEmpty) { if (activation.list != null && activation.list!.isNotEmpty) {
@ -567,12 +567,13 @@ class AuthenticationViewModel extends ChangeNotifier {
} else { } else {
activation.list!.first.isParentUser = true; activation.list!.first.isParentUser = true;
} }
activation.list!.first.bloodGroup = activation.patientBlodType;
_appState.setAuthenticatedUser(activation.list!.first); _appState.setAuthenticatedUser(activation.list!.first);
_appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!);
} }
_appState.setUserBloodGroup = (activation.patientBlodType ?? ""); // _appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppAuthToken = activation.authenticationTokenId; _appState.setAppAuthToken = activation.authenticationTokenId;
final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); final request = await RequestUtils.getAuthanticatedCommonRequest().toJson();
bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request);
//updating the last login type in app state to show the fingerprint/face id option on home screen //updating the last login type in app state to show the fingerprint/face id option on home screen
@ -583,9 +584,9 @@ class AuthenticationViewModel extends ChangeNotifier {
// //
if (!isSwitchUser && !_appState.getIsChildLoggedIn) { if (!isSwitchUser && !_appState.getIsChildLoggedIn) {
MedicalFileViewModel medicalVm = getIt<MedicalFileViewModel>(); MedicalFileViewModel medicalVm = getIt<MedicalFileViewModel>();
insertPatientIMEIData(loginTypeEnum.toInt); await insertPatientIMEIData(loginTypeEnum.toInt);
await medicalVm.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan await medicalVm.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan
// medicalVm.getAllPendingRecordsByResponseId(); await medicalVm.getAllPendingRecordsByResponseId();
} }
await clearDefaultInputValues(); await clearDefaultInputValues();

@ -29,7 +29,7 @@ abstract class MedicalFileRepo {
Future<Either<Failure, GenericApiModel<List<FamilyFileResponseModelLists>>>> getAllPendingRecordsByResponseId({required Map<String, dynamic> request}); Future<Either<Failure, GenericApiModel<List<FamilyFileResponseModelLists>>>> getAllPendingRecordsByResponseId({required Map<String, dynamic> request});
Future<Either<Failure, GenericApiModel<List<dynamic>>>> addFamilyFile({required dynamic request}); Future<Either<Failure, GenericApiModel<dynamic>>> addFamilyFile({required dynamic request});
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointmentsForMedicalReport(); Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointmentsForMedicalReport();

@ -89,9 +89,6 @@ class MedicalFileViewModel extends ChangeNotifier {
void onFamilyFileTabChange(int index) { void onFamilyFileTabChange(int index) {
setSelectedFamilyFileTabIndex = index; setSelectedFamilyFileTabIndex = index;
if (index == 1) {
// getAllPendingRecordsByResponseId();
}
notifyListeners(); notifyListeners();
} }
@ -323,8 +320,6 @@ class MedicalFileViewModel extends ChangeNotifier {
final isPending = element.status == FamilyFileEnum.pending.toInt || element.status == FamilyFileEnum.rejected.toInt; final isPending = element.status == FamilyFileEnum.pending.toInt || element.status == FamilyFileEnum.rejected.toInt;
final isActive = element.status == FamilyFileEnum.active.toInt; final isActive = element.status == FamilyFileEnum.active.toInt;
print("====== Element Status: ${element.status}, isPending: $isPending, isActive: $isActive ============");
if (!isPending && !isActive) { if (!isPending && !isActive) {
continue; continue;
} }
@ -423,9 +418,6 @@ class MedicalFileViewModel extends ChangeNotifier {
} }
// pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.responseId == element.responseId))); // pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.responseId == element.responseId)));
pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.patientId == element.patientId))); pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.patientId == element.patientId)));
print("====== Pending Family Length: ${pendingFamilyFiles.length} ============");
print("====== Pending Family Files: ${jsonEncode(pendingFamilyFiles)} ============");
} }
notifyListeners(); notifyListeners();
} }
@ -447,7 +439,7 @@ class MedicalFileViewModel extends ChangeNotifier {
); );
} }
Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async { Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum}) async {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>();
NavigationService navigationService = getIt.get<NavigationService>(); NavigationService navigationService = getIt.get<NavigationService>();

@ -75,6 +75,11 @@ class _LandingPageState extends State<LandingPage> {
void initState() { void initState() {
authVM = context.read<AuthenticationViewModel>(); authVM = context.read<AuthenticationViewModel>();
habibWalletVM = context.read<HabibWalletViewModel>(); habibWalletVM = context.read<HabibWalletViewModel>();
myAppointmentsViewModel = context.read<MyAppointmentsViewModel>();
prescriptionsViewModel = context.read<PrescriptionsViewModel>();
insuranceViewModel = context.read<InsuranceViewModel>();
immediateLiveCareViewModel = context.read<ImmediateLiveCareViewModel>();
authVM.savePushTokenToAppState(); authVM.savePushTokenToAppState();
if (mounted) { if (mounted) {
authVM.checkLastLoginStatus(() { authVM.checkLastLoginStatus(() {
@ -100,11 +105,6 @@ class _LandingPageState extends State<LandingPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
appState = getIt.get<AppState>(); appState = getIt.get<AppState>();
NavigationService navigationService = getIt.get<NavigationService>();
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false);
prescriptionsViewModel = Provider.of<PrescriptionsViewModel>(context, listen: false);
insuranceViewModel = Provider.of<InsuranceViewModel>(context, listen: false);
immediateLiveCareViewModel = Provider.of<ImmediateLiveCareViewModel>(context, listen: false);
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: SingleChildScrollView( body: SingleChildScrollView(

@ -81,10 +81,10 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
insuranceViewModel.initInsuranceProvider(); insuranceViewModel.initInsuranceProvider();
medicalFileViewModel.setIsPatientSickLeaveListLoading(true); medicalFileViewModel.setIsPatientSickLeaveListLoading(true);
medicalFileViewModel.getPatientSickLeaveList(); medicalFileViewModel.getPatientSickLeaveList();
if (appState.getSuperUserID == null) { // if (appState.getSuperUserID == null) {
medicalFileViewModel.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan // medicalFileViewModel.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan
medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir // medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir
} // }
medicalFileViewModel.onTabChanged(0); medicalFileViewModel.onTabChanged(0);
} }

@ -40,7 +40,6 @@ class FamilyMedicalScreen extends StatefulWidget {
} }
class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> { class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
List<CustomTabBarModel> tabs = [CustomTabBarModel(null, LocaleKeys.medicalFile.tr()), CustomTabBarModel(null, LocaleKeys.request.tr())];
MedicalFileViewModel? medicalVM; MedicalFileViewModel? medicalVM;
@override @override
@ -52,6 +51,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
return CollapsingListView( return CollapsingListView(
title: "My Medical File".needTranslation, title: "My Medical File".needTranslation,
bottomChild: appState.getAuthenticatedUser()!.isParentUser! bottomChild: appState.getAuthenticatedUser()!.isParentUser!
@ -69,7 +69,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
label: "Add Family Member".needTranslation, label: "Add Family Member".needTranslation,
message: "Please fill the below field to add a new family member to your profile".needTranslation, message: "Please fill the below field to add a new family member to your profile".needTranslation,
onVerificationPress: () { onVerificationPress: () {
medicalVM?.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true); medicalVM!.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
}); });
}, },
icon: AppAssets.add_icon, icon: AppAssets.add_icon,
@ -81,13 +81,17 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
CustomTabBar( CustomTabBar(
tabs: tabs, activeBackgroundColor: AppColors.secondaryLightRedColor,
activeTextColor: AppColors.primaryRedColor,
tabs: appState.isChildLoggedIn
? [CustomTabBarModel(null, LocaleKeys.medicalFile.tr())]
: [CustomTabBarModel(null, LocaleKeys.medicalFile.tr()), CustomTabBarModel(null, LocaleKeys.request.tr())],
onTabChange: (index) { onTabChange: (index) {
medicalVM!.onFamilyFileTabChange(index); medicalVM!.onFamilyFileTabChange(index);
}, },
), ),
SizedBox(height: 25.h), SizedBox(height: 25.h),
Consumer<MedicalFileViewModel>(builder: (context, medicalVM, child) => getFamilyTabs(index: medicalVM.getSelectedFamilyFileTabIndex)), Selector<MedicalFileViewModel, int>(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)),
SizedBox(height: 20.h), SizedBox(height: 20.h),
], ],
).paddingSymmetrical(20, 0), ).paddingSymmetrical(20, 0),
@ -97,7 +101,6 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
Widget getFamilyTabs({required int index}) { Widget getFamilyTabs({required int index}) {
switch (index) { switch (index) {
case 0: case 0:
print(jsonEncode(medicalVM!.patientFamilyFiles));
return FamilyCards( return FamilyCards(
profiles: medicalVM!.patientFamilyFiles, profiles: medicalVM!.patientFamilyFiles,
onSelect: (FamilyFileResponseModelLists profile) { onSelect: (FamilyFileResponseModelLists profile) {
@ -111,7 +114,6 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
isShowRemoveButton: true, isShowRemoveButton: true,
); );
case 1: case 1:
print(jsonEncode(medicalVM!.pendingFamilyFiles));
return FamilyCards( return FamilyCards(
profiles: medicalVM!.pendingFamilyFiles, profiles: medicalVM!.pendingFamilyFiles,
isRequestDesign: true, isRequestDesign: true,

@ -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/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/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/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/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.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> { class _FamilyCardsState extends State<FamilyCards> {
AppState appState = getIt<AppState>(); AppState appState = getIt<AppState>();
// bool isShowActions = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
DialogService dialogService = getIt.get<DialogService>();
if (widget.isRequestDesign) { if (widget.isRequestDesign) {
return Column( return Column(
children: [ children: [
@ -53,7 +54,14 @@ class _FamilyCardsState extends State<FamilyCards> {
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.alertSquare), Utils.buildSvgWithAssets(icon: AppAssets.alertSquare),
SizedBox(width: 8.h), 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), SizedBox(width: 4.h),
Utils.buildSvgWithAssets(icon: AppAssets.arrowRight), Utils.buildSvgWithAssets(icon: AppAssets.arrowRight),
], ],
@ -67,15 +75,9 @@ class _FamilyCardsState extends State<FamilyCards> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList(); final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList();
FamilyFileResponseModelLists profile = mySideProfiles[index]; FamilyFileResponseModelLists profile = mySideProfiles[index];
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(bottom: 12.h),
bottom: 12.h, padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
),
padding: EdgeInsets.symmetric(
vertical: 15.h,
horizontal: 15.h,
),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
child: Opacity( child: Opacity(
opacity: 1.0, opacity: 1.0,
@ -104,27 +106,14 @@ class _FamilyCardsState extends State<FamilyCards> {
? AppColors.primaryRedColor ? AppColors.primaryRedColor
: profile.status == FamilyFileEnum.active.toInt : profile.status == FamilyFileEnum.active.toInt
? AppColors.textGreenColor ? AppColors.textGreenColor
: AppColors.alertColor, : AppColors.alertColor),
), SizedBox(height: 8.h),
Wrap( Wrap(alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, runAlignment: WrapAlignment.start, spacing: 0.h, children: [
alignment: WrapAlignment.start, (profile.patientName ?? "").toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w600),
children: [ (getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false))
(profile.patientName ?? "").toText16( .toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w500, color: AppColors.greyTextColor),
isBold: false, ]),
isCenter: true, SizedBox(height: 8.h),
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),
CustomChipWidget( CustomChipWidget(
height: 30.h, height: 30.h,
chipType: ChipTypeEnum.alert, chipType: ChipTypeEnum.alert,
@ -133,8 +122,7 @@ class _FamilyCardsState extends State<FamilyCards> {
iconAsset: null, iconAsset: null,
isShowBorder: false, isShowBorder: false,
borderRadius: 8.h, borderRadius: 8.h,
textColor: AppColors.textColor, textColor: AppColors.textColor),
),
], ],
), ),
), ),
@ -142,21 +130,111 @@ class _FamilyCardsState extends State<FamilyCards> {
}, },
), ),
SizedBox(height: 20.h), 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: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.alertSquare), Column(
SizedBox(width: 8.h), mainAxisSize: MainAxisSize.min,
"Users who want to view your profile".needTranslation.toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500), children: [
SizedBox(width: 4.h), Utils.buildImgWithAssets(
Utils.buildSvgWithAssets(icon: AppAssets.arrowRight), 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) Widget manageFamily() {
ListView.builder( NavigationService navigationService = getIt<NavigationService>();
return ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
padding: EdgeInsetsGeometry.zero,
itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length, itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList(); final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList();
@ -194,11 +272,12 @@ class _FamilyCardsState extends State<FamilyCards> {
? AppColors.textGreenColor ? AppColors.textGreenColor
: AppColors.alertColor, : AppColors.alertColor,
), ),
SizedBox(height: 8.h),
Wrap( Wrap(
alignment: WrapAlignment.start, alignment: WrapAlignment.start,
children: [ children: [
(profile.patientName ?? "").toText16(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), (profile.patientName ?? "").toText14(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( (getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false)).toText14(
isBold: false, isBold: false,
isCenter: true, isCenter: true,
maxlines: 1, maxlines: 1,
@ -207,7 +286,7 @@ class _FamilyCardsState extends State<FamilyCards> {
), ),
], ],
), ),
SizedBox(height: 4.h), SizedBox(height: 8.h),
CustomChipWidget( CustomChipWidget(
height: 30.h, height: 30.h,
chipType: ChipTypeEnum.alert, chipType: ChipTypeEnum.alert,
@ -228,6 +307,7 @@ class _FamilyCardsState extends State<FamilyCards> {
height: 40.h, height: 40.h,
text: LocaleKeys.confirm.tr(), text: LocaleKeys.confirm.tr(),
onPressed: () { onPressed: () {
navigationService.pop();
widget.onSelect(profile); widget.onSelect(profile);
}, },
backgroundColor: AppColors.lightGreenButtonColor, backgroundColor: AppColors.lightGreenButtonColor,
@ -242,6 +322,7 @@ class _FamilyCardsState extends State<FamilyCards> {
height: 40.h, height: 40.h,
text: profile.status == FamilyFileEnum.active.toInt ? LocaleKeys.removeMember.tr() : LocaleKeys.cancel.tr(), text: profile.status == FamilyFileEnum.active.toInt ? LocaleKeys.removeMember.tr() : LocaleKeys.cancel.tr(),
onPressed: () { onPressed: () {
navigationService.pop();
widget.onRemove(profile); widget.onRemove(profile);
}, },
backgroundColor: AppColors.secondaryLightRedColor, 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 { } else {
return GridView.builder( return "can view your file".needTranslation;
shrinkWrap: true, }
physics: NeverScrollableScrollPhysics(), case FamilyFileEnum.pending:
itemCount: widget.profiles.length, if (isRequestFromMySide) {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( return "has a request ${status.displayName} to be your family member".needTranslation;
crossAxisCount: 2, } else {
crossAxisSpacing: 10.h, return "wants to add you as their family member".needTranslation;
mainAxisSpacing: 10.h, }
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.66.h, case FamilyFileEnum.rejected:
), if (isRequestFromMySide) {
padding: EdgeInsets.only(bottom: 20.h), return "${status.displayName} your request to be your family member".needTranslation;
itemBuilder: (context, index) { } else {
final profile = widget.profiles[index]; return "${status.displayName} your family member request".needTranslation;
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); }
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; case FamilyFileEnum.inactive:
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); return "Inactive".needTranslation;
return Container( default:
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), return "N/A".needTranslation;
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);
}),
),
],
],
),
),
);
},
);
} }
} }
} }

@ -1,26 +1,29 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart';
import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart'; import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.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/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
class MyFamilySheet { class MyFamilySheet {
static Future<void> show(BuildContext context, List<FamilyFileResponseModelLists> familyLists, Function(FamilyFileResponseModelLists) onSelect) async { static Future<void> show(BuildContext context, List<FamilyFileResponseModelLists> familyLists, Function(FamilyFileResponseModelLists) onSelect) async {
NavigationService navigationService = getIt<NavigationService>();
return showCommonBottomSheetWithoutHeight( return showCommonBottomSheetWithoutHeight(
context, context,
titleWidget: Column( titleWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'Please select a profile'.toText21(isBold: true), 'Please select a profile'.needTranslation.toText21(isBold: true),
'switch from the below list of medical file'.toText16(weight: FontWeight.w100, color: AppColors.greyTextColor), 'switch from the below list of medical file'.needTranslation.toText16(weight: FontWeight.w100, color: AppColors.greyTextColor),
], ],
), ),
child: FamilyCards( child: FamilyCards(
profiles: familyLists, profiles: familyLists,
onSelect: (profile) { onSelect: (profile) {
Navigator.of(context).pop(); // Close the bottom sheet navigationService.pop();
onSelect(profile); // Call the onSelect callback onSelect(profile);
}, },
onRemove: (profile) {}, onRemove: (profile) {},
isBottomSheet: true), isBottomSheet: true),

@ -59,11 +59,8 @@ class _ProfileSettingsState extends State<ProfileSettings> {
int length = 3; int length = 3;
final SwiperController _controller = SwiperController(); final SwiperController _controller = SwiperController();
int _index = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final MedicalFileViewModel medicalFileViewModel = getIt.get<MedicalFileViewModel>();
return CollapsingListView( return CollapsingListView(
title: "Profile & Settings".needTranslation, title: "Profile & Settings".needTranslation,
logout: () {}, logout: () {},
@ -71,28 +68,41 @@ class _ProfileSettingsState extends State<ProfileSettings> {
child: SingleChildScrollView( child: SingleChildScrollView(
padding: EdgeInsets.only(top: 24, bottom: 24), padding: EdgeInsets.only(top: 24, bottom: 24),
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: Consumer<ProfileSettingsViewModel>( child: Consumer2<ProfileSettingsViewModel, MedicalFileViewModel>(
builder: (context, model, child) { builder: (context, profileVm, medicalVm, child) {
print(jsonEncode(medicalFileViewModel.patientFamilyFiles));
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Swiper( Swiper(
itemCount: medicalFileViewModel.patientFamilyFiles.length, itemCount: medicalVm.patientFamilyFiles.length,
layout: SwiperLayout.STACK, layout: SwiperLayout.STACK,
loop: true, loop: true,
itemWidth: MediaQuery.of(context).size.width - 42, itemWidth: MediaQuery.of(context).size.width - 42,
indicatorLayout: PageIndicatorLayout.COLOR, indicatorLayout: PageIndicatorLayout.COLOR,
axisDirection: AxisDirection.right, axisDirection: AxisDirection.right,
controller: _controller, controller: _controller,
itemHeight: 210 + 16, itemHeight: 220 + 16,
pagination: const SwiperPagination( pagination: const SwiperPagination(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(top: 210 + 8 + 24), margin: EdgeInsets.only(top: 210 + 8 + 24),
builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor),
), ),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return FamilyCardWidget(isRootUser: true).paddingOnly(right: 16); return FamilyCardWidget(
profile: medicalVm.patientFamilyFiles[index],
onAddFamilyMemberPress: () {
DialogService dialogService = getIt.get<DialogService>();
dialogService.showAddFamilyFileSheet(
label: "Add Family Member".needTranslation,
message: "Please fill the below field to add a new family member to your profile".needTranslation,
onVerificationPress: () {
medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
});
},
onFamilySwitchPress: (FamilyFileResponseModelLists profile) {
medicalVm.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
},
).paddingOnly(right: 16);
}, },
), ),
GridView( GridView(
@ -241,15 +251,12 @@ class _ProfileSettingsState extends State<ProfileSettings> {
} }
class FamilyCardWidget extends StatelessWidget { class FamilyCardWidget extends StatelessWidget {
FamilyCardWidget({this.isRootUser = true, Key? key}) : super(key: key);
bool isRootUser;
late AppState appState; late AppState appState;
final Function() onAddFamilyMemberPress; final Function() onAddFamilyMemberPress;
final Function(FamilyFileResponseModelLists member) onFamilySwitchPress; final Function(FamilyFileResponseModelLists member) onFamilySwitchPress;
final FamilyFileResponseModelLists profile; final FamilyFileResponseModelLists profile;
const FamilyCardWidget({required this.onAddFamilyMemberPress, required this.profile, required this.onFamilySwitchPress(FamilyFileResponseModelLists member)}); FamilyCardWidget({super.key, required this.onAddFamilyMemberPress, required this.profile, required this.onFamilySwitchPress(FamilyFileResponseModelLists member)});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -268,17 +275,16 @@ class FamilyCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8.h, spacing: 8.h,
children: [ children: [
Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h), Image.asset(profile.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 0.h, spacing: 0.h,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" "${profile.patientName}".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
.toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.file_icon, icon: AppAssets.file_icon,
labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}", labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${profile.patientId}",
iconSize: 12, iconSize: 12,
), ),
], ],
@ -291,46 +297,137 @@ class FamilyCardWidget extends StatelessWidget {
child: Wrap( child: Wrap(
alignment: WrapAlignment.start, alignment: WrapAlignment.start,
spacing: 8.h, spacing: 8.h,
runSpacing: 8.h,
children: [ children: [
AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old"), AppCustomChipWidget(labelText: "${profile.age} Years Old"),
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.blood_icon, icon: AppAssets.blood_icon, labelText: "${LocaleKeys.bloodType.tr()}: ${appState.getAuthenticatedUser()!.bloodGroup ?? "N/A"}", iconColor: AppColors.primaryRedColor),
labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}",
iconColor: AppColors.primaryRedColor, Selector<InsuranceViewModel, ({bool isEmpty, int? patientID, bool isLoading, String? cardValidTo})>(
selector: (context, insuranceVM) => (
isEmpty: insuranceVM.patientInsuranceList.isEmpty,
patientID: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.patientID : null,
isLoading: insuranceVM.isInsuranceLoading,
cardValidTo: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.cardValidTo : null
), ),
Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) { builder: (context, data, child) {
if (data.isEmpty) {
return const SizedBox();
} else if (profile.responseId != data.patientID) {
return SizedBox();
}
final isLoading = data.isLoading;
final isExpired = !isLoading && DateTime.now().isAfter(DateUtil.convertStringToDate(data.cardValidTo));
final String icon;
final String labelText;
final Color iconColor;
final Color backgroundColor;
if (isLoading) {
icon = AppAssets.cancel_circle_icon;
labelText = "Insurance";
iconColor = AppColors.primaryRedColor;
backgroundColor = AppColors.primaryRedColor;
} else if (isExpired) {
icon = AppAssets.cancel_circle_icon;
labelText = "Insurance Expired".needTranslation;
iconColor = AppColors.primaryRedColor;
backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15);
} else {
icon = AppAssets.insurance_active_icon;
labelText = "Insurance Active".needTranslation;
iconColor = AppColors.successColor;
backgroundColor = AppColors.successColor.withValues(alpha: 0.15);
}
return AppCustomChipWidget( return AppCustomChipWidget(
icon: insuranceVM.isInsuranceLoading icon: icon,
? AppAssets.cancel_circle_icon labelText: labelText,
: (DateTime.now().isAfter( iconColor: iconColor,
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), iconSize: 12,
)) backgroundColor: backgroundColor,
? AppAssets.cancel_circle_icon // padding: EdgeInsets.zero,
: AppAssets.insurance_active_icon, ).toShimmer2(isShow: isLoading);
labelText: insuranceVM.isInsuranceLoading },
? "Insurance"
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
) )
? "Insurance Expired".needTranslation
: "Insurance Active".needTranslation), // Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) {
iconColor: insuranceVM.isInsuranceLoading // if (insuranceVM.patientInsuranceList.isEmpty) {
? AppColors.primaryRedColor // return const SizedBox();
: (DateTime.now().isAfter( // } else if (profile.responseId != insuranceVM.patientInsuranceList.first.patientID) {
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), // return SizedBox();
)) // }
? AppColors.primaryRedColor //
: AppColors.successColor, // final isLoading = insuranceVM.isInsuranceLoading;
iconSize: 14, // final isExpired = !isLoading && DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo));
backgroundColor: insuranceVM.isInsuranceLoading //
? AppColors.primaryRedColor // final String icon;
: (DateTime.now().isAfter( // final String labelText;
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), // final Color iconColor;
)) // final Color backgroundColor;
? AppColors.primaryRedColor.withValues(alpha: 0.15) //
: AppColors.successColor.withValues(alpha: 0.15), // if (isLoading) {
).toShimmer2(isShow: insuranceVM.isInsuranceLoading); // icon = AppAssets.cancel_circle_icon;
}), // labelText = "Insurance";
// iconColor = AppColors.primaryRedColor;
// backgroundColor = AppColors.primaryRedColor;
// } else if (isExpired) {
// icon = AppAssets.cancel_circle_icon;
// labelText = "Insurance Expired".needTranslation;
// iconColor = AppColors.primaryRedColor;
// backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15);
// } else {
// icon = AppAssets.insurance_active_icon;
// labelText = "Insurance Active".needTranslation;
// iconColor = AppColors.successColor;
// backgroundColor = AppColors.successColor.withValues(alpha: 0.15);
// }
//
// return AppCustomChipWidget(
// icon: icon,
// labelText: labelText,
// iconColor: iconColor,
// iconSize: 12,
// backgroundColor: backgroundColor,
// // padding: EdgeInsets.zero,
// ).toShimmer2(isShow: isLoading);
// })
// Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) {
// return insuranceVM.patientInsuranceList. isNotEmpty ? AppCustomChipWidget(
// icon: insuranceVM.isInsuranceLoading
// ? AppAssets.cancel_circle_icon
// : (DateTime.now().isAfter(
// DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
// ))
// ? AppAssets.cancel_circle_icon
// : AppAssets.insurance_active_icon,
// labelText: insuranceVM.isInsuranceLoading
// ? "Insurance"
// : (DateTime.now().isAfter(
// DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
// )
// ? "Insurance Expired".needTranslation
// : "Insurance Active".needTranslation),
// iconColor: insuranceVM.isInsuranceLoading
// ? AppColors.primaryRedColor
// : (DateTime.now().isAfter(
// DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
// ))
// ? AppColors.primaryRedColor
// : AppColors.successColor,
// iconSize: 14,
// backgroundColor: insuranceVM.isInsuranceLoading
// ? AppColors.primaryRedColor
// : (DateTime.now().isAfter(
// DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
// ))
// ? AppColors.primaryRedColor.withValues(alpha: 0.15)
// : AppColors.successColor.withValues(alpha: 0.15),
// ).toShimmer2(isShow: insuranceVM.isInsuranceLoading) : SizedBox();
// }),
], ],
), ),
), ),
@ -426,8 +523,7 @@ class FamilyCardWidget extends StatelessWidget {
).paddingOnly(top: 12, right: 16, left: 16, bottom: 16); ).paddingOnly(top: 12, right: 16, left: 16, bottom: 16);
} }
// //TODO: Add family file switch logic here
// //TODO: Add family file switch logic here
// isRootUser // isRootUser
// ? CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, height: 40.h, fontSize: 14, onPressed: () {}) // ? CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, height: 40.h, fontSize: 14, onPressed: () {})
// .paddingOnly(top: 12, right: 16, left: 16, bottom: 16) // .paddingOnly(top: 12, right: 16, left: 16, bottom: 16)

@ -24,6 +24,8 @@ abstract class DialogService {
Future<void> showFamilyBottomSheetWithoutH( Future<void> showFamilyBottomSheetWithoutH(
{String? label, required String message, required Function(FamilyFileResponseModelLists response) onSwitchPress, required List<FamilyFileResponseModelLists> profiles}); {String? label, required String message, required Function(FamilyFileResponseModelLists response) onSwitchPress, required List<FamilyFileResponseModelLists> profiles});
Future<void> showFamilyBottomSheetWithoutHWithChild({String? label, required String message, Widget? child, required Function() onOkPressed, Function()? onCancelPressed});
Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}); Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress});
Future<void> showAddFamilyFileSheet({String? label, String? message, required Function() onVerificationPress}); Future<void> showAddFamilyFileSheet({String? label, String? message, required Function() onVerificationPress});
@ -119,6 +121,18 @@ class DialogServiceImp implements DialogService {
callBackFunc: () {}); callBackFunc: () {});
} }
@override
Future<void> showFamilyBottomSheetWithoutHWithChild({String? label, required String message, Widget? child, required Function() onOkPressed, Function()? onCancelPressed}) async {
final context = navigationService.navigatorKey.currentContext;
if (context == null) return;
showCommonBottomSheetWithoutHeight(
context,
title: label ?? "",
child: child ?? SizedBox(),
callBackFunc: () {},
);
}
@override @override
Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}) async { Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}) async {
final context = navigationService.navigatorKey.currentContext; final context = navigationService.navigatorKey.currentContext;

@ -24,8 +24,8 @@ class AppCustomChipWidget extends StatelessWidget {
this.deleteIconColor = AppColors.textColor, this.deleteIconColor = AppColors.textColor,
this.deleteIconHasColor = false, this.deleteIconHasColor = false,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.onChipTap this.onChipTap,
this.labelPadding , this.labelPadding,
}); });
final String? labelText; final String? labelText;
@ -47,7 +47,9 @@ class AppCustomChipWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChipTheme( return GestureDetector(
onTap: onChipTap,
child: ChipTheme(
data: ChipThemeData( data: ChipThemeData(
padding: EdgeInsets.all(0.0), padding: EdgeInsets.all(0.0),
shape: SmoothRectangleBorder( shape: SmoothRectangleBorder(
@ -66,7 +68,7 @@ class AppCustomChipWidget extends StatelessWidget {
// padding: EdgeInsets.all(0.0), // padding: EdgeInsets.all(0.0),
padding: padding, padding: padding,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
labelPadding: labelPadding??EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), labelPadding: labelPadding ?? EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
shape: shape ?? shape: shape ??
SmoothRectangleBorder( SmoothRectangleBorder(
@ -84,7 +86,8 @@ class AppCustomChipWidget extends StatelessWidget {
label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor),
padding: EdgeInsets.all(0.0), padding: EdgeInsets.all(0.0),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
shape: shape ?? SmoothRectangleBorder( shape: shape ??
SmoothRectangleBorder(
borderRadius: BorderRadius.circular(8 ?? 0), borderRadius: BorderRadius.circular(8 ?? 0),
smoothness: 10, smoothness: 10,
side: BorderSide(color: AppColors.transparent, width: 1.5), side: BorderSide(color: AppColors.transparent, width: 1.5),
@ -95,6 +98,7 @@ class AppCustomChipWidget extends StatelessWidget {
: null, : null,
onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null, onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null,
), ),
),
); );
} }
} }

Loading…
Cancel
Save