dev_sultan #140

Merged
Haroon6138 merged 5 commits from dev_sultan into master 2 weeks ago

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 13C4 8.58172 7.58172 5 12 5C16.4183 5 20 8.58172 20 13C20 13.5523 20.4477 14 21 14C21.5523 14 22 13.5523 22 13C22 7.47715 17.5228 3 12 3C6.47715 3 2 7.47715 2 13C2 13.5523 2.44772 14 3 14C3.55228 14 4 13.5523 4 13Z" fill="#D48D05"/>
<path d="M12 9C12.5523 9 13 9.44772 13 10L13 15.1707C14.1652 15.5825 15 16.6938 15 18C15 19.6569 13.6569 21 12 21C10.3431 21 9 19.6569 9 18C9 16.6938 9.83481 15.5825 11 15.1707L11 10C11 9.44772 11.4477 9 12 9Z" fill="#D48D05"/>
</svg>

After

Width:  |  Height:  |  Size: 576 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.1 KiB

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19.8271 3.35515C16.8461 1.52662 14.1719 2.25537 12.5563 3.46861C12.4618 3.5396 12.3778 3.60261 12.3027 3.6585C12.1487 3.77312 12.0717 3.83043 11.9724 3.83043C11.873 3.83043 11.796 3.77312 11.642 3.6585C11.5669 3.60262 11.4829 3.5396 11.3884 3.46861C9.77284 2.25537 7.09861 1.52662 4.11763 3.35515C2.63347 4.26554 1.61665 5.88968 1.31555 7.86051C1.27161 8.14807 1.24965 8.29185 1.33944 8.39639C1.42923 8.50094 1.58234 8.50092 1.88856 8.50089L5.14448 8.50059C5.55656 8.49886 6.25061 8.49594 6.92509 8.74131C7.18957 8.83753 7.42861 8.9636 7.64109 9.10184C7.94838 9.30175 8.10203 9.40171 8.22623 9.37305C8.35044 9.34439 8.43459 9.20413 8.60289 8.92363L9.32823 7.71474C9.78963 6.94573 10.6276 6.48278 11.5242 6.50152C12.4208 6.52027 13.2387 7.01784 13.6676 7.80546L14.9648 10.1879C15.0479 10.3405 15.0895 10.4168 15.1603 10.4589C15.2311 10.501 15.318 10.501 15.4918 10.501H15.972C17.3527 10.501 18.472 11.6203 18.472 13.001C18.472 14.3817 17.3527 15.501 15.972 15.501L14.8556 15.5031C14.4407 15.5127 13.1951 15.5415 12.106 14.705C12.0741 14.6805 12.0429 14.6555 12.0124 14.6302C11.6751 14.3499 11.5064 14.2097 11.3704 14.2328C11.2345 14.2559 11.1366 14.419 10.9409 14.7453L10.6157 15.2872C10.1827 16.0089 9.41568 16.4642 8.5748 16.4989C7.73393 16.5335 6.93207 16.1427 6.44122 15.4591L5.21484 13.7511C5.12681 13.6285 5.0828 13.5672 5.01833 13.5341C4.95385 13.501 4.87839 13.501 4.72747 13.501L3.23319 13.501C2.80205 13.501 2.58648 13.501 2.49975 13.6503C2.41302 13.7997 2.51637 13.9808 2.72307 14.3432C3.7896 16.2127 5.46319 18.1083 7.86568 19.8865C9.31705 20.9614 10.3823 21.7503 11.9723 21.7503C13.5624 21.7503 14.6276 20.9614 16.079 19.8865C20.2586 16.7929 22.2322 13.3443 22.6412 10.2951C23.0481 7.2606 21.8883 4.61952 19.8271 3.35515Z" fill="#18C273"/>
<path d="M12.3509 8.5218C12.1794 8.20675 11.8522 8.00772 11.4936 8.00022C11.1349 7.99272 10.7997 8.1779 10.6152 8.48551L8.39777 12.1812L7.72833 11.2488C7.71432 11.2293 7.69962 11.2103 7.68425 11.1919C7.66865 11.1731 7.65154 11.1522 7.63294 11.1295C7.4192 10.8684 7.00838 10.3666 6.41298 10.15C5.9948 9.99782 5.53719 9.99883 5.08287 9.99984L4.97266 10L2.97266 10C2.42037 10 1.97266 10.4477 1.97266 11C1.97266 11.5523 2.42037 12 2.97266 12H4.97266C5.60991 12 5.68621 12.0141 5.72762 12.0289C5.73136 12.0307 5.76392 12.0476 5.83105 12.1122C5.91437 12.1924 5.9964 12.2905 6.12473 12.4445L7.66036 14.5832C7.8567 14.8567 8.17744 15.013 8.51379 14.9992C8.85014 14.9853 9.15695 14.8032 9.33015 14.5145L11.4306 11.0138L12.2854 12.5838C12.295 12.6013 12.305 12.6186 12.3156 12.6356L12.3573 12.7026C12.5191 12.9635 12.7156 13.2804 13.0204 13.5144C13.6863 14.0259 14.4768 14.0096 14.863 14.0016C14.9044 14.0008 14.9412 14 14.9727 14H15.9727C16.5249 14 16.9727 13.5523 16.9727 13C16.9727 12.4477 16.5249 12 15.9727 12H14.9727C14.9119 12 14.8581 12.0003 14.8096 12.0005C14.6334 12.0015 14.5272 12.002 14.416 11.9872C14.3192 11.9743 14.276 11.9545 14.248 11.9352C14.2434 11.9296 14.2355 11.9197 14.2239 11.9037C14.1807 11.8444 14.1277 11.7611 14.0275 11.601L12.3509 8.5218Z" fill="#18C273"/>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.083 8.3418C16.1804 8.26933 16.3034 8.26171 16.4092 8.32129C16.4449 8.34147 16.4818 8.37722 16.5537 8.44922C18.2206 9.92249 19.4021 12.5001 18.3545 14.9922C18.0491 15.7186 17.3429 16.2001 16.5498 16.2002L16.2725 16.1982C16.045 16.1964 15.9309 16.1958 15.8486 16.2598C15.7666 16.3238 15.7397 16.4344 15.6855 16.6553L14.7207 20.5879C14.4117 21.8473 13.2957 22.7461 11.998 22.7461C10.7005 22.746 9.5844 21.8473 9.27539 20.5879L8.31152 16.6553C8.25731 16.4342 8.2297 16.3238 8.14746 16.2598C8.06513 16.1957 7.95135 16.1964 7.72363 16.1982L7.44727 16.2002C6.6541 16.2002 5.94699 15.7187 5.6416 14.9922C4.59407 12.5 5.77638 9.92243 7.44336 8.44922C7.51481 8.37768 7.55044 8.34145 7.58594 8.32129C7.69173 8.26141 7.81555 8.26931 7.91309 8.3418C7.94584 8.36621 7.98081 8.41097 8.0498 8.5C8.14907 8.62808 8.25089 8.75011 8.35254 8.86426C8.78359 9.34823 9.29846 9.79001 9.86914 10.124C10.4188 10.4457 11.1568 10.7461 11.998 10.7461C12.8393 10.7461 13.5773 10.4457 14.127 10.124C14.6976 9.79001 15.2125 9.34823 15.6436 8.86426C15.7452 8.75013 15.847 8.62806 15.9463 8.5C16.0154 8.41081 16.0502 8.36627 16.083 8.3418ZM12 1.25C14.0711 1.25 15.75 2.92893 15.75 5C15.75 6.07361 15.1945 7.1188 14.5254 7.87012C14.1835 8.25405 13.7876 8.58923 13.3711 8.83301C12.9615 9.07273 12.4873 9.25 12 9.25C11.5127 9.25 11.0385 9.07273 10.6289 8.83301C10.2124 8.58923 9.81654 8.25405 9.47461 7.87012C8.80554 7.1188 8.25 6.07361 8.25 5C8.25 2.92893 9.92893 1.25 12 1.25Z" fill="#0B85F7"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.9999 3.125C10.9999 2.57272 11.4476 2.125 11.9999 2.125C12.5522 2.125 12.9999 2.57272 12.9999 3.125V5.25648L13.6002 5.6567C13.6063 5.64329 13.6125 5.62994 13.6188 5.61666C13.7792 5.27762 14.0126 4.95992 14.3466 4.72784C14.6864 4.4917 15.0865 4.375 15.5234 4.375C17.3868 4.375 19.2054 5.74706 20.5136 7.78194C21.844 9.8515 22.75 12.745 22.75 16.125C22.75 18.5571 21.9318 20.0447 20.8453 20.9014C19.7942 21.7302 18.6097 21.875 18.0144 21.875C16.8144 21.875 15.5948 21.6036 14.6787 20.7304C13.7563 19.8512 13.2788 18.4938 13.2788 16.625C13.2842 16.2851 13.3181 15.4637 13.4101 14.8979C13.5229 14.0671 13.7417 12.9986 14.1873 12.0938C13.709 10.979 13.3028 9.33793 13.2548 7.89942C13.254 7.87588 13.2533 7.85231 13.2527 7.82873L11.9999 6.99352L10.7473 7.82858C10.7467 7.85222 10.746 7.87583 10.7452 7.89942C10.6973 9.33793 10.291 10.979 9.81277 12.0938C10.2583 12.9986 10.4772 14.0671 10.5899 14.8979C10.682 15.4637 10.7158 16.2851 10.7213 16.625C10.7213 18.4938 10.2438 19.8512 9.32137 20.7304C8.40522 21.6036 7.18561 21.875 5.98563 21.875C5.39035 21.875 4.20581 21.7302 3.15476 20.9014C2.06825 20.0447 1.25 18.5571 1.25 16.125C1.25 12.745 2.15607 9.8515 3.48648 7.78194C4.79459 5.74706 6.61322 4.375 8.47665 4.375C8.91351 4.375 9.3136 4.4917 9.65343 4.72784C9.98742 4.95992 10.2208 5.27762 10.3812 5.61666C10.3875 5.6299 10.3937 5.64322 10.3997 5.65659L10.9999 5.25648V3.125Z" fill="#18C273"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.1459 1.27079C12.8412 1.24999 12.47 1.24999 12.0253 1.25C11.5806 1.24999 11.1588 1.24999 10.8541 1.27079C10.5368 1.29245 10.2372 1.33914 9.94665 1.45953C9.27321 1.73863 8.73814 2.2737 8.45905 2.94713C8.33865 3.23764 8.29196 3.53731 8.2703 3.85456C8.2495 4.15932 8.2495 4.53054 8.24951 4.97522L8.24951 12.6414C7.0263 13.6949 6.25 15.2569 6.25 17C6.25 20.1756 8.82436 22.75 12 22.75C15.1756 22.75 17.75 20.1756 17.75 17C17.75 15.2569 16.9737 13.6949 15.7505 12.6414L15.7505 4.97524C15.7505 4.53055 15.7505 4.15933 15.7297 3.85456C15.708 3.53731 15.6614 3.23764 15.541 2.94713C15.2619 2.2737 14.7268 1.73863 14.0534 1.45953C13.7628 1.33914 13.4632 1.29245 13.1459 1.27079ZM12 7C12.5523 7 13 7.44772 13 8L13 14.4375C14.0243 14.8375 14.75 15.834 14.75 17C14.75 18.5188 13.5188 19.75 12 19.75C10.4812 19.75 9.25 18.5188 9.25 17C9.25 15.834 9.97566 14.8375 11 14.4375L11 8C11 7.44772 11.4477 7 12 7Z" fill="#ED1C2B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.6439 1.25L13.3561 1.25C14.259 1.24997 15.0211 1.24994 15.6249 1.32042C16.255 1.39396 16.8707 1.55847 17.3706 2.00915C17.5958 2.21222 17.7873 2.44899 17.9376 2.71113C18.2326 3.22573 18.2812 3.77334 18.2347 4.31609C19.2103 4.4287 20.0196 4.68604 20.6521 5.31966C21.2538 5.92238 21.5125 6.68113 21.6335 7.58241C21.75 8.4507 21.75 9.55477 21.75 10.9249V16.043C21.75 17.4131 21.75 18.5172 21.6335 19.3855C21.5125 20.2867 21.2538 21.0455 20.6521 21.6482C20.0502 22.2511 19.2923 22.5105 18.3919 22.6318C17.5249 22.7486 16.4225 22.7486 15.055 22.7485L8.94504 22.7485C7.57752 22.7486 6.47513 22.7486 5.60808 22.6318C4.70774 22.5105 3.94976 22.2511 3.3479 21.6482C2.74621 21.0455 2.48747 20.2867 2.3665 19.3855C2.24997 18.5172 2.24998 17.4131 2.25 16.0431L2.25 10.9248C2.24998 9.55478 2.24997 8.45069 2.3665 7.58241C2.48747 6.68113 2.74621 5.92238 3.3479 5.31966C3.98043 4.68604 4.78975 4.4287 5.76534 4.31608C5.71879 3.77334 5.76736 3.22573 6.06239 2.71113C6.21268 2.44899 6.40422 2.21222 6.62944 2.00915C7.1293 1.55847 7.74503 1.39396 8.37506 1.32042C8.97893 1.24994 9.74097 1.24997 10.6439 1.25ZM8.60067 3.2073C8.13641 3.26149 7.99252 3.35241 7.92575 3.4126C7.8493 3.48154 7.78534 3.56095 7.73568 3.64756C7.69637 3.71613 7.64027 3.8608 7.69746 4.30137C7.75673 4.75797 7.91092 5.36081 8.14823 6.27796C8.33725 7.00848 8.46246 7.48783 8.59555 7.84684C8.72171 8.18716 8.82647 8.33584 8.9287 8.43308C9.00978 8.51021 9.10016 8.57847 9.1982 8.63631C9.32461 8.71091 9.5056 8.77465 9.88389 8.81094C10.1378 8.83531 10.4406 8.84448 10.8301 8.84793L11.5514 6.68404C11.726 6.1601 12.2924 5.87694 12.8163 6.05159C13.3402 6.22624 13.6234 6.79256 13.4488 7.3165L12.9378 8.84935C13.4424 8.84743 13.8138 8.83994 14.1161 8.81094C14.4944 8.77465 14.6754 8.71091 14.8018 8.63631C14.8998 8.57847 14.9902 8.51021 15.0713 8.43308C15.1735 8.33584 15.2783 8.18716 15.4045 7.84684C15.5375 7.48783 15.6628 7.00848 15.8518 6.27796C16.0891 5.36081 16.2433 4.75797 16.3025 4.30137C16.3597 3.8608 16.3036 3.71613 16.2643 3.64756C16.2147 3.56095 16.1507 3.48153 16.0742 3.4126C16.0075 3.35241 15.8636 3.26149 15.3993 3.2073C14.9218 3.15157 14.2747 3.15 13.2979 3.15L10.7021 3.15C9.72532 3.15 9.07816 3.15157 8.60067 3.2073ZM10 17C9.44772 17 9 17.4477 9 18C9 18.5523 9.44772 19 10 19H14C14.5523 19 15 18.5523 15 18C15 17.4477 14.5523 17 14 17L10 17Z" fill="#18C273"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -284,6 +284,19 @@ class AppAssets {
static const String covid19icon = '$svgBasePath/covid_19.svg';
//vital sign
static const String heartRate = '$svgBasePath/heart_rate.svg';
static const String respRate = '$svgBasePath/resp_rate.svg';
static const String weightVital = '$svgBasePath/weight_2.svg';
static const String bmiVital = '$svgBasePath/bmi_2.svg';
static const String heightVital = '$svgBasePath/height_2.svg';
static const String bloodPressure = '$svgBasePath/blood_pressure.svg';
static const String temperature = '$svgBasePath/temperature.svg';
// PNGS //
static const String hmgLogo = '$pngBasePath/hmg_logo.png';
static const String liveCareService = '$pngBasePath/livecare_service.png';
@ -309,7 +322,7 @@ class AppAssets {
static const String fullBodyFront = '$pngBasePath/full_body_front.png';
static const String fullBodyBack = '$pngBasePath/full_body_back.png';
static const String bmiFullBody = '$pngBasePath/bmi_image_1.png';
}

