|
|
|
|
@ -16,6 +16,7 @@ import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class FamilyMedicalScreen extends StatefulWidget {
|
|
|
|
|
@ -32,9 +33,15 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
medicalVM = context.read<MedicalFileViewModel>();
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
if(medicalVM!.isFamilyFilesLoading) {
|
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
|
} else {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
}
|
|
|
|
|
medicalVM?.onFamilyFileTabChange(0);
|
|
|
|
|
medicalVM?.getAllPendingRecordsByResponseId();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -90,14 +97,22 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
),
|
|
|
|
|
appState.isChildLoggedIn ? SizedBox() : SizedBox(height: 25.h),
|
|
|
|
|
Selector<MedicalFileViewModel, ({int selectedIndex, List<FamilyFileResponseModelLists> patientFiles, List<FamilyFileResponseModelLists> pendingFiles})>(
|
|
|
|
|
selector: (_, model) => (selectedIndex: model.getSelectedFamilyFileTabIndex, patientFiles: model.patientFamilyFiles, pendingFiles: model.pendingFamilyFiles),
|
|
|
|
|
selector: (_, model) => (
|
|
|
|
|
selectedIndex: model.getSelectedFamilyFileTabIndex,
|
|
|
|
|
patientFiles: model.patientFamilyFiles,
|
|
|
|
|
pendingFiles: model.pendingFamilyFiles,
|
|
|
|
|
),
|
|
|
|
|
shouldRebuild: (previous, next) {
|
|
|
|
|
// Only rebuild if something actually changed
|
|
|
|
|
return previous.selectedIndex != next.selectedIndex ||
|
|
|
|
|
!identical(previous.patientFiles, next.patientFiles) ||
|
|
|
|
|
!identical(previous.pendingFiles, next.pendingFiles);
|
|
|
|
|
},
|
|
|
|
|
builder: (context, data, child) => getFamilyTabs(index: data.selectedIndex, patientFiles: data.patientFiles, pendingFiles: data.pendingFiles),
|
|
|
|
|
builder: (context, data, child) => getFamilyTabs(
|
|
|
|
|
index: data.selectedIndex,
|
|
|
|
|
patientFiles: data.patientFiles,
|
|
|
|
|
pendingFiles: data.pendingFiles,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 20.h),
|
|
|
|
|
],
|
|
|
|
|
@ -112,6 +127,7 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
|
|
|
|
|
}) {
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
|
|
return FamilyCards(
|
|
|
|
|
profiles: patientFiles,
|
|
|
|
|
onSelect: (FamilyFileResponseModelLists profile) {
|
|
|
|
|
|