family screen add fixes & remove & switch & widgets

dev_aamir
aamir-csol 3 weeks ago
parent bf8f98ffb1
commit cd81372fc6

@ -59,6 +59,7 @@ class MedicalFileViewModel extends ChangeNotifier {
_selectedFamilyFileTabIndex = value; _selectedFamilyFileTabIndex = value;
notifyListeners(); notifyListeners();
} }
} }
static final DialogService _dialogService = getIt.get<DialogService>(); static final DialogService _dialogService = getIt.get<DialogService>();
@ -89,7 +90,6 @@ class MedicalFileViewModel extends ChangeNotifier {
void onFamilyFileTabChange(int index) { void onFamilyFileTabChange(int index) {
setSelectedFamilyFileTabIndex = index; setSelectedFamilyFileTabIndex = index;
notifyListeners();
} }
setIsPatientVaccineListLoading(bool isLoading) { setIsPatientVaccineListLoading(bool isLoading) {
@ -439,9 +439,6 @@ class MedicalFileViewModel extends ChangeNotifier {
); );
} }
Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum}) async { Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum}) async {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>();
@ -597,7 +594,7 @@ class MedicalFileViewModel extends ChangeNotifier {
getFamilyFiles(status: 0); getFamilyFiles(status: 0);
getAllPendingRecordsByResponseId(); getAllPendingRecordsByResponseId();
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
onFamilyFileTabChange(0); // onFamilyFileTabChange(0);
} }
}, },
); );