@ -935,8 +935,8 @@ class HmgServicesRepoImp implements HmgServicesRepo {
try {
List<VitalSignResModel> vitalSignList = [];
if (response['PatientVitalSignList'] != null && response['PatientVitalSignList'] is List) {
final vitalSignsList = response['PatientVitalSignList'] as List;
if (response['List_DoctorPatientVitalSign'] != null && response['List_DoctorPatientVitalSign'] is List) {
final vitalSignsList = response['List_DoctorPatientVitalSign'] as List;
for (var vitalSignJson in vitalSignsList) {
if (vitalSignJson is Map<String, dynamic>) {

@ -51,6 +51,19 @@ class HmgServicesViewModel extends ChangeNotifier {
HospitalsModel? selectedHospital;
List<VitalSignResModel> vitalSignList = [];
// Vital Sign PageView Controller
PageController _vitalSignPageController = PageController();
PageController get vitalSignPageController => _vitalSignPageController;
int _vitalSignCurrentPage = 0;
int get vitalSignCurrentPage => _vitalSignCurrentPage;
void setVitalSignCurrentPage(int page) {
_vitalSignCurrentPage = page;
notifyListeners();
}
// HHC specific lists
List<GetCMCAllOrdersResponseModel> hhcOrdersList = [];
List<GetCMCServicesResponseModel> hhcServicesList = [];
@ -896,4 +909,10 @@ class HmgServicesViewModel extends ChangeNotifier {
},
);
}
@override
void dispose() {
_vitalSignPageController.dispose();
super.dispose();
}
}

@ -0,0 +1,102 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
/// UI-only helper model for Vital Sign cards.
///
/// Keeps presentation logic (chip colors, icon colors, simple status rules)
/// in one place so it can be reused across multiple pages.
class VitalSignUiModel {
final Color iconBg;
final Color iconFg;
final Color chipBg;
final Color chipFg;
const VitalSignUiModel({
required this.iconBg,
required this.iconFg,
required this.chipBg,
required this.chipFg,
});
/// Returns a color scheme for a card based on its [status] and [label].
///
/// Rules (mirrors existing behavior in Medical File page):
/// - Height is always blue.
/// - High => red scheme.
/// - Low => yellow scheme.
/// - Otherwise => green scheme (Normal).
static VitalSignUiModel scheme({required String? status, required String label}) {
final s = (status ?? '').toLowerCase();
final l = label.toLowerCase();
// Height should always be blue.
if (l.contains('height')) {
return VitalSignUiModel(
iconBg: AppColors.infoColor.withValues(alpha: 0.12),
iconFg: AppColors.infoColor,
chipBg: AppColors.infoColor.withValues(alpha: 0.12),
chipFg: AppColors.infoColor,
);
}
if (s.contains('high')) {
return const VitalSignUiModel(
iconBg: AppColors.chipSecondaryLightRedColor,
iconFg: AppColors.primaryRedColor,
chipBg: AppColors.chipSecondaryLightRedColor,
chipFg: AppColors.primaryRedColor,
);
}
if (s.contains('low')) {
final Color yellowBg = AppColors.warningColor.withValues(alpha: 0.12);
return VitalSignUiModel(
iconBg: yellowBg,
iconFg: AppColors.warningColor,
chipBg: yellowBg,
chipFg: AppColors.warningColor,
);
}
// Normal (green)
final Color greenBg = AppColors.lightGreenColor;
return VitalSignUiModel(
iconBg: greenBg,
iconFg: AppColors.bgGreenColor,
chipBg: greenBg,
chipFg: AppColors.bgGreenColor,
);
}
/// Simple, user-friendly classification:
/// - Low: systolic < 90 OR diastolic < 60
/// - High: systolic >= 140 OR diastolic >= 90
/// - Normal: otherwise
/// Returns null if values are missing/unparseable.
static String? bloodPressureStatus({dynamic systolic, dynamic diastolic}) {
final int? s = toIntOrNull(systolic);
final int? d = toIntOrNull(diastolic);
if (s == null || d == null) return null;
if (s < 90 || d < 60) return 'Low';
if (s >= 140 || d >= 90) return 'High';
return 'Normal';
}
static int? toIntOrNull(dynamic v) {
if (v == null) return null;
if (v is int) return v;
if (v is double) return v.round();
return int.tryParse(v.toString());
}
static String bmiStatus(dynamic bmi) {
if (bmi == null) return 'N/A';
final double bmiValue = double.tryParse(bmi.toString()) ?? 0;
if (bmiValue < 18.5) return 'Underweight';
if (bmiValue < 25) return 'Normal';
if (bmiValue < 30) return 'Overweight';
return 'High';
}
}

@ -127,6 +127,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
initAppointmentsViewModel() {
if (isAppointmentDataToBeLoaded) {
// Default view is grouped by clinic on first open.
isAppointmentsSortByClinic = true;
patientAppointmentsHistoryList.clear();
patientUpcomingAppointmentsHistoryList.clear();
patientArrivedAppointmentsHistoryList.clear();
@ -269,6 +271,9 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList);
filteredAppointmentList.addAll(patientAppointmentsHistoryList);
// Build grouped list immediately so the UI has data for the default (By Clinic) view.
_groupAppointmentsByClinicAndHospital();
if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
if (Utils.isDateToday(DateUtil.convertStringToDate(patientArrivedAppointmentsHistoryList.first.appointmentDate))) {
// getPatientAppointmentQueueDetails(appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID);
@ -280,6 +285,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}');
print('All Appointments: ${patientAppointmentsHistoryList.length}');
getFiltersForSelectedAppointmentList(filteredAppointmentList);
notifyListeners();
}
void getFiltersForSelectedAppointmentList(List<PatientAppointmentHistoryResponseModel> filteredAppointmentList) {

@ -4,9 +4,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';

@ -1,8 +1,6 @@
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_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -43,8 +41,8 @@ class _MyDoctorsPageState extends State<MyDoctorsPage> {
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
return CollapsingListView(
title: LocaleKeys.myDoctor.tr(context: context),
child: Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
title: LocaleKeys.myDoctor.tr(context: context),
child: Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
// build grouped lists from the flat list
final clinicMap = <String, List<dynamic>>{};
final hospitalMap = <String, List<dynamic>>{};
@ -171,129 +169,121 @@ class _MyDoctorsPageState extends State<MyDoctorsPage> {
final displayName = isSortByClinic ? (group.first.clinicName ?? 'Unknown') : (group.first.projectName ?? 'Unknown');
final isExpanded = expandedIndex == index;
return Container(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
margin: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.all(16.h),
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
setState(() {
expandedIndex = isExpanded ? null : index;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
final key = _groupKeys[index];
if (key != null && key.currentContext != null && expandedIndex == index) {
child: InkWell(
onTap: () {
setState(() {
expandedIndex = isExpanded ? null : index;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
final key = _groupKeys.putIfAbsent(index, () => GlobalKey());
if (key.currentContext != null && expandedIndex == index) {
Future.delayed(const Duration(milliseconds: 450), () {
if (key.currentContext != null) {
Scrollable.ensureVisible(
key.currentContext!,
duration: Duration(milliseconds: 350),
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
alignment: 0.1,
alignment: 0.0,
);
}
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomButton(
text: "${group.length} ${'doctors'.needTranslation}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
Icon(isExpanded ? Icons.expand_less : Icons.chevron_right, color: AppColors.greyColor),
],
),
SizedBox(height: 8.h),
Text(
displayName,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
],
}
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
padding: EdgeInsets.all(16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppCustomChipWidget(labelText: "${group.length} ${'doctors'.needTranslation}"),
Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
],
),
SizedBox(height: 8.h),
Text(
displayName,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
AnimatedSwitcher(
duration: Duration(milliseconds: 400),
child: isExpanded
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.only(top: 12.h),
child: Column(
children: group.map<Widget>((doctor) {
return Container(
margin: EdgeInsets.only(bottom: 12.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 12.h,
hasShadow: true,
),
child: Padding(
padding: EdgeInsets.all(14.h),
child: Column(
AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
transitionBuilder: (Widget child, Animation<double> animation) {
return FadeTransition(
opacity: animation,
child: SizeTransition(
sizeFactor: animation,
axisAlignment: 0.0,
child: child,
),
);
},
child: isExpanded
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...group.map<Widget>((doctor) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
(doctor?.doctorImageURL ?? doctor?.doctorImage ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png"),
width: 24.h,
width: 24.w,
height: 24.h,
fit: BoxFit.cover,
).circle(100),
SizedBox(width: 8.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(doctor?.doctorName ?? "").toString().toText14(weight: FontWeight.w500),
SizedBox(height: 6.h),
],
),
child: (doctor?.doctorName ?? "").toString().toText14(weight: FontWeight.w500),
),
],
),
SizedBox(height: 8.h),
Row(
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
CustomButton(
text: isSortByClinic ? (doctor?.clinicName ?? "") : (doctor?.projectName ?? ""),
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 24.h,
AppCustomChipWidget(
labelText: isSortByClinic ? (doctor?.clinicName ?? "") : (doctor?.projectName ?? ""),
),
],
),
SizedBox(height: 8.h),
SizedBox(height: 12.h),
Row(
children: [
Expanded(
flex: 6,
flex: 2,
child: CustomButton(
icon: AppAssets.view_report_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
text: "View Profile".needTranslation.tr(context: context),
onPressed: () async {
bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
@ -320,75 +310,31 @@ class _MyDoctorsPageState extends State<MyDoctorsPage> {
);
});
},
backgroundColor: AppColors.bgRedLightColor,
borderColor: AppColors.primaryRedColor,
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 14,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
),
SizedBox(width: 8.h),
Expanded(
flex: 1,
child: Container(
height: 40.h,
width: 40.w,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.textColor,
borderRadius: 12,
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Transform.flip(
flipX: getIt<AppState>().isArabic(),
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.whiteColor,
fit: BoxFit.contain,
),
),
),
).onPress(() async {
bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
clinicID: doctor?.clinicID ?? 0,
projectID: doctor?.projectID ?? 0,
doctorID: doctor?.doctorID ?? 0,
));
LoaderBottomSheet.showLoader();
await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
),
],
),
SizedBox(height: 12.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 12.h),
],
),
),
);
}).toList(),
),
)
: SizedBox.shrink(),
),
],
);
}).toList(),
],
),
)
: const SizedBox.shrink(),
),
],
),
),
);
},

