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,100 +75,6 @@ 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(
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,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor
: AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor
: profile.status == FamilyFileEnum.rejected.toInt
? 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),
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.responseId ?? "N/A"}",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: AppColors.textColor,
),
],
),
),
);
},
),
SizedBox(height: 20.h),
if (widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).isNotEmpty)
Row(
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),
],
),
// Items for second group (requests from others)
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length,
itemBuilder: (context, index) {
final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList();
FamilyFileResponseModelLists profile = otherProfiles[index];
return Container( return Container(
margin: EdgeInsets.only(bottom: 12.h), margin: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
@ -173,92 +87,49 @@ class _FamilyCardsState extends State<FamilyCards> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
CustomChipWidget( CustomChipWidget(
height: 30.h, height: 30.h,
chipType: ChipTypeEnum.alert, chipType: ChipTypeEnum.alert,
backgroundColor: profile.status == FamilyFileEnum.pending.toInt backgroundColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor.withValues(alpha: 0.20) ? AppColors.alertLightColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.rejected.toInt : profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor.withValues(alpha: 0.20) ? AppColors.primaryRedColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.active.toInt : profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor ? AppColors.lightGreenColor
: AppColors.lightGrayBGColor, : AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A", chipText: profile.statusDescription ?? "N/A",
iconAsset: null, iconAsset: null,
isShowBorder: false, isShowBorder: false,
borderRadius: 8.h, borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor ? AppColors.alertLightColor
: profile.status == FamilyFileEnum.rejected.toInt : profile.status == FamilyFileEnum.rejected.toInt
? 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(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), .toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w500, color: AppColors.greyTextColor),
(profile.status == FamilyFileEnum.active.toInt ? "can view your family".needTranslation : "wants to add you as their family member".needTranslation).toText14( ]),
isBold: false, SizedBox(height: 8.h),
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,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.patientId ?? "N/A".needTranslation}", chipText: "Medical File: ${profile.responseId ?? "N/A"}",
iconAsset: null, iconAsset: null,
isShowBorder: false, isShowBorder: false,
borderRadius: 8.h, borderRadius: 8.h,
textColor: AppColors.textColor, textColor: AppColors.textColor),
),
SizedBox(height: 16.h),
Row(
children: [
profile.status == FamilyFileEnum.active.toInt
? SizedBox()
: Expanded(
child: CustomButton(
height: 40.h,
text: LocaleKeys.confirm.tr(),
onPressed: () {
widget.onSelect(profile);
},
backgroundColor: AppColors.lightGreenButtonColor,
borderColor: AppColors.lightGreenButtonColor,
textColor: AppColors.textGreenColor,
icon: null,
),
),
profile.status == FamilyFileEnum.active.toInt ? SizedBox() : SizedBox(width: 8.h),
Expanded(
child: CustomButton(
height: 40.h,
text: profile.status == FamilyFileEnum.active.toInt ? LocaleKeys.removeMember.tr() : LocaleKeys.cancel.tr(),
onPressed: () {
widget.onRemove(profile);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
icon: null,
iconColor: AppColors.primaryRedColor,
),
),
],
),
], ],
), ),
), ),
); );
}, },
), ),
SizedBox(height: 20.h),
], ],
); );
} else { } else {
@ -270,7 +141,7 @@ class _FamilyCardsState extends State<FamilyCards> {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 10.h, crossAxisSpacing: 10.h,
mainAxisSpacing: 10.h, mainAxisSpacing: 10.h,
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.66.h, childAspectRatio: widget.isShowDetails ? 0.56.h : 0.65.h,
), ),
padding: EdgeInsets.only(bottom: 20.h), padding: EdgeInsets.only(bottom: 20.h),
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -297,8 +168,8 @@ class _FamilyCardsState extends State<FamilyCards> {
width: 80.h, width: 80.h,
height: 78.h), height: 78.h),
SizedBox(height: 8.h), SizedBox(height: 8.h),
(profile.patientName ?? "Unknown").toText16(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), (profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
SizedBox(height: 4.h), SizedBox(height: 8.h),
CustomChipWidget( CustomChipWidget(
chipType: ChipTypeEnum.alert, chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
@ -318,7 +189,11 @@ class _FamilyCardsState extends State<FamilyCards> {
textColor: AppColors.textColor, textColor: AppColors.textColor,
) )
: SizedBox(), : SizedBox(),
widget.isShowDetails ? SizedBox(height: 8.h) : SizedBox(), widget.isShowDetails
? SizedBox(height: 8.h)
: SizedBox(
height: 4.h,
),
Spacer(), Spacer(),
CustomButton( CustomButton(
height: 40.h, height: 40.h,
@ -353,4 +228,144 @@ class _FamilyCardsState extends State<FamilyCards> {
); );
} }
} }
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();
FamilyFileResponseModelLists profile = otherProfiles[index];
return Container(
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,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor
: AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor
: profile.status == FamilyFileEnum.active.toInt
? AppColors.textGreenColor
: AppColors.alertColor,
),
SizedBox(height: 8.h),
Wrap(
alignment: WrapAlignment.start,
children: [
(profile.patientName ?? "").toText14(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,
weight: FontWeight.w500,
color: AppColors.greyTextColor,
),
],
),
SizedBox(height: 8.h),
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.patientId ?? "N/A".needTranslation}",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: AppColors.textColor,
),
SizedBox(height: 16.h),
Row(
children: [
profile.status == FamilyFileEnum.active.toInt
? SizedBox()
: Expanded(
child: CustomButton(
height: 40.h,
text: LocaleKeys.confirm.tr(),
onPressed: () {
navigationService.pop();
widget.onSelect(profile);
},
backgroundColor: AppColors.lightGreenButtonColor,
borderColor: AppColors.lightGreenButtonColor,
textColor: AppColors.textGreenColor,
icon: null,
),
),
profile.status == FamilyFileEnum.active.toInt ? SizedBox() : SizedBox(width: 8.h),
Expanded(
child: CustomButton(
height: 40.h,
text: profile.status == FamilyFileEnum.active.toInt ? LocaleKeys.removeMember.tr() : LocaleKeys.cancel.tr(),
onPressed: () {
navigationService.pop();
widget.onRemove(profile);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
icon: null,
iconColor: AppColors.primaryRedColor,
),
),
],
),
],
),
),
);
},
);
}
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 "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;
}
}
} }