@ -114,8 +114,8 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
).onPress(() { ).onPress(() {
DialogService dialogService = getIt.get<DialogService>(); DialogService dialogService = getIt.get<DialogService>();
dialogService.showFamilyBottomSheetWithoutH( dialogService.showFamilyBottomSheetWithoutH(
label: "Who do you want to book for?".needTranslation, label: "Family Members".needTranslation,
message: "This clinic or doctor is only available for the below eligible profiles.".needTranslation, message: "Choose a profile to swithc family file.".needTranslation,
onSwitchPress: (FamilyFileResponseModelLists profile) { onSwitchPress: (FamilyFileResponseModelLists profile) {
medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
}, },

@ -46,7 +46,11 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
void initState() { void initState() {
super.initState(); super.initState();
medicalVM = context.read<MedicalFileViewModel>(); medicalVM = context.read<MedicalFileViewModel>();
WidgetsBinding.instance.addPostFrameCallback((_) {
medicalVM?.onFamilyFileTabChange(0);
});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -84,13 +88,17 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
children: [ children: [
appState.isChildLoggedIn appState.isChildLoggedIn
? SizedBox() ? SizedBox()
: CustomTabBar( : Selector<MedicalFileViewModel, int>(
activeBackgroundColor: AppColors.secondaryLightRedColor, selector: (_, model) => model.getSelectedFamilyFileTabIndex,
activeTextColor: AppColors.primaryRedColor, builder: (context, selectedIndex, child) => CustomTabBar(
tabs: [CustomTabBarModel(null, LocaleKeys.family.tr()), CustomTabBarModel(null, LocaleKeys.request.tr())], activeBackgroundColor: AppColors.secondaryLightRedColor,
onTabChange: (index) { activeTextColor: AppColors.primaryRedColor,
medicalVM!.onFamilyFileTabChange(index); // selectedIndex: selectedIndex,
}, tabs: [CustomTabBarModel(null, LocaleKeys.family.tr()), CustomTabBarModel(null, LocaleKeys.request.tr())],
onTabChange: (index) {
medicalVM!.onFamilyFileTabChange(index);
},
),
), ),
appState.isChildLoggedIn ? SizedBox() : SizedBox(height: 25.h), appState.isChildLoggedIn ? SizedBox() : SizedBox(height: 25.h),
Selector<MedicalFileViewModel, int>(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)), Selector<MedicalFileViewModel, int>(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)),
@ -118,7 +126,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
case 1: case 1:
return FamilyCards( return FamilyCards(
profiles: medicalVM!.pendingFamilyFiles, profiles: medicalVM!.pendingFamilyFiles,
isRequestDesign: true, isRequestDesign: medicalVM!.getSelectedFamilyFileTabIndex == 1,
onSelect: (FamilyFileResponseModelLists profile) { onSelect: (FamilyFileResponseModelLists profile) {
medicalVM!.acceptRejectFileFromFamilyMembers(id: profile.id, status: 3); medicalVM!.acceptRejectFileFromFamilyMembers(id: profile.id, status: 3);
}, },

@ -14,6 +14,7 @@ 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/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/app_custom_chip_widget.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';
class FamilyCards extends StatefulWidget { class FamilyCards extends StatefulWidget {
@ -88,9 +89,9 @@ class _FamilyCardsState extends State<FamilyCards> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
CustomChipWidget( AppCustomChipWidget(
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
@ -98,10 +99,10 @@ class _FamilyCardsState extends State<FamilyCards> {
: profile.status == FamilyFileEnum.active.toInt : profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor ? AppColors.lightGreenColor
: AppColors.lightGrayBGColor, : AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A", labelText: 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
@ -116,14 +117,14 @@ class _FamilyCardsState extends State<FamilyCards> {
.toText12(isBold: false, isCenter: false, maxLine: 1, fontWeight: FontWeight.w500, color: AppColors.greyTextColor), .toText12(isBold: false, isCenter: false, maxLine: 1, fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
]), ]),
SizedBox(height: 8.h), SizedBox(height: 8.h),
CustomChipWidget( AppCustomChipWidget(
height: 30.h, // height: 30.h,
chipType: ChipTypeEnum.alert, // chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.responseId ?? "N/A"}", labelText: "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),
], ],
), ),
@ -172,22 +173,22 @@ class _FamilyCardsState extends State<FamilyCards> {
SizedBox(height: 8.h), SizedBox(height: 8.h),
(profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), (profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
SizedBox(height: 8.h), SizedBox(height: 8.h),
CustomChipWidget( AppCustomChipWidget(
chipType: ChipTypeEnum.alert, // chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
chipText: "Relation:${profile.relationship ?? "N/A"}", labelText: "Relation:${profile.relationship ?? "N/A"}",
iconAsset: AppAssets.heart, icon: AppAssets.heart,
isShowBorder: false, // isShowBorder: false,
borderRadius: 8.h, // borderRadius: 8.h,
textColor: AppColors.textColor), textColor: AppColors.textColor),
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(), widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(),
widget.isShowDetails widget.isShowDetails
? CustomChipWidget( ? AppCustomChipWidget(
chipType: ChipTypeEnum.alert, // chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
chipText: "Age:${profile.age ?? "N/A"} Years", labelText: "Age:${profile.age ?? "N/A"} Years",
isShowBorder: false, // isShowBorder: false,
borderRadius: 8.h, // borderRadius: 8.h,
textColor: AppColors.textColor, textColor: AppColors.textColor,
) )
: SizedBox(), : SizedBox(),
@ -208,6 +209,7 @@ class _FamilyCardsState extends State<FamilyCards> {
textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor, textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor,
fontSize: 13.h, fontSize: 13.h,
icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user, icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user,
iconSize: 18.h,
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor, iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0), padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
).paddingOnly(top: 0, bottom: 0), ).paddingOnly(top: 0, bottom: 0),
@ -318,6 +320,7 @@ class _FamilyCardsState extends State<FamilyCards> {
backgroundColor: AppColors.lightGreenButtonColor, backgroundColor: AppColors.lightGreenButtonColor,
borderColor: AppColors.lightGreenButtonColor, borderColor: AppColors.lightGreenButtonColor,
textColor: AppColors.textGreenColor, textColor: AppColors.textGreenColor,
borderWidth: 0,
icon: null, icon: null,
), ),
), ),

@ -112,13 +112,21 @@ class DialogServiceImp implements DialogService {
if (context == null) return; if (context == null) return;
showCommonBottomSheetWithoutHeight(context, showCommonBottomSheetWithoutHeight(context,
title: label ?? "", title: label ?? "",
child: FamilyCards( child: Column(
profiles: profiles, crossAxisAlignment: CrossAxisAlignment.start,
onSelect: (FamilyFileResponseModelLists profile) { mainAxisAlignment: MainAxisAlignment.start,
onSwitchPress(profile); children: [
}, (message).toText16(isBold: false, color: AppColors.textColor),
onRemove: (FamilyFileResponseModelLists profile) {}, SizedBox(height: 24.h),
isShowDetails: false, FamilyCards(
profiles: profiles,
onSelect: (FamilyFileResponseModelLists profile) {
onSwitchPress(profile);
},
onRemove: (FamilyFileResponseModelLists profile) {},
isShowDetails: false,
),
],
), ),
callBackFunc: () {}); callBackFunc: () {});
} }

Loading…
Cancel
Save