diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index e2e06d2..0ddada2 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -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/prescriptions/prescriptions_repo.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_view_model.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; @@ -166,6 +167,7 @@ class AppDependencies { () => AuthenticationViewModel( authenticationRepo: getIt(), cacheService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt(), errorHandlerService: getIt(), localAuthService: getIt()), ); + getIt.registerLazySingleton(() => ProfileSettingsViewModel()); // Screen-specific VMs → Factory // getIt.registerFactory( diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index c034a69..bec5470 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -275,7 +275,7 @@ class AuthenticationRepoImp implements AuthenticationRepo { 'PatientShareRequestID': patientShareRequestID, 'ResponseID': responseID, 'Status': 3, - 'PatientID': appState.getAuthenticatedUser()?.patientId ?? 0, + // 'PatientID': appState.getAuthenticatedUser()?.patientId ?? 0, 'LogInTokenID': appState.getFamilyFileTokenID, 'activationCode': activationCode ?? "0000", 'PatientMobileNumber': newRequest.patientMobileNumber, diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 467a476..444e54e 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -550,7 +550,7 @@ class AuthenticationViewModel extends ChangeNotifier { if (!_appState.getIsChildLoggedIn) { await medicalVm.getFamilyFiles(status: 0); await medicalVm.getAllPendingRecordsByResponseId(); - _navigationService.popUntilNamed(AppRoutes.medicalFilePage); + _navigationService.popUntilNamed(AppRoutes.landingScreen); } } else { if (activation.list != null && activation.list!.isNotEmpty) { @@ -567,12 +567,13 @@ class AuthenticationViewModel extends ChangeNotifier { } else { activation.list!.first.isParentUser = true; } + activation.list!.first.bloodGroup = activation.patientBlodType; _appState.setAuthenticatedUser(activation.list!.first); _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); } - _appState.setUserBloodGroup = (activation.patientBlodType ?? ""); + // _appState.setUserBloodGroup = (activation.patientBlodType ?? ""); _appState.setAppAuthToken = activation.authenticationTokenId; - final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); + final request = await RequestUtils.getAuthanticatedCommonRequest().toJson(); bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); //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) { MedicalFileViewModel medicalVm = getIt(); - insertPatientIMEIData(loginTypeEnum.toInt); + await insertPatientIMEIData(loginTypeEnum.toInt); await medicalVm.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan - // medicalVm.getAllPendingRecordsByResponseId(); + await medicalVm.getAllPendingRecordsByResponseId(); } await clearDefaultInputValues(); diff --git a/lib/features/medical_file/medical_file_repo.dart b/lib/features/medical_file/medical_file_repo.dart index 416c372..a460d9f 100644 --- a/lib/features/medical_file/medical_file_repo.dart +++ b/lib/features/medical_file/medical_file_repo.dart @@ -29,7 +29,7 @@ abstract class MedicalFileRepo { Future>>> getAllPendingRecordsByResponseId({required Map request}); - Future>>> addFamilyFile({required dynamic request}); + Future>> addFamilyFile({required dynamic request}); Future>>> getPatientAppointmentsForMedicalReport(); diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart index 60d14b0..b5d9d03 100644 --- a/lib/features/medical_file/medical_file_view_model.dart +++ b/lib/features/medical_file/medical_file_view_model.dart @@ -89,9 +89,6 @@ class MedicalFileViewModel extends ChangeNotifier { void onFamilyFileTabChange(int index) { setSelectedFamilyFileTabIndex = index; - if (index == 1) { - // getAllPendingRecordsByResponseId(); - } notifyListeners(); } @@ -323,8 +320,6 @@ class MedicalFileViewModel extends ChangeNotifier { final isPending = element.status == FamilyFileEnum.pending.toInt || element.status == FamilyFileEnum.rejected.toInt; final isActive = element.status == FamilyFileEnum.active.toInt; - print("====== Element Status: ${element.status}, isPending: $isPending, isActive: $isActive ============"); - if (!isPending && !isActive) { 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.patientId == element.patientId))); - - print("====== Pending Family Length: ${pendingFamilyFiles.length} ============"); - print("====== Pending Family Files: ${jsonEncode(pendingFamilyFiles)} ============"); } notifyListeners(); } @@ -447,7 +439,7 @@ class MedicalFileViewModel extends ChangeNotifier { ); } - Future addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async { + Future addFamilyFile({required OTPTypeEnum otpTypeEnum}) async { LoaderBottomSheet.showLoader(); AuthenticationViewModel authVM = getIt.get(); NavigationService navigationService = getIt.get(); diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 42932b1..afaa1c8 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -75,6 +75,11 @@ class _LandingPageState extends State { void initState() { authVM = context.read(); habibWalletVM = context.read(); + myAppointmentsViewModel = context.read(); + prescriptionsViewModel = context.read(); + insuranceViewModel = context.read(); + immediateLiveCareViewModel = context.read(); + authVM.savePushTokenToAppState(); if (mounted) { authVM.checkLastLoginStatus(() { @@ -100,11 +105,6 @@ class _LandingPageState extends State { @override Widget build(BuildContext context) { appState = getIt.get(); - NavigationService navigationService = getIt.get(); - myAppointmentsViewModel = Provider.of(context, listen: false); - prescriptionsViewModel = Provider.of(context, listen: false); - insuranceViewModel = Provider.of(context, listen: false); - immediateLiveCareViewModel = Provider.of(context, listen: false); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: SingleChildScrollView( diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index 92396a8..674732a 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -81,10 +81,10 @@ class _MedicalFilePageState extends State { insuranceViewModel.initInsuranceProvider(); medicalFileViewModel.setIsPatientSickLeaveListLoading(true); medicalFileViewModel.getPatientSickLeaveList(); - if (appState.getSuperUserID == null) { - medicalFileViewModel.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan - medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir - } + // if (appState.getSuperUserID == null) { + // medicalFileViewModel.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan + // medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir + // } medicalFileViewModel.onTabChanged(0); } diff --git a/lib/presentation/my_family/my_family.dart b/lib/presentation/my_family/my_family.dart index 7de92f4..c1773b8 100644 --- a/lib/presentation/my_family/my_family.dart +++ b/lib/presentation/my_family/my_family.dart @@ -40,7 +40,6 @@ class FamilyMedicalScreen extends StatefulWidget { } class _FamilyMedicalScreenState extends State { - List tabs = [CustomTabBarModel(null, LocaleKeys.medicalFile.tr()), CustomTabBarModel(null, LocaleKeys.request.tr())]; MedicalFileViewModel? medicalVM; @override @@ -52,6 +51,7 @@ class _FamilyMedicalScreenState extends State { @override Widget build(BuildContext context) { AppState appState = getIt.get(); + return CollapsingListView( title: "My Medical File".needTranslation, bottomChild: appState.getAuthenticatedUser()!.isParentUser! @@ -69,7 +69,7 @@ class _FamilyMedicalScreenState extends State { 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, isExcludedUser: true); + medicalVM!.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); }); }, icon: AppAssets.add_icon, @@ -81,13 +81,17 @@ class _FamilyMedicalScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ 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) { medicalVM!.onFamilyFileTabChange(index); }, ), SizedBox(height: 25.h), - Consumer(builder: (context, medicalVM, child) => getFamilyTabs(index: medicalVM.getSelectedFamilyFileTabIndex)), + Selector(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)), SizedBox(height: 20.h), ], ).paddingSymmetrical(20, 0), @@ -97,7 +101,6 @@ class _FamilyMedicalScreenState extends State { Widget getFamilyTabs({required int index}) { switch (index) { case 0: - print(jsonEncode(medicalVM!.patientFamilyFiles)); return FamilyCards( profiles: medicalVM!.patientFamilyFiles, onSelect: (FamilyFileResponseModelLists profile) { @@ -111,7 +114,6 @@ class _FamilyMedicalScreenState extends State { isShowRemoveButton: true, ); case 1: - print(jsonEncode(medicalVM!.pendingFamilyFiles)); return FamilyCards( profiles: medicalVM!.pendingFamilyFiles, isRequestDesign: true, diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 166b06d..92c85af 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -10,6 +10,8 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; @@ -42,10 +44,9 @@ class FamilyCards extends StatefulWidget { class _FamilyCardsState extends State { AppState appState = getIt(); - // bool isShowActions = true; - @override Widget build(BuildContext context) { + DialogService dialogService = getIt.get(); if (widget.isRequestDesign) { return Column( children: [ @@ -53,7 +54,14 @@ class _FamilyCardsState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.alertSquare), SizedBox(width: 8.h), - "Sent Requests".needTranslation.toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500), + "Who can view my medical file ?".needTranslation.toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Manage Family".needTranslation, + message: "", + child: manageFamily(), + onOkPressed: () {}, + ); + }), SizedBox(width: 4.h), Utils.buildSvgWithAssets(icon: AppAssets.arrowRight), ], @@ -67,100 +75,6 @@ class _FamilyCardsState extends State { itemBuilder: (context, index) { final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList(); FamilyFileResponseModelLists profile = mySideProfiles[index]; - - return Container( - margin: EdgeInsets.only( - bottom: 12.h, - ), - padding: EdgeInsets.symmetric( - vertical: 15.h, - horizontal: 15.h, - ), - 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( margin: EdgeInsets.only(bottom: 12.h), padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), @@ -173,92 +87,49 @@ class _FamilyCardsState extends State { 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), - (profile.status == FamilyFileEnum.active.toInt ? "can view your family".needTranslation : "wants to add you as their family member".needTranslation).toText14( - isBold: false, - isCenter: true, - maxlines: 1, - weight: FontWeight.w500, - color: AppColors.greyTextColor, - ), - ], - ), - SizedBox(height: 4.h), + 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, crossAxisAlignment: WrapCrossAlignment.start, runAlignment: WrapAlignment.start, spacing: 0.h, children: [ + (profile.patientName ?? "").toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w600), + (getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false)) + .toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w500, color: AppColors.greyTextColor), + ]), + SizedBox(height: 8.h), CustomChipWidget( - height: 30.h, - chipType: ChipTypeEnum.alert, - 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: () { - 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, - ), - ), - ], - ), + 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), ], ); } else { @@ -270,7 +141,7 @@ class _FamilyCardsState extends State { crossAxisCount: 2, crossAxisSpacing: 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), itemBuilder: (context, index) { @@ -297,8 +168,8 @@ class _FamilyCardsState extends State { 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), + (profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), + SizedBox(height: 8.h), CustomChipWidget( chipType: ChipTypeEnum.alert, backgroundColor: AppColors.lightGrayBGColor, @@ -318,7 +189,11 @@ class _FamilyCardsState extends State { textColor: AppColors.textColor, ) : SizedBox(), - widget.isShowDetails ? SizedBox(height: 8.h) : SizedBox(), + widget.isShowDetails + ? SizedBox(height: 8.h) + : SizedBox( + height: 4.h, + ), Spacer(), CustomButton( height: 40.h, @@ -353,4 +228,144 @@ class _FamilyCardsState extends State { ); } } + + Widget manageFamily() { + NavigationService navigationService = getIt(); + 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; + } + } } diff --git a/lib/presentation/my_family/widget/my_family_sheet.dart b/lib/presentation/my_family/widget/my_family_sheet.dart index 1c085ca..d469ab2 100644 --- a/lib/presentation/my_family/widget/my_family_sheet.dart +++ b/lib/presentation/my_family/widget/my_family_sheet.dart @@ -1,26 +1,29 @@ 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/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/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; class MyFamilySheet { static Future show(BuildContext context, List familyLists, Function(FamilyFileResponseModelLists) onSelect) async { + NavigationService navigationService = getIt(); return showCommonBottomSheetWithoutHeight( context, titleWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Please select a profile'.toText21(isBold: true), - 'switch from the below list of medical file'.toText16(weight: FontWeight.w100, color: AppColors.greyTextColor), + 'Please select a profile'.needTranslation.toText21(isBold: true), + 'switch from the below list of medical file'.needTranslation.toText16(weight: FontWeight.w100, color: AppColors.greyTextColor), ], ), child: FamilyCards( profiles: familyLists, onSelect: (profile) { - Navigator.of(context).pop(); // Close the bottom sheet - onSelect(profile); // Call the onSelect callback + navigationService.pop(); + onSelect(profile); }, onRemove: (profile) {}, isBottomSheet: true), diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index d40104b..3954dd7 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -59,11 +59,8 @@ class _ProfileSettingsState extends State { int length = 3; final SwiperController _controller = SwiperController(); - int _index = 0; - @override Widget build(BuildContext context) { - final MedicalFileViewModel medicalFileViewModel = getIt.get(); return CollapsingListView( title: "Profile & Settings".needTranslation, logout: () {}, @@ -71,28 +68,41 @@ class _ProfileSettingsState extends State { child: SingleChildScrollView( padding: EdgeInsets.only(top: 24, bottom: 24), physics: NeverScrollableScrollPhysics(), - child: Consumer( - builder: (context, model, child) { - print(jsonEncode(medicalFileViewModel.patientFamilyFiles)); + child: Consumer2( + builder: (context, profileVm, medicalVm, child) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Swiper( - itemCount: medicalFileViewModel.patientFamilyFiles.length, + itemCount: medicalVm.patientFamilyFiles.length, layout: SwiperLayout.STACK, loop: true, itemWidth: MediaQuery.of(context).size.width - 42, indicatorLayout: PageIndicatorLayout.COLOR, axisDirection: AxisDirection.right, controller: _controller, - itemHeight: 210 + 16, + itemHeight: 220 + 16, pagination: const SwiperPagination( alignment: Alignment.bottomCenter, margin: EdgeInsets.only(top: 210 + 8 + 24), builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), ), itemBuilder: (BuildContext context, int index) { - return FamilyCardWidget(isRootUser: true).paddingOnly(right: 16); + return FamilyCardWidget( + profile: medicalVm.patientFamilyFiles[index], + onAddFamilyMemberPress: () { + DialogService dialogService = getIt.get(); + 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( @@ -241,15 +251,12 @@ class _ProfileSettingsState extends State { } class FamilyCardWidget extends StatelessWidget { - FamilyCardWidget({this.isRootUser = true, Key? key}) : super(key: key); - - bool isRootUser; late AppState appState; final Function() onAddFamilyMemberPress; final Function(FamilyFileResponseModelLists member) onFamilySwitchPress; 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 Widget build(BuildContext context) { @@ -268,17 +275,16 @@ class FamilyCardWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 8.h, 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( crossAxisAlignment: CrossAxisAlignment.start, spacing: 0.h, mainAxisSize: MainAxisSize.min, children: [ - "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" - .toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), + "${profile.patientName}".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), AppCustomChipWidget( icon: AppAssets.file_icon, - labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}", + labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${profile.patientId}", iconSize: 12, ), ], @@ -291,46 +297,137 @@ class FamilyCardWidget extends StatelessWidget { child: Wrap( alignment: WrapAlignment.start, spacing: 8.h, + runSpacing: 8.h, children: [ - AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old"), + AppCustomChipWidget(labelText: "${profile.age} Years Old"), AppCustomChipWidget( - icon: AppAssets.blood_icon, - labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}", - iconColor: AppColors.primaryRedColor, - ), - Consumer(builder: (context, insuranceVM, child) { - return 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); - }), + icon: AppAssets.blood_icon, labelText: "${LocaleKeys.bloodType.tr()}: ${appState.getAuthenticatedUser()!.bloodGroup ?? "N/A"}", iconColor: AppColors.primaryRedColor), + + Selector( + 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 + ), + 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( + icon: icon, + labelText: labelText, + iconColor: iconColor, + iconSize: 12, + backgroundColor: backgroundColor, + // padding: EdgeInsets.zero, + ).toShimmer2(isShow: isLoading); + }, + ) + + // Consumer(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(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); } - - // //TODO: Add family file switch logic here +// //TODO: Add family file switch logic here // isRootUser // ? 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) diff --git a/lib/services/dialog_service.dart b/lib/services/dialog_service.dart index 4d332b3..7003a31 100644 --- a/lib/services/dialog_service.dart +++ b/lib/services/dialog_service.dart @@ -24,6 +24,8 @@ abstract class DialogService { Future showFamilyBottomSheetWithoutH( {String? label, required String message, required Function(FamilyFileResponseModelLists response) onSwitchPress, required List profiles}); + Future showFamilyBottomSheetWithoutHWithChild({String? label, required String message, Widget? child, required Function() onOkPressed, Function()? onCancelPressed}); + Future showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}); Future showAddFamilyFileSheet({String? label, String? message, required Function() onVerificationPress}); @@ -119,6 +121,18 @@ class DialogServiceImp implements DialogService { callBackFunc: () {}); } + @override + Future 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 Future showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}) async { final context = navigationService.navigatorKey.currentContext; diff --git a/lib/widgets/chip/app_custom_chip_widget.dart b/lib/widgets/chip/app_custom_chip_widget.dart index 38552fb..10b98bc 100644 --- a/lib/widgets/chip/app_custom_chip_widget.dart +++ b/lib/widgets/chip/app_custom_chip_widget.dart @@ -24,8 +24,8 @@ class AppCustomChipWidget extends StatelessWidget { this.deleteIconColor = AppColors.textColor, this.deleteIconHasColor = false, this.padding = EdgeInsets.zero, - this.onChipTap - this.labelPadding , + this.onChipTap, + this.labelPadding, }); final String? labelText; @@ -47,54 +47,58 @@ class AppCustomChipWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return ChipTheme( - data: ChipThemeData( - padding: EdgeInsets.all(0.0), - shape: SmoothRectangleBorder( - side: BorderSide( - width: 10.0, - color: Colors.transparent, // Crucially, set color to transparent - style: BorderStyle.none, + return GestureDetector( + onTap: onChipTap, + child: ChipTheme( + data: ChipThemeData( + padding: EdgeInsets.all(0.0), + shape: SmoothRectangleBorder( + side: BorderSide( + 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 - ? Chip( - 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), - // padding: EdgeInsets.all(0.0), - padding: padding, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - labelPadding: labelPadding??EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), - backgroundColor: backgroundColor, - shape: shape ?? - SmoothRectangleBorder( - borderRadius: BorderRadius.circular(8 ?? 0), - smoothness: 10, - side: BorderSide(color: AppColors.transparent, width: 1.5), - ), - 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, - ) - : Chip( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), - padding: EdgeInsets.all(0.0), - backgroundColor: backgroundColor, - shape: shape ?? SmoothRectangleBorder( - borderRadius: BorderRadius.circular(8 ?? 0), - smoothness: 10, - side: BorderSide(color: AppColors.transparent, width: 1.5), + child: icon.isNotEmpty + ? Chip( + 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), + // padding: EdgeInsets.all(0.0), + padding: padding, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + labelPadding: labelPadding ?? EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), + backgroundColor: backgroundColor, + shape: shape ?? + SmoothRectangleBorder( + borderRadius: BorderRadius.circular(8 ?? 0), + smoothness: 10, + side: BorderSide(color: AppColors.transparent, width: 1.5), + ), + 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, + ) + : Chip( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), + padding: EdgeInsets.all(0.0), + backgroundColor: backgroundColor, + shape: shape ?? + SmoothRectangleBorder( + borderRadius: BorderRadius.circular(8 ?? 0), + smoothness: 10, + 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, - ), + ), ); } }