@ -15,6 +15,9 @@ 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/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/vital_sign_ui_model.dart';
import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
@ -48,6 +51,7 @@ import 'package:hmg_patient_app_new/presentation/medical_report/medical_reports_
import 'package:hmg_patient_app_new/presentation/my_family/my_family.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescriptions_list_page.dart';
import 'package:hmg_patient_app_new/presentation/radiology/radiology_orders_page.dart';
import 'package:hmg_patient_app_new/presentation/vital_sign/vital_sign_page.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
@ -79,9 +83,14 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
late MedicalFileViewModel medicalFileViewModel;
late BookAppointmentsViewModel bookAppointmentsViewModel;
late LabViewModel labViewModel;
late HmgServicesViewModel hmgServicesViewModel;
int currentIndex = 0;
// Used to make the PageView height follow the card's intrinsic height
final GlobalKey _vitalSignMeasureKey = GlobalKey();
double? _vitalSignMeasuredHeight;
@override
void initState() {
appState = getIt.get<AppState>();
@ -92,11 +101,29 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
medicalFileViewModel.setIsPatientSickLeaveListLoading(true);
medicalFileViewModel.getPatientSickLeaveList();
medicalFileViewModel.onTabChanged(0);
// Load vital signs
hmgServicesViewModel.getPatientVitalSign();
}
});
super.initState();
}
void _scheduleVitalSignMeasure() {
WidgetsBinding.instance.addPostFrameCallback((_) {
final ctx = _vitalSignMeasureKey.currentContext;
if (ctx == null) return;
final box = ctx.findRenderObject();
if (box is RenderBox) {
final h = box.size.height;
if (h > 0 && h != _vitalSignMeasuredHeight) {
setState(() {
_vitalSignMeasuredHeight = h;
});
}
}
});
}
@override
Widget build(BuildContext context) {
labViewModel = Provider.of<LabViewModel>(context, listen: false);
@ -104,6 +131,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false);
medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false);
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
hmgServicesViewModel = Provider.of<HmgServicesViewModel>(context, listen: false);
NavigationService navigationService = getIt.get<NavigationService>();
return CollapsingListView(
title: "Medical File".needTranslation,
@ -253,6 +281,111 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
),
).paddingSymmetrical(24.w, 0.0),
SizedBox(height: 16.h),
// Vital Signs Section
Consumer<HmgServicesViewModel>(builder: (context, hmgServicesVM, child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"Vital Signs".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2),
Row(
children: [
LocaleKeys.viewAll.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500),
SizedBox(width: 2.h),
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
],
),
],
).paddingSymmetrical(0.w, 0.h).onPress(() {
Navigator.of(context).push(
CustomPageRoute(
page: VitalSignPage(),
),
);
}),
SizedBox(height: 16.h),
// Make this section dynamic-height (no fixed 160.h)
LayoutBuilder(
builder: (context, constraints) {
if (hmgServicesVM.isVitalSignLoading) {
return _buildVitalSignShimmer();
}
if (hmgServicesVM.vitalSignList.isEmpty) {
return Container(
padding: EdgeInsets.all(16.w),
width: MediaQuery.of(context).size.width,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 12.r,
hasShadow: false,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.call_for_vitals, width: 32.h, height: 32.h),
SizedBox(height: 12.h),
"No vital signs recorded yet".needTranslation.toText12(isCenter: true),
],
),
);
}
// The cards define their own height; measure the first rendered page once
_scheduleVitalSignMeasure();
final double hostHeight = _vitalSignMeasuredHeight ?? (160.h);
return SizedBox(
height: hostHeight,
child: PageView(
controller: hmgServicesVM.vitalSignPageController,
onPageChanged: (index) {
hmgServicesVM.setVitalSignCurrentPage(index);
_scheduleVitalSignMeasure();
},
children: _buildVitalSignPages(
vitalSign: hmgServicesVM.vitalSignList.first,
onTap: () {
Navigator.of(context).push(
CustomPageRoute(
page: VitalSignPage(),
),
);
},
measureKey: _vitalSignMeasureKey,
currentPageIndex: hmgServicesVM.vitalSignCurrentPage,
),
),
);
},
),
if (!hmgServicesVM.isVitalSignLoading && hmgServicesVM.vitalSignList.isNotEmpty) ...[
SizedBox(height: 12.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
2, // 2 pages (BMI+Height on page 1, Weight+BP on page 2)
(index) => Container(
margin: EdgeInsets.symmetric(horizontal: 3.w),
width: hmgServicesVM.vitalSignCurrentPage == index ? 24.w : 8.w,
height: 8.h,
decoration: BoxDecoration(
color: hmgServicesVM.vitalSignCurrentPage == index
? AppColors.primaryRedColor
: AppColors.dividerColor,
borderRadius: BorderRadius.circular(4.r),
),
),
),
),
],
],
).paddingSymmetrical(24.w, 0.0);
}),
SizedBox(height: 16.h),
TextInputWidget(
labelText: LocaleKeys.search.tr(context: context),
hintText: "Type any record".needTranslation,
@ -271,7 +404,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
// Using CustomExpandableList
CustomExpandableList(
expansionMode: ExpansionMode.exactlyOne,
dividerColor: Color(0xFF2B353E1A),
dividerColor: Color(0xff2b353e1a),
itemPadding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.h),
items: [
ExpandableListItem(
@ -488,47 +621,51 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
horizontalOffset: 100.0,
child: FadeInAnimation(
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
child: MedicalFileAppointmentCard(
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index],
myAppointmentsViewModel: myAppointmentsViewModel,
onRescheduleTap: () {
openDoctorScheduleCalendar(myAppointmentsVM.patientAppointmentsHistoryList[index]);
},
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
child: MedicalFileAppointmentCard(
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index],
myAppointmentsViewModel: myAppointmentsViewModel,
onRescheduleTap: () {
openDoctorScheduleCalendar(myAppointmentsVM.patientAppointmentsHistoryList[index]);
},
onAskDoctorTap: () async {
LoaderBottomSheet.showLoader(loadingText: "Checking doctor availability...".needTranslation);
await myAppointmentsViewModel.isDoctorAvailable(
projectID: myAppointmentsVM.patientAppointmentsHistoryList[index].projectID,
doctorId: myAppointmentsVM.patientAppointmentsHistoryList[index].doctorID,
clinicId: myAppointmentsVM.patientAppointmentsHistoryList[index].clinicID,
onSuccess: (value) async {
if (value) {
await myAppointmentsViewModel.getAskDoctorRequestTypes(onSuccess: (val) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
title: LocaleKeys.askDoctor.tr(context: context),
child: AskDoctorRequestTypeSelect(
askDoctorRequestTypeList: myAppointmentsViewModel.askDoctorRequestTypeList,
myAppointmentsViewModel: myAppointmentsViewModel,
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index],
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
} else {
print("Doctor is not available");
}
});
projectID: myAppointmentsVM.patientAppointmentsHistoryList[index].projectID,
doctorId: myAppointmentsVM.patientAppointmentsHistoryList[index].doctorID,
clinicId: myAppointmentsVM.patientAppointmentsHistoryList[index].clinicID,
onSuccess: (value) async {
if (value) {
await myAppointmentsViewModel.getAskDoctorRequestTypes(onSuccess: (val) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
title: LocaleKeys.askDoctor.tr(context: context),
child: AskDoctorRequestTypeSelect(
askDoctorRequestTypeList: myAppointmentsViewModel.askDoctorRequestTypeList,
myAppointmentsViewModel: myAppointmentsViewModel,
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index],
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
} else {
LoaderBottomSheet.hideLoader();
print("Doctor is not available");
}
},
onError: (_) {
LoaderBottomSheet.hideLoader();
},
);
},
),
),
),
),
);
));
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 12.h),
),
@ -646,58 +783,57 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
);
}),
),
));
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
),
SizedBox(height: 16.h),
const Divider(color: AppColors.dividerColor),
SizedBox(height: 16.h),
Row(
children: [
Expanded(
child: CustomButton(
text: "All Prescriptions".needTranslation,
onPressed: () {
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionsListPage(),
),
);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
height: 40.h,
icon: AppAssets.requests,
iconColor: AppColors.primaryRedColor,
iconSize: 16.w,
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
),
SizedBox(height: 16.h),
const Divider(color: AppColors.dividerColor),
SizedBox(height: 16.h),
Row(
children: [
Expanded(
child: CustomButton(
text: "All Prescriptions".needTranslation,
onPressed: () {
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionsListPage(),
),
);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
height: 40.h,
icon: AppAssets.requests,
iconColor: AppColors.primaryRedColor,
iconSize: 16.w,
),
),
SizedBox(width: 6.w),
Expanded(
child: CustomButton(
text: "All Medications".needTranslation,
onPressed: () {},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.h,
height: 40.h,
icon: AppAssets.all_medications_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
SizedBox(width: 6.w),
Expanded(
child: CustomButton(
text: "All Medications".needTranslation,
onPressed: () {},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.h,
height: 40.h,
icon: AppAssets.all_medications_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
),
),
),
],
),
],
],
),
],
),
),
).paddingSymmetrical(0.w, 0.h)
@ -829,8 +965,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
});
}),
),
),
);
));
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h),
),
@ -1068,7 +1203,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
backgroundColor: AppColors.whiteColor,
svgIcon: AppAssets.medical_reports_icon,
isLargeText: true,
iconSize: 36.h,
iconSize: 36.w,
).onPress(() {
medicalFileViewModel.setIsPatientMedicalReportsLoading(true);
medicalFileViewModel.getPatientMedicalReportList();
@ -1188,4 +1323,265 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
return Container();
}
}
// Build shimmer for vital signs
Widget _buildVitalSignShimmer() {
return Row(
children: [
Expanded(child: _buildSingleShimmerCard()),
SizedBox(width: 12.w),
Expanded(child: _buildSingleShimmerCard()),
],
);
}
Widget _buildSingleShimmerCard() {
return Container(
decoration: BoxDecoration(
color: AppColors.whiteColor,
borderRadius: BorderRadius.circular(16.r),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Icon shimmer at top
Container(
width: 44.w,
height: 44.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.r),
),
).toShimmer(),
SizedBox(height: 16.h),
// Label shimmer
Container(
width: 70.w,
height: 12.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
),
).toShimmer(),
SizedBox(height: 8.h),
// Value shimmer (larger)
Container(
width: 60.w,
height: 32.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
),
).toShimmer(),
SizedBox(height: 12.h),
// Bottom row with chip and arrow
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 60.w,
height: 20.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.r),
),
).toShimmer(),
Container(
width: 16.w,
height: 16.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.r),
),
).toShimmer(),
],
),
],
),
),
);
}
// Build pages with 2 cards each
List<Widget> _buildVitalSignPages({
required VitalSignResModel vitalSign,
required VoidCallback onTap,
required GlobalKey measureKey,
required int currentPageIndex,
}) {
return [
// Page 1: BMI + Height
Row(
children: [
Expanded(
child: _buildVitalSignCard(
icon: AppAssets.bmiVital,
label: "BMI",
value: vitalSign.bodyMassIndex?.toString() ?? '--',
unit: '',
status: vitalSign.bodyMassIndex != null ? _getBMIStatus(vitalSign.bodyMassIndex) : null,
onTap: onTap,
),
),
SizedBox(width: 12.w),
Expanded(
child: _buildVitalSignCard(
icon: AppAssets.heightVital,
label: "Height",
value: vitalSign.heightCm?.toString() ?? '--',
unit: 'cm',
status: null,
onTap: onTap,
),
),
],
),
// Page 2: Weight + Blood Pressure
Row(
children: [
Expanded(
child: _buildVitalSignCard(
icon: AppAssets.weightVital,
label: "Weight",
value: vitalSign.weightKg?.toString() ?? '--',
unit: 'kg',
status: vitalSign.weightKg != null ? "Normal" : null,
onTap: onTap,
),
),
SizedBox(width: 12.w),
Expanded(
child: _buildVitalSignCard(
icon: AppAssets.bloodPressure,
label: "Blood Pressure",
value: vitalSign.bloodPressureLower != null && vitalSign.bloodPressureHigher != null
? "${vitalSign.bloodPressureHigher}/${vitalSign.bloodPressureLower}"
: '--',
unit: '',
status: _getBloodPressureStatus(
systolic: vitalSign.bloodPressureHigher,
diastolic: vitalSign.bloodPressureLower,
),
onTap: onTap,
),
),
],
),
];
}
String _getBMIStatus(dynamic bmi) {
return VitalSignUiModel.bmiStatus(bmi);
}
String? _getBloodPressureStatus({dynamic systolic, dynamic diastolic}) {
return VitalSignUiModel.bloodPressureStatus(systolic: systolic, diastolic: diastolic);
}
Widget _buildVitalSignCard({
required String icon,
required String label,
required String value,
required String unit,
required String? status,
required VoidCallback onTap,
}) {
final VitalSignUiModel scheme = VitalSignUiModel.scheme(status: status, label: label);
return GestureDetector(
onTap: onTap,
child: Container(
// Same styling used originally for vitals in MedicalFilePage
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 16.r,
hasShadow: false,
),
child: Padding(
padding: EdgeInsets.all(16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: scheme.iconBg,
borderRadius: BorderRadius.circular(12.r),
),
child: Utils.buildSvgWithAssets(
icon: icon,
width: 20.w,
height: 20.h,
iconColor: scheme.iconFg,
fit: BoxFit.contain,
),
),
SizedBox(width: 10.w),
Expanded(
child: label.toText14(
color: AppColors.textColor,
weight: FontWeight.w600,
),
),
],
),
SizedBox(height: 14.h),
Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
color: AppColors.bgScaffoldColor,
borderRadius: BorderRadius.circular(10.r),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
value.toText17(
isBold: true,
color: AppColors.textColor,
),
if (unit.isNotEmpty) ...[
SizedBox(width: 3.w),
unit.toText12(
color: AppColors.textColor,
fontWeight: FontWeight.w500,
),
],
],
),
if (status != null)
AppCustomChipWidget(
labelText: status,
backgroundColor: scheme.chipBg,
textColor: scheme.chipFg,
)
else
const SizedBox.shrink(),
],
),
),
SizedBox(height: 8.h),
Align(
alignment: AlignmentDirectional.centerEnd,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_forward,
width: 18.w,
height: 18.h,
iconColor: AppColors.textColorLight,
fit: BoxFit.contain,
),
),
],
),
),
),
);
}
}

