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

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

@ -46,8 +46,12 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
void initState() {
super.initState();
medicalVM = context.read<MedicalFileViewModel>();
WidgetsBinding.instance.addPostFrameCallback((_) {
medicalVM?.onFamilyFileTabChange(0);
});
}
@override
Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>();
@ -84,14 +88,18 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
children: [
appState.isChildLoggedIn
? SizedBox()
: CustomTabBar(
: Selector<MedicalFileViewModel, int>(
selector: (_, model) => model.getSelectedFamilyFileTabIndex,
builder: (context, selectedIndex, child) => CustomTabBar(
activeBackgroundColor: AppColors.secondaryLightRedColor,
activeTextColor: AppColors.primaryRedColor,
// 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),
Selector<MedicalFileViewModel, int>(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)),
SizedBox(height: 20.h),
@ -118,7 +126,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
case 1:
return FamilyCards(
profiles: medicalVM!.pendingFamilyFiles,
isRequestDesign: true,
isRequestDesign: medicalVM!.getSelectedFamilyFileTabIndex == 1,
onSelect: (FamilyFileResponseModelLists profile) {
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/theme/colors.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';
class FamilyCards extends StatefulWidget {
@ -88,9 +89,9 @@ class _FamilyCardsState extends State<FamilyCards> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
AppCustomChipWidget(
// height: 30.h,
// chipType: ChipTypeEnum.alert,
backgroundColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.rejected.toInt
@ -98,10 +99,10 @@ class _FamilyCardsState extends State<FamilyCards> {
: profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor
: AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
labelText: profile.statusDescription ?? "N/A",
// iconAsset: null,
// isShowBorder: false,
// borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor
: 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),
]),
SizedBox(height: 8.h),
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
AppCustomChipWidget(
// height: 30.h,
// chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.responseId ?? "N/A"}",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
labelText: "Medical File: ${profile.responseId ?? "N/A"}",
// iconAsset: null,
// isShowBorder: false,
// borderRadius: 8.h,
textColor: AppColors.textColor),
],
),
@ -172,22 +173,22 @@ class _FamilyCardsState extends State<FamilyCards> {
SizedBox(height: 8.h),
(profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
SizedBox(height: 8.h),
CustomChipWidget(
chipType: ChipTypeEnum.alert,
AppCustomChipWidget(
// chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Relation:${profile.relationship ?? "N/A"}",
iconAsset: AppAssets.heart,
isShowBorder: false,
borderRadius: 8.h,
labelText: "Relation:${profile.relationship ?? "N/A"}",
icon: AppAssets.heart,
// isShowBorder: false,
// borderRadius: 8.h,
textColor: AppColors.textColor),
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(),
widget.isShowDetails
? CustomChipWidget(
chipType: ChipTypeEnum.alert,
? AppCustomChipWidget(
// chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Age:${profile.age ?? "N/A"} Years",
isShowBorder: false,
borderRadius: 8.h,
labelText: "Age:${profile.age ?? "N/A"} Years",
// isShowBorder: false,
// borderRadius: 8.h,
textColor: AppColors.textColor,
)
: SizedBox(),
@ -208,6 +209,7 @@ class _FamilyCardsState extends State<FamilyCards> {
textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor,
fontSize: 13.h,
icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user,
iconSize: 18.h,
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
).paddingOnly(top: 0, bottom: 0),
@ -318,6 +320,7 @@ class _FamilyCardsState extends State<FamilyCards> {
backgroundColor: AppColors.lightGreenButtonColor,
borderColor: AppColors.lightGreenButtonColor,
textColor: AppColors.textGreenColor,
borderWidth: 0,
icon: null,
),
),

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

Loading…
Cancel
Save