family file work-in-progress

pull/56/head
Sultan khan 1 month ago
parent 467f10e952
commit 5ce7548656

@ -254,4 +254,34 @@ class MedicalFileViewModel extends ChangeNotifier {
);
}
Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await medicalFileRepo.getPatientFamilyFiles();
result.fold(
(failure) async => await errorHandlerService.handleError(
failure: failure,
onOkPressed: () {
onError!(failure.message);
},
),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
_dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
patientFamilyFiles = apiResponse.data!;
patientFamilyFiles.insert(0,
FamilyFileResponseModelLists(patientId: _appState.getAuthenticatedUser()!.patientId, patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', isActive: true, gender:_appState.getAuthenticatedUser()!.gender!, responseId: _appState.getAuthenticatedUser()!.patientId ),
);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}

@ -31,16 +31,16 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"Please select a profile",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 6),
const Text(
"Switch from the below list of medical file",
style: TextStyle(fontSize: 14, color: Colors.grey),
textAlign: TextAlign.center,
),
// const Text(
// "Please select a profile",
// style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
// ),
// const SizedBox(height: 6),
// const Text(
// "Switch from the below list of medical file",
// style: TextStyle(fontSize: 14, color: Colors.grey),
// textAlign: TextAlign.center,
// ),
const SizedBox(height: 20),
// GridView inside scroll
@ -108,8 +108,9 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
text: 'Active',
backgroundColor: Colors.grey.shade200,
borderColor: Colors.grey.shade200,
textColor: Colors.black,
textColor: AppColors.greyTextColor,
fontSize: 13,
).paddingOnly(top: 8, bottom: 4)
else
CustomButton(

@ -1,13 +1,20 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/utils.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/theme/colors.dart';
import '../common_bottom_sheet.dart';
import 'my_Family.dart';
class MyFamilySheet {
static void show(BuildContext context, List<FamilyFileResponseModelLists> familyLists, Function(FamilyFileResponseModelLists) onSelect) {
showCommonBottomSheetWithoutHeight(
context,
title: 'Select Profile',
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),
],),
child: ProfileSelector(profiles: familyLists, onSelect: (profile) {

Loading…
Cancel
Save