@ -190,231 +190,173 @@ class _RadiologyOrdersPageState extends State<RadiologyOrdersPage> {
itemBuilder: (context, index) {
final group = model.patientRadiologyOrdersViewList[index];
final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown');
final isExpanded = expandedIndex == index;
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 400),
child: SlideAnimation(
verticalOffset: 50.0,
child: FadeInAnimation(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Group header container with key so we can scroll to it
GestureDetector(
onTap: () {
setState(() {
expandedIndex = expandedIndex == index ? null : index;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
final key = _groupKeys.putIfAbsent(index, () => GlobalKey());
if (key.currentContext != null && expandedIndex == index) {
// Delay scrolling to wait for expansion animation
Future.delayed(Duration(milliseconds: 450), () {
if (key.currentContext != null) {
Scrollable.ensureVisible(
key.currentContext!,
duration: Duration(milliseconds: 350),
curve: Curves.easeInOut,
alignment: 0.0,
);
}
});
}
});
},
child: Container(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
margin: EdgeInsets.only(bottom: 8.h),
padding: EdgeInsets.all(12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.h),
boxShadow: [
BoxShadow(
color: AppColors.blackColor.withValues(alpha: 0.03),
blurRadius: 6,
offset: Offset(0, 2),
)
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
child: AnimatedContainer(
duration: const 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: () {
setState(() {
expandedIndex = isExpanded ? null : index;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
final key = _groupKeys.putIfAbsent(index, () => GlobalKey());
if (key.currentContext != null && expandedIndex == index) {
Future.delayed(const Duration(milliseconds: 450), () {
if (key.currentContext != null) {
Scrollable.ensureVisible(
key.currentContext!,
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
alignment: 0.0,
);
}
});
}
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
padding: EdgeInsets.all(16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomButton(
text: "${group.length} ${'results'.needTranslation}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
Icon(expandedIndex == index ? Icons.expand_less : Icons.expand_more),
],
),
SizedBox(height: 8.h),
Text(
displayName,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
AppCustomChipWidget(labelText: "${group.length} ${'results'.needTranslation}"),
Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
],
),
),
],
SizedBox(height: 8.h),
Text(
displayName,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
),
AnimatedSwitcher(
duration: Duration(milliseconds: 400),
child: expandedIndex == index
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.only(top: 12.h),
child: Column(
children: group.map<Widget>((order) {
return Container(
margin: EdgeInsets.only(bottom: 12.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 12.h,
hasShadow: true,
),
child: Padding(
padding: EdgeInsets.all(14.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.network(
order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
width: 24.h,
height: 24.h,
fit: BoxFit.cover,
).circle(100),
SizedBox(width: 8.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(order.doctorName ?? "").toString().toText14(weight: FontWeight.w500),
SizedBox(height: 6.h),
],
AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
transitionBuilder: (Widget child, Animation<double> animation) {
return FadeTransition(
opacity: animation,
child: SizeTransition(
sizeFactor: animation,
axisAlignment: 0.0,
child: child,
),
);
},
child: isExpanded
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...group.map<Widget>((order) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
width: 24.w,
height: 24.h,
fit: BoxFit.cover,
).circle(100),
SizedBox(width: 8.h),
Expanded(
child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500),
),
),
],
),
SizedBox(height: 8.h),
Row(children: [
CustomButton(
text: order.description!,
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 24.h,
)
]
),
SizedBox(height: 6.h),
Row(
children: [
CustomButton(
text: DateUtil.formatDateToDate(order.orderDate ?? order.appointmentDate ?? "", false),
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 24.h,
),
SizedBox(width: 8.h),
CustomButton(
text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""),
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 24.h,
),
],
),
SizedBox(height: 8.h),
Row(
children: [
Expanded(
flex: 6,
child: SizedBox(),
),
SizedBox(width: 8.h),
Expanded(
flex: 1,
child: Container(
height: 40.h,
width: 40.w,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.textColor,
borderRadius: 12,
],
),
SizedBox(height: 8.h),
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
if ((order.description ?? '').isNotEmpty)
AppCustomChipWidget(
labelText: (order.description ?? '').toString(),
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Transform.flip(
flipX: false,
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.whiteColor,
fit: BoxFit.contain,
),
),
AppCustomChipWidget(
labelText: DateUtil.formatDateToDate(
(order.orderDate ?? order.appointmentDate),
false,
),
).onPress(() {
model.navigationService.push(
CustomPageRoute(
page: RadiologyResultPage(patientRadiologyResponseModel: order),
),
);
}),
),
],
),
],
),
),
);
}).toList(),
),
)
: SizedBox.shrink(),
),
AppCustomChipWidget(
labelText: model.isSortByClinic ? (order.clinicDescription ?? '') : (order.projectName ?? ''),
),
],
),
SizedBox(height: 12.h),
Row(
children: [
Expanded(flex: 2, child: const SizedBox()),
Expanded(
flex: 2,
child: CustomButton(
icon: AppAssets.view_report_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
text: "View Results".needTranslation,
onPressed: () {
model.navigationService.push(
CustomPageRoute(
page: RadiologyResultPage(patientRadiologyResponseModel: order),
),
);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 14,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
),
],
),
SizedBox(height: 12.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 12.h),
],
);
}).toList(),
],
),
)
: const SizedBox.shrink(),
),
],
),
],
),
),
),
),