@ -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) => (
Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) { isEmpty: insuranceVM.patientInsuranceList.isEmpty,
return AppCustomChipWidget( patientID: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.patientID : null,
icon: insuranceVM.isInsuranceLoading isLoading: insuranceVM.isInsuranceLoading,
? AppAssets.cancel_circle_icon cardValidTo: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.cardValidTo : null
: (DateTime.now().isAfter( ),
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), builder: (context, data, child) {
)) if (data.isEmpty) {
? AppAssets.cancel_circle_icon return const SizedBox();
: AppAssets.insurance_active_icon, } else if (profile.responseId != data.patientID) {
labelText: insuranceVM.isInsuranceLoading return SizedBox();
? "Insurance" }
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), final isLoading = data.isLoading;
) final isExpired = !isLoading && DateTime.now().isAfter(DateUtil.convertStringToDate(data.cardValidTo));
? "Insurance Expired".needTranslation
: "Insurance Active".needTranslation), final String icon;
iconColor: insuranceVM.isInsuranceLoading final String labelText;
? AppColors.primaryRedColor final Color iconColor;
: (DateTime.now().isAfter( final Color backgroundColor;
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
)) if (isLoading) {
? AppColors.primaryRedColor icon = AppAssets.cancel_circle_icon;
: AppColors.successColor, labelText = "Insurance";
iconSize: 14, iconColor = AppColors.primaryRedColor;
backgroundColor: insuranceVM.isInsuranceLoading backgroundColor = AppColors.primaryRedColor;
? AppColors.primaryRedColor } else if (isExpired) {
: (DateTime.now().isAfter( icon = AppAssets.cancel_circle_icon;
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo), labelText = "Insurance Expired".needTranslation;
)) iconColor = AppColors.primaryRedColor;
? AppColors.primaryRedColor.withValues(alpha: 0.15) backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15);
: AppColors.successColor.withValues(alpha: 0.15), } else {
).toShimmer2(isShow: insuranceVM.isInsuranceLoading); 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) {
// if (insuranceVM.patientInsuranceList.isEmpty) {
// return const SizedBox();
// } else if (profile.responseId != insuranceVM.patientInsuranceList.first.patientID) {
// return SizedBox();
// }
//
// final isLoading = insuranceVM.isInsuranceLoading;
// final isExpired = !isLoading && DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.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(
// 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,54 +47,58 @@ class AppCustomChipWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChipTheme( return GestureDetector(
data: ChipThemeData( onTap: onChipTap,
padding: EdgeInsets.all(0.0), child: ChipTheme(
shape: SmoothRectangleBorder( data: ChipThemeData(
side: BorderSide( padding: EdgeInsets.all(0.0),
width: 10.0, shape: SmoothRectangleBorder(
color: Colors.transparent, // Crucially, set color to transparent side: BorderSide(
style: BorderStyle.none, width: 10.0,
color: Colors.transparent, // Crucially, set color to transparent
style: BorderStyle.none,
),
borderRadius: BorderRadius.circular(8.0), // Apply a border radius of 16.0
), ),
borderRadius: BorderRadius.circular(8.0), // Apply a border radius of 16.0
), ),
), child: icon.isNotEmpty
child: icon.isNotEmpty ? Chip(
? Chip( avatar: icon.isNotEmpty ? Utils.buildSvgWithAssets(icon: icon, width: iconSize.h, height: iconSize.h, iconColor: iconHasColor ? iconColor : null) : SizedBox.shrink(),
avatar: icon.isNotEmpty ? Utils.buildSvgWithAssets(icon: icon, width: iconSize.h, height: iconSize.h, iconColor: iconHasColor ? iconColor : null) : SizedBox.shrink(), 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), 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( 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), ),
), deleteIcon: deleteIcon?.isNotEmpty == true
deleteIcon: deleteIcon?.isNotEmpty == true ? Utils.buildSvgWithAssets(icon: deleteIcon!, width: deleteIconSize!.width!.h, height: deleteIconSize!.height.h, iconColor: deleteIconHasColor ? deleteIconColor : null)
? Utils.buildSvgWithAssets(icon: deleteIcon!, width: deleteIconSize!.width!.h, height: deleteIconSize!.height.h, iconColor: deleteIconHasColor ? deleteIconColor : null) : null,
: null, onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null,
onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null, )
) : Chip(
: Chip( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, 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 ??
shape: shape ?? SmoothRectangleBorder( 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),
),
labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: deleteIcon?.isNotEmpty == true ? -2.h : 8.h),
deleteIcon: deleteIcon?.isNotEmpty == true
? Utils.buildSvgWithAssets(icon: deleteIcon!, width: deleteIconSize!.width.h, height: deleteIconSize!.height.h, iconColor: deleteIconHasColor ? deleteIconColor : null)
: null,
onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null,
), ),
labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: deleteIcon?.isNotEmpty == true ? -2.h : 8.h), ),
deleteIcon: deleteIcon?.isNotEmpty == true
? Utils.buildSvgWithAssets(icon: deleteIcon!, width: deleteIconSize!.width.h, height: deleteIconSize!.height.h, iconColor: deleteIconHasColor ? deleteIconColor : null)
: null,
onDeleted: deleteIcon?.isNotEmpty == true ? () {} : null,
),
); );
} }
} }

Loading…
Cancel
Save