|
|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
@ -20,14 +19,7 @@ import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class FamilyMedicalScreen extends StatefulWidget {
|
|
|
|
|
final List<FamilyFileResponseModelLists> profiles;
|
|
|
|
|
final Function(FamilyFileResponseModelLists) onSelect;
|
|
|
|
|
|
|
|
|
|
const FamilyMedicalScreen({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.profiles,
|
|
|
|
|
required this.onSelect,
|
|
|
|
|
});
|
|
|
|
|
const FamilyMedicalScreen({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<FamilyMedicalScreen> createState() => _FamilyMedicalScreenState();
|
|
|
|
|
@ -43,7 +35,6 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
medicalVM?.onFamilyFileTabChange(0);
|
|
|
|
|
medicalVM?.getAllPendingRecordsByResponseId();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -55,27 +46,28 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
title: LocaleKeys.familyTitle.tr(context: context),
|
|
|
|
|
bottomChild: appState.getAuthenticatedUser()!.isParentUser!
|
|
|
|
|
? Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
customBorder: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24)),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.addANewFamilyMember.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
DialogService dialogService = getIt.get<DialogService>();
|
|
|
|
|
medicalVM!.clearAuthValues();
|
|
|
|
|
dialogService.showAddFamilyFileSheet(
|
|
|
|
|
label: LocaleKeys.addFamilyMember.tr(context: context),
|
|
|
|
|
message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context),
|
|
|
|
|
onVerificationPress: () {
|
|
|
|
|
medicalVM!.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
icon: AppAssets.add_icon,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
fontWeight: FontWeight.w500)).paddingOnly(bottom: 20.h)
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
customBorder: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24)),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.addANewFamilyMember.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
DialogService dialogService = getIt.get<DialogService>();
|
|
|
|
|
medicalVM!.clearAuthValues();
|
|
|
|
|
dialogService.showAddFamilyFileSheet(
|
|
|
|
|
label: LocaleKeys.addFamilyMember.tr(context: context),
|
|
|
|
|
message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context),
|
|
|
|
|
onVerificationPress: () {
|
|
|
|
|
medicalVM!.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
icon: AppAssets.add_icon,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
fontWeight: FontWeight.w500))
|
|
|
|
|
.paddingOnly(bottom: 20.h)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
@ -96,18 +88,28 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
appState.isChildLoggedIn ? SizedBox() : SizedBox(height: 25.h),
|
|
|
|
|
Selector<MedicalFileViewModel, int>(selector: (_, model) => model.getSelectedFamilyFileTabIndex, builder: (context, selectedIndex, child) => getFamilyTabs(index: selectedIndex)),
|
|
|
|
|
Selector<MedicalFileViewModel, ({int selectedIndex, List<FamilyFileResponseModelLists> patientFiles, List<FamilyFileResponseModelLists> pendingFiles})>(
|
|
|
|
|
selector: (_, model) => (selectedIndex: model.getSelectedFamilyFileTabIndex, patientFiles: model.patientFamilyFiles, pendingFiles: model.pendingFamilyFiles),
|
|
|
|
|
shouldRebuild: (previous, next) {
|
|
|
|
|
return previous.selectedIndex != next.selectedIndex || previous.patientFiles.length != next.patientFiles.length || previous.pendingFiles.length != next.pendingFiles.length;
|
|
|
|
|
},
|
|
|
|
|
builder: (context, data, child) => getFamilyTabs(index: data.selectedIndex, patientFiles: data.patientFiles, pendingFiles: data.pendingFiles),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 20.h),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(20, 0),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getFamilyTabs({required int index}) {
|
|
|
|
|
Widget getFamilyTabs({
|
|
|
|
|
required int index,
|
|
|
|
|
required List<FamilyFileResponseModelLists> patientFiles,
|
|
|
|
|
required List<FamilyFileResponseModelLists> pendingFiles,
|
|
|
|
|
}) {
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
return FamilyCards(
|
|
|
|
|
profiles: medicalVM!.patientFamilyFiles,
|
|
|
|
|
profiles: patientFiles,
|
|
|
|
|
onSelect: (FamilyFileResponseModelLists profile) {
|
|
|
|
|
medicalVM!.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
|
|
|
|
|
},
|
|
|
|
|
@ -120,7 +122,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
);
|
|
|
|
|
case 1:
|
|
|
|
|
return FamilyCards(
|
|
|
|
|
profiles: medicalVM!.pendingFamilyFiles,
|
|
|
|
|
profiles: pendingFiles,
|
|
|
|
|
isRequestDesign: medicalVM!.getSelectedFamilyFileTabIndex == 1,
|
|
|
|
|
onSelect: (FamilyFileResponseModelLists profile) {
|
|
|
|
|
medicalVM!.acceptRejectFileFromFamilyMembers(id: profile.id, status: 3);
|
|
|
|
|
|