@ -1,4 +1,4 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -11,7 +11,7 @@ import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vit
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/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/vital_sign_ui_model.dart';
import 'package:provider/provider.dart';
class VitalSignPage extends StatefulWidget {
@ -22,22 +22,10 @@ class VitalSignPage extends StatefulWidget {
}
class _VitalSignPageState extends State<VitalSignPage> {
@override
void initState() {
super.initState();
final HmgServicesViewModel hmgServicesViewModel = context.read<HmgServicesViewModel>();
scheduleMicrotask(() async {
LoaderBottomSheet.showLoader(loadingText: 'Loading Vital Signs...');
await hmgServicesViewModel.getPatientVitalSign(
onSuccess: (_) {
LoaderBottomSheet.hideLoader();
},
onError: (_) {
LoaderBottomSheet.hideLoader();
},
);
});
}
@override
@ -72,48 +60,40 @@ class _VitalSignPageState extends State<VitalSignPage> {
children: [
// BMI Card
_buildVitalSignCard(
icon: AppAssets.activity,
iconColor: AppColors.successColor,
iconBgColor: AppColors.successColor.withValues(alpha: 0.1),
icon: AppAssets.bmiVital,
label: 'BMI',
value: latestVitalSign?.bodyMassIndex?.toString() ?? '--',
unit: '',
chipText: _getBMIStatus(latestVitalSign?.bodyMassIndex),
chipBgColor: AppColors.successColor.withValues(alpha: 0.1),
chipTextColor: AppColors.successColor,
status: VitalSignUiModel.bmiStatus(latestVitalSign?.bodyMassIndex),
onTap: () {},
),
SizedBox(height: 16.h),
// Height Card
_buildVitalSignCard(
icon: AppAssets.height,
iconColor: AppColors.infoColor,
iconBgColor: AppColors.infoColor.withValues(alpha: 0.1),
icon: AppAssets.heightVital,
label: 'Height',
value: latestVitalSign?.heightCm?.toString() ?? '--',
unit: 'cm',
status: null,
onTap: () {},
),
SizedBox(height: 16.h),
// Weight Card
_buildVitalSignCard(
icon: AppAssets.weight,
iconColor: AppColors.successColor,
iconBgColor: AppColors.successColor.withValues(alpha: 0.1),
icon: AppAssets.weightVital,
label: 'Weight',
value: latestVitalSign?.weightKg?.toString() ?? '--',
unit: 'kg',
chipText: 'Normal',
chipBgColor: AppColors.successColor.withValues(alpha: 0.1),
chipTextColor: AppColors.successColor,
status: (latestVitalSign?.weightKg != null) ? 'Normal' : null,
onTap: () {},
),
SizedBox(height: 16.h),
// Blood Pressure Card
_buildVitalSignCard(
icon: AppAssets.activity,
iconColor: AppColors.warningColor,
iconBgColor: AppColors.warningColor.withValues(alpha: 0.1),
icon: AppAssets.bloodPressure,
label: 'Blood Pressure',
value: latestVitalSign != null &&
latestVitalSign.bloodPressureHigher != null &&
@ -121,17 +101,22 @@ class _VitalSignPageState extends State<VitalSignPage> {
? '${latestVitalSign.bloodPressureHigher}/${latestVitalSign.bloodPressureLower}'
: '--',
unit: '',
status: VitalSignUiModel.bloodPressureStatus(
systolic: latestVitalSign?.bloodPressureHigher,
diastolic: latestVitalSign?.bloodPressureLower,
),
onTap: () {},
),
SizedBox(height: 16.h),
// Temperature Card
_buildVitalSignCard(
icon: AppAssets.activity,
iconColor: AppColors.errorColor,
iconBgColor: AppColors.errorColor.withValues(alpha: 0.1),
icon: AppAssets.temperature,
label: 'Temperature',
value: latestVitalSign?.temperatureCelcius?.toString() ?? '--',
unit: '°C',
status: null,
onTap: () {},
),
],
),
@ -143,54 +128,80 @@ class _VitalSignPageState extends State<VitalSignPage> {
Expanded(
child: Column(
children: [
// Body anatomy image
Container(
height: 280.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
child: Center(
child: Image.asset(
AppAssets.fullBodyFront,
height: 260.h,
fit: BoxFit.contain,
),
),
),
SizedBox(height: 16.h),
// Body anatomy image with Heart Rate card overlaid at bottom
SizedBox(
height: 480.h,
width: double.infinity,
child: Stack(
clipBehavior: Clip.none,
children: [
// Image
Positioned.fill(
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(
AppAssets.bmiFullBody,
fit: BoxFit.cover,
alignment: Alignment.topCenter,
),
Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
height: 420.h,
child: ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
AppColors.whiteColor.withValues(alpha: 0.0),
AppColors.whiteColor.withValues(alpha: 0.97),
AppColors.whiteColor,
],
),
),
),
),
),
),
],
),
),
// Heart Rate Card
_buildVitalSignCard(
icon: AppAssets.heart,
iconColor: AppColors.errorColor,
iconBgColor: AppColors.errorColor.withValues(alpha: 0.1),
label: 'Heart Rate',
value: latestVitalSign?.heartRate?.toString() ??
latestVitalSign?.pulseBeatPerMinute?.toString() ?? '--',
unit: 'bpm',
chipText: 'Normal',
chipBgColor: AppColors.successColor.withValues(alpha: 0.1),
chipTextColor: AppColors.successColor,
// Overlay Heart Rate card
Positioned(
left: 0,
right: 0,
bottom: 12.h,
child: _buildVitalSignCard(
icon: AppAssets.heart,
label: 'Heart Rate',
value: latestVitalSign?.heartRate?.toString() ?? latestVitalSign?.pulseBeatPerMinute?.toString() ?? '--',
unit: 'bpm',
status: 'Normal',
onTap: () {},
),
),
],
),
),
SizedBox(height: 16.h),
SizedBox(height: 12.h),
// Respiratory rate Card
_buildVitalSignCard(
icon: AppAssets.activity,
iconColor: AppColors.successColor,
iconBgColor: AppColors.successColor.withValues(alpha: 0.1),
label: 'Respiratory rate',
value: latestVitalSign?.respirationBeatPerMinute?.toString() ?? '--',
unit: 'bpm',
chipText: 'Normal',
chipBgColor: AppColors.successColor.withValues(alpha: 0.1),
chipTextColor: AppColors.successColor,
),
],
),
),
// Respiratory rate Card
_buildVitalSignCard(
icon: AppAssets.respRate,
label: 'Respiratory rate',
value: latestVitalSign?.respirationBeatPerMinute?.toString() ?? '--',
unit: 'bpm',
status: 'Normal',
onTap: () {},
),
],
),
),
],
),
),
@ -205,104 +216,106 @@ class _VitalSignPageState extends State<VitalSignPage> {
);
}
String? _getBMIStatus(dynamic bmi) {
if (bmi == null) return null;
double bmiValue = double.tryParse(bmi.toString()) ?? 0;
if (bmiValue < 18.5) return 'Underweight';
if (bmiValue < 25) return 'Normal';
if (bmiValue < 30) return 'Overweight';
return 'Obese';
}
Widget _buildVitalSignCard({
required String icon,
required Color iconColor,
required Color iconBgColor,
required String label,
required String value,
required String unit,
String? chipText,
Color? chipBgColor,
Color? chipTextColor,
required String? status,
required VoidCallback onTap,
}) {
return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
// Icon with background
Container(
padding: EdgeInsets.all(8.h),
decoration: BoxDecoration(
color: iconBgColor,
borderRadius: BorderRadius.circular(12.r),
final VitalSignUiModel scheme = VitalSignUiModel.scheme(status: status, label: label);
return GestureDetector(
onTap: onTap,
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 16.r,
hasShadow: false,
),
child: Padding(
padding: EdgeInsets.all(16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: scheme.iconBg,
borderRadius: BorderRadius.circular(12.r),
),
child: Utils.buildSvgWithAssets(
icon: icon,
width: 20.w,
height: 20.h,
iconColor: scheme.iconFg,
fit: BoxFit.contain,
),
),
child: Utils.buildSvgWithAssets(
icon: icon,
width: 16.w,
height: 16.h,
iconColor: iconColor,
fit: BoxFit.contain,
SizedBox(width: 10.w),
Expanded(
child: label.toText14(
color: AppColors.textColor,
weight: FontWeight.w600,
),
),
],
),
SizedBox(height: 14.h),
Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
color: AppColors.bgScaffoldColor,
borderRadius: BorderRadius.circular(10.r),
),
SizedBox(width: 8.w),
Expanded(
child: label.toText10(
color: AppColors.textColorLight,
weight: FontWeight.w500,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
value.toText17(
isBold: true,
color: AppColors.textColor,
),
if (unit.isNotEmpty) ...[
SizedBox(width: 3.w),
unit.toText12(
color: AppColors.textColor,
fontWeight: FontWeight.w500,
),
],
],
),
if (status != null)
AppCustomChipWidget(
labelText: status,
backgroundColor: scheme.chipBg,
textColor: scheme.chipFg,
)
else
const SizedBox.shrink(),
],
),
// Forward arrow
Utils.buildSvgWithAssets(
),
SizedBox(height: 8.h),
Align(
alignment: AlignmentDirectional.centerEnd,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_forward,
width: 16.w,
height: 16.h,
width: 18.w,
height: 18.h,
iconColor: AppColors.textColorLight,
fit: BoxFit.contain,
),
],
),
SizedBox(height: 12.h),
// Value
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
value.toText18(
isBold: true,
color: AppColors.textColor,
),
if (unit.isNotEmpty) ...[
SizedBox(width: 4.w),
unit.toText12(
color: AppColors.textColorLight,
),
],
],
),
// Chip if available
if (chipText != null) ...[
SizedBox(height: 8.h),
AppCustomChipWidget(
labelText: chipText,
backgroundColor: chipBgColor,
textColor: chipTextColor,
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
),
],
],
),
),
),
);
}
}

