From 27a0632d6d062368b295a2bad55494e29c297eab Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Mon, 22 Sep 2025 16:18:11 +0300 Subject: [PATCH 1/4] directional padding and alignment --- lib/extensions/widget_extensions.dart | 2 +- .../widgets/region_bottomsheet/region_list_item.dart | 2 +- lib/widgets/chip/app_custom_chip_widget.dart | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 26a1442..e2df742 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -22,7 +22,7 @@ extension WidgetExtensions on Widget { Widget paddingSymmetrical(double horizontal, double vertical) => Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this); Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => - Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this); + Padding(padding: EdgeInsetsDirectional.only(start: left, end: right, top: top, bottom: bottom), child: this); Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this); diff --git a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart index 64263de..ab9cd9b 100644 --- a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart +++ b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart @@ -77,7 +77,7 @@ class RegionListItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Align( - alignment: Alignment.centerLeft, + alignment: AlignmentDirectional.centerStart, child: Text( title, style: TextStyle( diff --git a/lib/widgets/chip/app_custom_chip_widget.dart b/lib/widgets/chip/app_custom_chip_widget.dart index b29f6e6..a6e1817 100644 --- a/lib/widgets/chip/app_custom_chip_widget.dart +++ b/lib/widgets/chip/app_custom_chip_widget.dart @@ -72,9 +72,9 @@ class AppCustomChipWidget extends StatelessWidget { // padding: EdgeInsets.all(0.0), padding: padding, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - labelPadding: EdgeInsets.only( - left: -4.h, - right: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), + labelPadding: EdgeInsetsDirectional.only( + start: -4.h, + end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), backgroundColor: backgroundColor, shape: shape, deleteIcon: deleteIcon?.isNotEmpty == true @@ -96,9 +96,9 @@ class AppCustomChipWidget extends StatelessWidget { padding: EdgeInsets.all(0.0), backgroundColor: backgroundColor, shape: shape, - labelPadding: EdgeInsets.only( - left: 8.h, - right: deleteIcon?.isNotEmpty == true ? -2.h : 8.h), + labelPadding: EdgeInsetsDirectional.only( + start: 8.h, + end: deleteIcon?.isNotEmpty == true ? -2.h : 8.h), deleteIcon: deleteIcon?.isNotEmpty == true ? Utils.buildSvgWithAssets( icon: deleteIcon!, From 7093a26cb8d19ebd973509d40d63ccce2b8c763a Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Mon, 22 Sep 2025 16:18:27 +0300 Subject: [PATCH 2/4] selection region arabic handling --- assets/langs/ar-SA.json | 3 ++- assets/langs/en-US.json | 3 ++- .../book_appointments_view_model.dart | 7 +----- .../appointment_via_region_viewmodel.dart | 6 ++++- lib/generated/locale_keys.g.dart | 1 + lib/main.dart | 4 ++-- .../facility_type_selection_widget.dart | 18 +++++++++------ .../hospital_bottom_sheet_body.dart | 2 +- .../book_appointment_page.dart | 22 +++++++++++++++---- 9 files changed, 43 insertions(+), 23 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 19111f7..412dfc1 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -849,6 +849,7 @@ "pleaseEnterEmail": "يرجى إدخال البريد الإلكتروني", "pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح", "selectCountry": "اختر الدولة", - "forLoginVerification": "للتحقق من تسجيل الدخول" + "forLoginVerification": "للتحقق من تسجيل الدخول", + "searchHospital": "بحث في المستشفى" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 27609c8..9ecb447 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -845,5 +845,6 @@ "pleaseEnterAValidEmailFormat": "Please enter a valid email format", "selectCountry": "Select Country", "forLoginVerification": "for login verification", - "lastLoginBy": "Last login by" + "lastLoginBy": "Last login by", + "searchHospital": "Search Hospital" } \ No newline at end of file diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index b9750d8..6488dd8 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -414,11 +414,6 @@ class BookAppointmentsViewModel extends ChangeNotifier { } Future getRegionMappedProjectList() async { - //todo handle the case in the location is switch on - // if(hospitalList != null && hospitalList!.registeredDoctorMap != null && hospitalList!.registeredDoctorMap!.isNotEmpty){ - // filteredHospitalList = hospitalList; - // return; - // } isRegionListLoading = true; notifyListeners(); final result = await bookAppointmentsRepo.getProjectList(); @@ -432,7 +427,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } else if (apiResponse.messageStatus == 1) { var projectList = apiResponse.data!; hospitalList = await DoctorMapper.getMappedHospitals(projectList, - isArabic: false, + isArabic: _appState.isArabic(), lat: _appState.userLat, lng: _appState.userLong, ); diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart index 1525280..4829f17 100644 --- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart +++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart @@ -1,4 +1,5 @@ import 'package:flutter/foundation.dart' show ChangeNotifier; +import 'package:hmg_patient_app_new/core/app_state.dart' show AppState; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; @@ -20,8 +21,9 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { final NavigationService navigationService; AppointmentViaRegionState bottomSheetState = AppointmentViaRegionState.REGION_SELECTION; + final AppState appState; - AppointmentViaRegionViewmodel({required this.navigationService}); + AppointmentViaRegionViewmodel({required this.navigationService,required this.appState}); void setSelectedRegionId(String? regionId) { selectedRegionId = regionId; @@ -69,4 +71,6 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { void setHospitalModel(PatientDoctorAppointmentList? hospital) { selectedHospital = hospital; } + + bool get isArabic => appState.isArabic(); } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index a452959..3d12e5b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -848,5 +848,6 @@ abstract class LocaleKeys { static const pleaseEnterAValidEmailFormat = 'pleaseEnterAValidEmailFormat'; static const selectCountry = 'selectCountry'; static const forLoginVerification = 'forLoginVerification'; + static const searchHospital = 'searchHospital'; } diff --git a/lib/main.dart b/lib/main.dart index 6abde55..bdd1f29 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -147,8 +147,8 @@ void main() async { ), ), ChangeNotifierProvider( - create: (_) => - AppointmentViaRegionViewmodel(navigationService: getIt())) + create: (_) => AppointmentViaRegionViewmodel( + navigationService: getIt(), appState: getIt())) ], child: MyApp()), ), ); diff --git a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart index e1ff677..cacc9d3 100644 --- a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart @@ -38,7 +38,7 @@ class FacilityTypeSelectionWidget extends StatelessWidget { ), ), Text( - LocaleKeys.selectFacilitiesSubTitle, + LocaleKeys.selectFacilitiesSubTitle.tr(), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, @@ -55,9 +55,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget { }), ).onPress( () { - regionalViewModel.setFacility(FacilitySelection.HMG.name); - regionalViewModel.setBottomSheetState( - AppointmentViaRegionState.HOSPITAL_SELECTION); + if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmgSize != 0) { + regionalViewModel.setFacility(FacilitySelection.HMG.name); + regionalViewModel.setBottomSheetState( + AppointmentViaRegionState.HOSPITAL_SELECTION); + } }, ), SizedBox(height: 16.h), @@ -69,9 +71,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget { "${bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize ?? 0}" })).onPress( () { - regionalViewModel.setFacility(FacilitySelection.HMC.name); - regionalViewModel.setBottomSheetState( - AppointmentViaRegionState.HOSPITAL_SELECTION); + if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize!= 0 ) { + regionalViewModel.setFacility(FacilitySelection.HMC.name); + regionalViewModel.setBottomSheetState( + AppointmentViaRegionState.HOSPITAL_SELECTION); + } }, ), ], diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart index 8159abd..43ce9c6 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart @@ -50,7 +50,7 @@ class HospitalBottomSheetBody extends StatelessWidget { SizedBox(height: 16.h), TextInputWidget( labelText: LocaleKeys.search.tr(), - hintText: "Search Hospital".tr(), + hintText: LocaleKeys.searchHospital.tr(), controller: searchText, onChange: (value) { appointmentsViewModel.filterHospitalListByString(value, regionalViewModel.selectedRegionId , regionalViewModel.selectedFacilityType == diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index bb659c4..140b593 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -200,7 +200,11 @@ class _BookAppointmentPageState extends State { void openRegionListBottomSheet(BuildContext context) { regionalViewModel.flush(); // AppointmentViaRegionViewmodel? viewmodel = null; - showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer(builder: (_, data, __) => getTitle(data)), isDismissible: false, + showCommonBottomSheetWithoutHeight(context, + title: "", + titleWidget: Consumer( + builder: (_, data, __) => getTitle(data)), + isDismissible: false, child: Consumer(builder: (_, data, __) { return getRegionalSelectionWidget(data); }), callBackFunc: () {}); @@ -234,9 +238,19 @@ class _BookAppointmentPageState extends State { if (data.selectedRegionId == null) { return LocaleKeys.selectRegion.tr().toText20(weight: FontWeight.w600); } else { - return Utils.buildSvgWithAssets(icon: AppAssets.arrow_back, iconColor: Color(0xff2B353E)).onPress(() { - data.handleBackPress(); - }); + return + Transform.flip( + flipX: data.isArabic ? true : false, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + + fit: BoxFit.contain, + ), + ).onPress(() { + data.handleBackPress(); + }); + } } } From 6d85227f118215c3fed91e2fef1ce2857e2528f5 Mon Sep 17 00:00:00 2001 From: Sultan khan Date: Mon, 22 Sep 2025 17:22:56 +0300 Subject: [PATCH 3/4] lab order by test --- assets/langs/ar-SA.json | 2 +- assets/langs/en-US.json | 2 +- lib/core/api_consts.dart | 2 +- lib/features/lab/lab_view_model.dart | 18 +++- .../patient_lab_orders_response_model.dart | 6 +- lib/presentation/lab/lab_order_by_test.dart | 84 +++++++++++++++ lib/presentation/lab/lab_orders_page.dart | 100 ++++++++++++------ 7 files changed, 176 insertions(+), 38 deletions(-) create mode 100644 lib/presentation/lab/lab_order_by_test.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 19111f7..e824ca2 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -126,7 +126,7 @@ "gregorianDate": "التاريخ الميلادي", "verifyLoginWith": "يرجى اختيار واحدة من الخيارات التالية للتحقق", "registerUser": "تسجيل", - "verifyWithFingerprint": "بصمة الإصبع", + "verifyWithFingerprint":"البيومترية", "verifyWithFaceid": "معرف الوجه", "verifyWithSms": "رسالة قصيرة", "verifyWithWhatsapp": "واتساب", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index b559b3b..86a4c25 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -126,7 +126,7 @@ "gregorianDate": "Gregorian Date", "verifyLoginWith": "Please choose one of the following options to verify", "registerUser": "Register", - "verifyWithFingerprint": "Fingerprint", + "verifyWithFingerprint": "Biometric", "verifyWithFaceid": "Face ID", "verifyWithSms": "SMS", "verifyWithWhatsapp": "Whatsapp", diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index fa02b2e..5886dfa 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/features/lab/lab_view_model.dart b/lib/features/lab/lab_view_model.dart index 2e481f4..29b90f8 100644 --- a/lib/features/lab/lab_view_model.dart +++ b/lib/features/lab/lab_view_model.dart @@ -17,6 +17,8 @@ class LabViewModel extends ChangeNotifier { List get labSuggestions => _labSuggestionsList; + Set uniqueTests = {}; + LabViewModel({required this.labRepo, required this.errorHandlerService}); initLabProvider() { @@ -32,8 +34,8 @@ class LabViewModel extends ChangeNotifier { final result = await labRepo.getPatientLabOrders(); result.fold( - (failure) async => await errorHandlerService.handleError(failure: failure), - (apiResponse) { + (failure) async => await errorHandlerService.handleError(failure: failure), + (apiResponse) { if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { @@ -43,6 +45,7 @@ class LabViewModel extends ChangeNotifier { isLabOrdersLoading = false; isLabResultsLoading = false; filterSuggestions(); + getUniqueTestDescription(); notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -75,4 +78,15 @@ class LabViewModel extends ChangeNotifier { } notifyListeners(); } + + getUniqueTestDescription() { + + uniqueTests = { + for (var item in patientLabOrders) + if (item.testDetails != null) + ...?item.testDetails?.map((test) => + TestDetails(description: test.description.toString(), testCode: test.testCode.toString(), testID: test.testID, createdOn: item.createdOn)) + }; + uniqueTests.forEach(print); + } } diff --git a/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart b/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart index 11bf573..265a19e 100644 --- a/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart +++ b/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart @@ -226,13 +226,14 @@ class TestDetails { String? description; String? testCode; String? testID; - - TestDetails({this.description, this.testCode, this.testID}); + String? createdOn; + TestDetails({this.description, this.testCode, this.testID, this.createdOn}); TestDetails.fromJson(Map json) { description = json['Description']; testCode = json['TestCode']; testID = json['TestID']; + createdOn = json['CreatedOn']; } Map toJson() { @@ -240,6 +241,7 @@ class TestDetails { data['Description'] = this.description; data['TestCode'] = this.testCode; data['TestID'] = this.testID; + data['CreatedOn'] = this.createdOn; return data; } } diff --git a/lib/presentation/lab/lab_order_by_test.dart b/lib/presentation/lab/lab_order_by_test.dart new file mode 100644 index 0000000..40e92c4 --- /dev/null +++ b/lib/presentation/lab/lab_order_by_test.dart @@ -0,0 +1,84 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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 LabOrderByTest extends StatelessWidget { + final VoidCallback onTap; + final int index; + final TestDetails? tests; + final bool isLoading; + final bool isExpanded; + + const LabOrderByTest({super.key, required this.onTap, this.tests, required this.index, this.isLoading = false, this.isExpanded = false}); + + @override + build(BuildContext context) { + return AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + margin: EdgeInsets.symmetric(vertical: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), + child: InkWell( + onTap: () { + if (!isLoading) { + onTap(); + } + }, + child: Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ...labOrder!.testDetails!.map((detail) { + Padding( + padding: EdgeInsets.only(bottom: 8.h), + child: '${tests!.description}'.toText14(weight: FontWeight.w500), + ), + + SizedBox(height: 12.h), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppCustomChipWidget( + richText: '${"Last Lasted:".needTranslation} ${ DateUtil.formatDateToDate(DateUtil.convertStringToDate(tests!.createdOn), false)}'.toText12(isBold: true), + // chipType: ChipTypeEnum.lightBg, + backgroundColor: AppColors.greyLightColor, + textColor: AppColors.textColor, + // borderRadius: 5, + + ), + CustomButton( + icon: AppAssets.view_report_icon, + iconColor: AppColors.primaryRedColor, + iconSize: 16.h, + text: LocaleKeys.viewReport.tr(context: context), + onPressed: () {}, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 14, + fontWeight: FontWeight.bold, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ), + ], + ), + ))); + } +} diff --git a/lib/presentation/lab/lab_orders_page.dart b/lib/presentation/lab/lab_orders_page.dart index 0e14565..3d7edb9 100644 --- a/lib/presentation/lab/lab_orders_page.dart +++ b/lib/presentation/lab/lab_orders_page.dart @@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/lab/lab_order_by_test.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -32,7 +33,7 @@ class _LabOrdersPageState extends State { List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; - + int activeIndex = 0; @override void initState() { scheduleMicrotask(() { @@ -78,7 +79,10 @@ class _LabOrdersPageState extends State { // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { - // myAppointmentsViewModel.onTabChange(index); + activeIndex = index; + setState(() { + + }); }, ), SizedBox(height: 16.h), @@ -89,39 +93,73 @@ class _LabOrdersPageState extends State { isSelected: true, ) : SizedBox(), - ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - itemCount: model.isLabOrdersLoading ? 5 : model.patientLabOrders.length, - itemBuilder: (context, index) { - final isExpanded = expandedIndex == index; - return model.isLabOrdersLoading - ? LabResultItemView( + activeIndex == 0 + ? ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: model.isLabOrdersLoading ? 5 : model.patientLabOrders.length, + itemBuilder: (context, index) { + final isExpanded = expandedIndex == index; + return model.isLabOrdersLoading + ? LabResultItemView( + onTap: () {}, + labOrder: null, + index: index, + isLoading: true, + ) + : AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 500), + child: SlideAnimation( + verticalOffset: 100.0, + child: FadeInAnimation( + child: LabResultItemView( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + labOrder: model.patientLabOrders[index], + index: index, + isExpanded: isExpanded)), + ), + ); + }, + ) + : ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: model.isLabOrdersLoading ? 5 :model.uniqueTests.toList().length, + itemBuilder: (context, index) { + final isExpanded = expandedIndex == index; + return model.isLabOrdersLoading + ? LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, - ) - : AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 500), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: LabResultItemView( - onTap: () { - setState(() { - expandedIndex = isExpanded ? null : index; - }); - }, - labOrder: model.patientLabOrders[index], - index: index, - isExpanded: isExpanded)), - ), - ); - }, - ), + ) : AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 500), + child: SlideAnimation( + verticalOffset: 100.0, + child: FadeInAnimation( + child: LabOrderByTest( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + tests: model.uniqueTests.toList()[index], + index: index, + isExpanded: isExpanded)), + ), + ); + + }, + ) ], ); }, From 12447cdafb84a7ddf168d372b4856ba4ad37dcbe Mon Sep 17 00:00:00 2001 From: Sultan khan Date: Mon, 22 Sep 2025 17:32:53 +0300 Subject: [PATCH 4/4] no message --- lib/presentation/lab/lab_order_by_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/presentation/lab/lab_order_by_test.dart b/lib/presentation/lab/lab_order_by_test.dart index 40e92c4..e5c6929 100644 --- a/lib/presentation/lab/lab_order_by_test.dart +++ b/lib/presentation/lab/lab_order_by_test.dart @@ -53,7 +53,7 @@ class LabOrderByTest extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget( - richText: '${"Last Lasted:".needTranslation} ${ DateUtil.formatDateToDate(DateUtil.convertStringToDate(tests!.createdOn), false)}'.toText12(isBold: true), + richText: '${"Last Tested:".needTranslation} ${ DateUtil.formatDateToDate(DateUtil.convertStringToDate(tests!.createdOn), false)}'.toText12(isBold: true), // chipType: ChipTypeEnum.lightBg, backgroundColor: AppColors.greyLightColor, textColor: AppColors.textColor,