diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart index 5ffb52e..e640769 100644 --- a/lib/features/medical_file/medical_file_view_model.dart +++ b/lib/features/medical_file/medical_file_view_model.dart @@ -254,4 +254,34 @@ class MedicalFileViewModel extends ChangeNotifier { ); } + + + Future 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); + } + } + }, + ); + } + } diff --git a/lib/widgets/my_family/my_Family.dart b/lib/widgets/my_family/my_Family.dart index 2bcdf1a..43295ae 100644 --- a/lib/widgets/my_family/my_Family.dart +++ b/lib/widgets/my_family/my_Family.dart @@ -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( diff --git a/lib/widgets/my_family/my_family_sheet.dart b/lib/widgets/my_family/my_family_sheet.dart index 9c2ce38..37ad5af 100644 --- a/lib/widgets/my_family/my_family_sheet.dart +++ b/lib/widgets/my_family/my_family_sheet.dart @@ -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 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) {