@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class VitalSignShimmerWidget extends StatelessWidget {
const VitalSignShimmerWidget({super.key});
@override
Widget build(BuildContext context) {
return Row(
children: [
// BMI Card Shimmer
Expanded(child: _buildShimmerCard()),
SizedBox(width: 8.w),
// Height Card Shimmer
Expanded(child: _buildShimmerCard()),
SizedBox(width: 8.w),
// Weight Card Shimmer
Expanded(child: _buildShimmerCard()),
SizedBox(width: 8.w),
// Blood Pressure Card Shimmer
Expanded(child: _buildShimmerCard()),
],
);
}
Widget _buildShimmerCard() {
return Container(
decoration: BoxDecoration(
color: AppColors.whiteColor,
borderRadius: BorderRadius.circular(12.r),
),
child: Padding(
padding: EdgeInsets.all(12.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// Icon shimmer
Container(
width: 32.w,
height: 32.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
),
).toShimmer(),
SizedBox(height: 8.h),
// Label shimmer
Container(
width: 50.w,
height: 10.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
),
).toShimmer(),
SizedBox(height: 4.h),
// Value shimmer
Container(
width: 40.w,
height: 16.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
),
).toShimmer(),
SizedBox(height: 4.h),
// Chip shimmer
Container(
width: 45.w,
height: 18.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.r),
),
).toShimmer(),
SizedBox(height: 4.h),
// Arrow shimmer
Align(
alignment: AlignmentDirectional.centerEnd,
child: Container(
width: 10.w,
height: 10.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.r),
),
).toShimmer(),
),
],
),
),
);
}
}
Loading…
Cancel
Save