Merge pull request 'Updated design for HHC and few symptoms checker changes (faiz_dev)' (#123) from faiz_dev into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/123
pull/130/head
Haroon6138 1 month ago
commit 3044b901c2

@ -3,8 +3,8 @@ import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/order_update_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/order_update_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/search_e_referral_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/search_e_referral_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/send_activation_code_ereferral_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/send_activation_code_ereferral_req_model.dart';
@ -24,8 +24,9 @@ class HmgServicesViewModel extends ChangeNotifier {
final BookAppointmentsRepo bookAppointmentsRepo; final BookAppointmentsRepo bookAppointmentsRepo;
final ErrorHandlerService errorHandlerService; final ErrorHandlerService errorHandlerService;
final NavigationService navigationService; final NavigationService navigationService;
HmgServicesViewModel({required this.bookAppointmentsRepo, required this.hmgServicesRepo, required this.errorHandlerService, required this.navigationService});
HmgServicesViewModel(
{required this.bookAppointmentsRepo, required this.hmgServicesRepo, required this.errorHandlerService, required this.navigationService});
bool isCmcOrdersLoading = false; bool isCmcOrdersLoading = false;
bool isCmcServicesLoading = false; bool isCmcServicesLoading = false;
@ -53,12 +54,12 @@ class HmgServicesViewModel extends ChangeNotifier {
// HHC order creation state (no hospital selection needed for home healthcare) // HHC order creation state (no hospital selection needed for home healthcare)
GetCMCServicesResponseModel? selectedServiceForHhcOrder; GetCMCServicesResponseModel? selectedServiceForHhcOrder;
List<GetAllRelationshipTypeResponseModel> relationTypes = [];
List<GetAllRelationshipTypeResponseModel> relationTypes =[]; List<GetAllCitiesResponseModel> getAllCitiesList = [];
List<GetAllCitiesResponseModel> getAllCitiesList =[]; List<SearchEReferralResponseModel> searchReferralList = [];
List<SearchEReferralResponseModel> searchReferralList =[];
Future<void> getOrdersList() async {} Future<void> getOrdersList() async {}
// HHC multiple services selection // HHC multiple services selection
List<GetCMCServicesResponseModel> selectedHhcServices = []; List<GetCMCServicesResponseModel> selectedHhcServices = [];
@ -332,10 +333,7 @@ class HmgServicesViewModel extends ChangeNotifier {
await getAllHhcOrders(); await getAllHhcOrders();
} }
Future<void> getAllHhcOrders({ Future<void> getAllHhcOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
isHhcOrdersLoading = true; isHhcOrdersLoading = true;
notifyListeners(); notifyListeners();
@ -541,16 +539,14 @@ class HmgServicesViewModel extends ChangeNotifier {
final result = await hmgServicesRepo.getRelationshipTypes(); final result = await hmgServicesRepo.getRelationshipTypes();
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
relationTypes = apiResponse.data ?? []; relationTypes = apiResponse.data ?? [];
notifyListeners(); notifyListeners();
@ -567,7 +563,6 @@ class HmgServicesViewModel extends ChangeNotifier {
); );
} }
Future<void> getAllCities({ Future<void> getAllCities({
Function(dynamic)? onSuccess, Function(dynamic)? onSuccess,
Function(String)? onError, Function(String)? onError,
@ -576,16 +571,14 @@ class HmgServicesViewModel extends ChangeNotifier {
final result = await hmgServicesRepo.getAllCities(); final result = await hmgServicesRepo.getAllCities();
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
getAllCitiesList = apiResponse.data ?? []; getAllCitiesList = apiResponse.data ?? [];
notifyListeners(); notifyListeners();
@ -607,22 +600,20 @@ class HmgServicesViewModel extends ChangeNotifier {
Function(GenericApiModel)? onSuccess, Function(GenericApiModel)? onSuccess,
Function(String)? onError, Function(String)? onError,
}) async { }) async {
notifyListeners(); notifyListeners();
final result = await hmgServicesRepo.sendEReferralActivationCode(requestModel); final result = await hmgServicesRepo.sendEReferralActivationCode(requestModel);
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
@ -642,22 +633,20 @@ class HmgServicesViewModel extends ChangeNotifier {
Function(GenericApiModel)? onSuccess, Function(GenericApiModel)? onSuccess,
Function(String)? onError, Function(String)? onError,
}) async { }) async {
notifyListeners(); notifyListeners();
final result = await hmgServicesRepo.checkEReferralActivationCode(requestModel); final result = await hmgServicesRepo.checkEReferralActivationCode(requestModel);
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
@ -672,28 +661,25 @@ class HmgServicesViewModel extends ChangeNotifier {
); );
} }
Future<void> createEReferral({ Future<void> createEReferral({
required CreateEReferralRequestModel requestModel, required CreateEReferralRequestModel requestModel,
Function(GenericApiModel)? onSuccess, Function(GenericApiModel)? onSuccess,
Function(String)? onError, Function(String)? onError,
}) async { }) async {
notifyListeners(); notifyListeners();
final result = await hmgServicesRepo.createEReferral(requestModel); final result = await hmgServicesRepo.createEReferral(requestModel);
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
@ -708,29 +694,24 @@ class HmgServicesViewModel extends ChangeNotifier {
); );
} }
Future<void> searchEReferral({ Future<void> searchEReferral({
required SearchEReferralRequestModel requestModel, required SearchEReferralRequestModel requestModel,
Function(dynamic)? onSuccess, Function(dynamic)? onSuccess,
Function(String)? onError, Function(String)? onError,
}) async { }) async {
notifyListeners(); notifyListeners();
final result = await hmgServicesRepo.searchEReferral(requestModel); final result = await hmgServicesRepo.searchEReferral(requestModel);
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.toString());
} }
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 1) { if (apiResponse.messageStatus == 1) {
searchReferralList = apiResponse.data ?? []; searchReferralList = apiResponse.data ?? [];
notifyListeners(); notifyListeners();
@ -747,28 +728,26 @@ class HmgServicesViewModel extends ChangeNotifier {
); );
} }
Future<void> navigateToOTPScreen( Future<void> navigateToOTPScreen({
{required OTPTypeEnum otpTypeEnum, required OTPTypeEnum otpTypeEnum,
required String phoneNumber, required String phoneNumber,
required String loginToken, required String loginToken,
required Function onSuccess, required Function onSuccess,
}) async { }) async {
navigationService.pushToOtpScreen( navigationService.pushToOtpScreen(
phoneNumber: phoneNumber, phoneNumber: phoneNumber,
isFormFamilyFile: false, isFormFamilyFile: false,
checkActivationCode: (int activationCode) async { checkActivationCode: (int activationCode) async {
checkEReferralActivationCode( checkEReferralActivationCode(
requestModel: CheckActivationCodeForEReferralRequestModel( requestModel: CheckActivationCodeForEReferralRequestModel(
logInTokenID: loginToken, logInTokenID: loginToken,
activationCode: activationCode.toString(), activationCode: activationCode.toString(),
), ),
onSuccess: (GenericApiModel response) { onSuccess: (GenericApiModel response) {
onSuccess(); onSuccess();
}, },
onError: (String errorMessage) { onError: (String errorMessage) {
print(errorMessage); print(errorMessage);
}, },
); );
}, },
@ -787,5 +766,4 @@ class HmgServicesViewModel extends ChangeNotifier {
}, },
); );
} }
} }

@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart' show ChangeNotifier; import 'package:flutter/foundation.dart' show ChangeNotifier;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_flutter_platform_interface/src/types/camera.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices;
import 'package:hmg_patient_app_new/core/app_state.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/dependencies.dart';
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
@ -10,9 +10,6 @@ import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
import 'package:hmg_patient_app_new/features/location/location_repo.dart'; import 'package:hmg_patient_app_new/features/location/location_repo.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:huawei_map/huawei_map.dart' as HMSCameraServices; import 'package:huawei_map/huawei_map.dart' as HMSCameraServices;
import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices;
import 'PlacePrediction.dart'; import 'PlacePrediction.dart';
@ -20,12 +17,12 @@ class LocationViewModel extends ChangeNotifier {
final LocationRepo locationRepo; final LocationRepo locationRepo;
final ErrorHandlerService errorHandlerService; final ErrorHandlerService errorHandlerService;
LocationViewModel({required this.locationRepo, required this.errorHandlerService}){ LocationViewModel({required this.locationRepo, required this.errorHandlerService}) {
placeValueInController(); placeValueInController();
} }
List<PlacePrediction> predictions = []; List<PlacePrediction> predictions = [];
PlacePrediction? selectedPrediction; PlacePrediction? selectedPrediction;
bool isPredictionLoading = false; bool isPredictionLoading = false;
GeocodeResponse? geocodeResponse; GeocodeResponse? geocodeResponse;
PlaceDetails? placeDetails; PlaceDetails? placeDetails;
@ -39,12 +36,11 @@ class LocationViewModel extends ChangeNotifier {
return HMSCameraServices.CameraPosition(target: HMSCameraServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18); return HMSCameraServices.CameraPosition(target: HMSCameraServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18);
} }
GMSMapServices.CameraPosition getGMSLocation() { GMSMapServices.CameraPosition getGMSLocation() {
return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18); return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18);
} }
void placeValueInController() async{ void placeValueInController() async {
if (await getIt<AppState>().isGMSAvailable) { if (await getIt<AppState>().isGMSAvailable) {
gmsController = Completer<GMSMapServices.GoogleMapController>(); gmsController = Completer<GMSMapServices.GoogleMapController>();
} else { } else {
@ -54,14 +50,14 @@ class LocationViewModel extends ChangeNotifier {
FutureOr<void> getPlacesPrediction(String input) async { FutureOr<void> getPlacesPrediction(String input) async {
predictions = []; predictions = [];
isPredictionLoading= true; isPredictionLoading = true;
final result = await locationRepo.getPlacePredictionsAsInput(input); final result = await locationRepo.getPlacePredictionsAsInput(input);
result.fold( result.fold(
(failure) { (failure) {
errorHandlerService.handleError(failure: failure); errorHandlerService.handleError(failure: failure);
}, },
(apiModel) { (apiModel) {
predictions = apiModel.data??[]; predictions = apiModel.data ?? [];
}, },
); );
isPredictionLoading = false; isPredictionLoading = false;
@ -99,21 +95,20 @@ class LocationViewModel extends ChangeNotifier {
handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) { handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) {
mapCapturedLocation = Location(lat: value.target.latitude, lng: value.target.longitude); mapCapturedLocation = Location(lat: value.target.latitude, lng: value.target.longitude);
} }
handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) { handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) {
mapCapturedLocation = Location(lat: value.target.lat, lng: value.target.lng); mapCapturedLocation = Location(lat: value.target.lat, lng: value.target.lng);
} }
handleOnCameraIdle(){ handleOnCameraIdle() {
if(mapCapturedLocation != null) { if (mapCapturedLocation != null) {
getPlaceEncodedData(mapCapturedLocation!.lat, mapCapturedLocation!.lng); getPlaceEncodedData(mapCapturedLocation!.lat, mapCapturedLocation!.lng);
} }
} }
void updateSearchQuery(String? value) { void updateSearchQuery(String? value) {
if(value == null || value.isEmpty){ if (value == null || value.isEmpty) {
predictions = []; predictions = [];
return; return;
} }
@ -123,16 +118,16 @@ class LocationViewModel extends ChangeNotifier {
void flushSearchPredictions() { void flushSearchPredictions() {
predictions = []; predictions = [];
mapCapturedLocation= null; mapCapturedLocation = null;
placeDetails= null; placeDetails = null;
geocodeResponse= null; geocodeResponse = null;
selectedPrediction= null; selectedPrediction = null;
notifyListeners(); notifyListeners();
} }
FutureOr<void> selectPlacePrediction(PlacePrediction placePrediction) async{ FutureOr<void> selectPlacePrediction(PlacePrediction placePrediction) async {
selectedPrediction= placePrediction; selectedPrediction = placePrediction;
await getPlaceDetails(placePrediction.placeID); await getPlaceDetails(placePrediction.placeID);
} }
@ -141,8 +136,6 @@ class LocationViewModel extends ChangeNotifier {
} }
void moveController(Location location) { void moveController(Location location) {
print("moving to location");
print("gmsController is null or not $gmsController");
if (getIt<AppState>().isGMSAvailable) { if (getIt<AppState>().isGMSAvailable) {
gmsController?.future.then((controller) { gmsController?.future.then((controller) {
controller.animateCamera( controller.animateCamera(
@ -169,4 +162,4 @@ class LocationViewModel extends ChangeNotifier {
}); });
} }
} }
} }

@ -170,8 +170,6 @@ class _CmcSelectionReviewPageState extends State<CmcSelectionReviewPage> {
latitude: double.parse(lat), latitude: double.parse(lat),
longitude: double.parse(lng), longitude: double.parse(lng),
address: hospitalName, address: hospitalName,
title: "Hospital Location".needTranslation,
showTitle: false,
showAddress: false, showAddress: false,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onDirectionsTap: () => _launchDirections(selectedHospital), onDirectionsTap: () => _launchDirections(selectedHospital),

@ -366,7 +366,12 @@ class _ComprehensiveCheckupPageState extends State<ComprehensiveCheckupPage> {
if (pendingOrder == null && _selectedServiceId != null) { if (pendingOrder == null && _selectedServiceId != null) {
return SafeArea( return SafeArea(
top: false, top: false,
child: Padding( child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.r,
hasShadow: true,
),
padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h), padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h),
child: CustomButton( child: CustomButton(
borderWidth: 0, borderWidth: 0,

@ -10,10 +10,8 @@ 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/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_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/get_cmc_all_orders_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart';
import 'package:hmg_patient_app_new/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; 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/appbar/collapsing_list_view.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/app_custom_chip_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -75,7 +73,6 @@ class _HhcOrderDetailPageState extends State<HhcOrderDetailPage> {
Widget _buildOrderCard(GetCMCAllOrdersResponseModel order, {bool isLoading = false}) { Widget _buildOrderCard(GetCMCAllOrdersResponseModel order, {bool isLoading = false}) {
final statusColor = _getStatusColor(order.statusId); final statusColor = _getStatusColor(order.statusId);
final canCancel = order.statusId == 1 || order.statusId == 2;
return AnimatedContainer( return AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
@ -150,27 +147,27 @@ class _HhcOrderDetailPageState extends State<HhcOrderDetailPage> {
], ],
), ),
// Cancel Button // // Cancel Button
if (canCancel || isLoading) ...[ // if (canCancel || isLoading) ...[
SizedBox(height: 16.h), // SizedBox(height: 16.h),
Row( // Row(
children: [ // children: [
Expanded( // Expanded(
child: CustomButton( // child: CustomButton(
text: "Cancel Order".needTranslation, // text: "Cancel Order".needTranslation,
onPressed: isLoading ? () {} : () => HhcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), // onPressed: isLoading ? () {} : () => HhcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order),
backgroundColor: AppColors.primaryRedColor, // backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor, // borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor, // textColor: AppColors.whiteColor,
fontSize: 14.f, // fontSize: 14.f,
fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
borderRadius: 10.r, // borderRadius: 10.r,
height: 44.h, // height: 44.h,
).toShimmer2(isShow: isLoading), // ).toShimmer2(isShow: isLoading),
), // ),
], // ],
), // ),
] // ]
], ],
), ),
), ),
@ -219,6 +216,7 @@ class _HhcOrderDetailPageState extends State<HhcOrderDetailPage> {
} }
return ListView.separated( return ListView.separated(
padding: EdgeInsets.only(top: 24.h),
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemCount: viewModel.hhcOrdersList.length, itemCount: viewModel.hhcOrdersList.length,

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.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/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.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'; 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/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
@ -17,6 +18,7 @@ import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; 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/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart'; import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -61,28 +63,9 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
} }
Widget _buildPendingOrderCard(GetCMCAllOrdersResponseModel order) { Widget _buildPendingOrderCard(GetCMCAllOrdersResponseModel order) {
int status = order.statusId ?? 0;
String statusDisp = order.statusText ?? "";
Color statusColor;
if (status == 1) {
// pending
statusColor = AppColors.statusPendingColor;
} else if (status == 2) {
// processing
statusColor = AppColors.statusProcessingColor;
} else if (status == 3) {
// completed
statusColor = AppColors.statusCompletedColor;
} else {
// cancel / rejected
statusColor = AppColors.statusRejectedColor;
}
final canCancel = order.statusId == 1 || order.statusId == 2; final canCancel = order.statusId == 1 || order.statusId == 2;
final isArabic = getIt.get<AppState>().isArabic(); final isArabic = getIt.get<AppState>().isArabic();
// Extract services from orderselectedservice
List<dynamic> selectedServices = []; List<dynamic> selectedServices = [];
if (order.orderselectedservice != null) { if (order.orderselectedservice != null) {
if (order.orderselectedservice is List) { if (order.orderselectedservice is List) {
@ -108,16 +91,12 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Row(
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), children: [
decoration: BoxDecoration( "Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500),
color: statusColor.withValues(alpha: 0.1), SizedBox(width: 4.w),
borderRadius: BorderRadius.circular(8.r), "${order.iD ?? '-'}".toText16(isBold: true),
), ],
child: statusDisp.toText12(
color: statusColor,
fontWeight: FontWeight.w600,
),
), ),
SizedBox(width: 8.w), SizedBox(width: 8.w),
if (order.created != null) if (order.created != null)
@ -127,17 +106,7 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
), ),
], ],
), ),
SizedBox(height: 8.h),
SizedBox(height: 16.h),
// Request ID
Row(
children: [
"Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500),
SizedBox(width: 4.w),
"${order.iD ?? '-'}".toText16(isBold: true),
],
),
// Services List // Services List
if (selectedServices.isNotEmpty) ...[ if (selectedServices.isNotEmpty) ...[
@ -212,13 +181,13 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
], ],
), ),
); );
}).toList(), }),
], ],
), ),
), ),
], ],
SizedBox(height: 12.h), SizedBox(height: 8.h),
// Info message // Info message
Container( Container(
@ -274,99 +243,148 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
); );
} }
Widget _buildServiceSelectionList(List<GetCMCServicesResponseModel> services) { _buildServicesListBottomsSheet(List<GetCMCServicesResponseModel> services) {
if (services.isEmpty) { showCommonBottomSheetWithoutHeight(
return Center( hasBottomPadding: false,
child: Padding( padding: EdgeInsets.only(top: 24.h),
padding: EdgeInsets.all(24.h), context,
child: Text( title: 'Select Services'.needTranslation,
'No services available'.needTranslation, isCloseButtonVisible: true,
style: TextStyle( isDismissible: true,
fontSize: 16.h, callBackFunc: () {},
color: AppColors.greyTextColor, child: services.isEmpty
), ? Center(
), child: Padding(
), padding: EdgeInsets.all(24.h),
); child: Text(
} 'No services available'.needTranslation,
style: TextStyle(
return Consumer<HmgServicesViewModel>( fontSize: 16.h,
builder: (context, viewModel, child) { color: AppColors.greyTextColor,
return Column( ),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [
SizedBox(height: 8.h),
SizedBox(height: 16.h),
Text(
'Select Services'.needTranslation,
style: TextStyle(
fontSize: 20.h,
fontWeight: FontWeight.w700,
color: AppColors.blackColor,
letterSpacing: -0.8,
), ),
).paddingOnly(left: 16.w, right: 16.w), )
SizedBox(height: 12.h), : Consumer<HmgServicesViewModel>(
ListView.builder( builder: (context, hmgServicesViewModel, child) {
padding: EdgeInsets.symmetric(horizontal: 16.w), final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList);
itemCount: services.length, final hasSelectedServices = pendingOrder == null && hmgServicesViewModel.selectedHhcServices.isNotEmpty;
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final service = services[index];
final isSelected = viewModel.isHhcServiceSelected(service);
final isArabic = getIt.get<AppState>().isArabic();
final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? '');
return AnimatedContainer( return Stack(
duration: Duration(milliseconds: 300), children: [
curve: Curves.easeInOut, // Services List
margin: EdgeInsets.only(bottom: 12.h), ConstrainedBox(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( constraints: BoxConstraints(maxHeight: SizeUtils.height * 0.7),
color: AppColors.whiteColor, child: ListView.separated(
borderRadius: 16.r, separatorBuilder: (context, index) => Divider(color: AppColors.dividerColor).paddingSymmetrical(16.w, 0),
hasShadow: true, padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: hasSelectedServices ? 160.h : 8.h),
), shrinkWrap: true,
child: Material( itemCount: services.length,
color: Colors.transparent, itemBuilder: (context, index) {
child: InkWell( final service = services[index];
onTap: () => viewModel.toggleHhcServiceSelection(service), final isSelected = hmgServicesViewModel.isHhcServiceSelected(service);
borderRadius: BorderRadius.circular(16.r), final isArabic = getIt.get<AppState>().isArabic();
child: Container( final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? '');
padding: EdgeInsets.all(16.w),
child: Row( return AnimatedContainer(
children: [ duration: Duration(milliseconds: 300),
Checkbox( curve: Curves.easeInOut,
value: isSelected, child: InkWell(
onChanged: (v) => viewModel.toggleHhcServiceSelection(service), onTap: () => hmgServicesViewModel.toggleHhcServiceSelection(service),
activeColor: AppColors.primaryRedColor, borderRadius: BorderRadius.circular(16.r),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, child: Container(
visualDensity: VisualDensity.compact, padding: EdgeInsets.all(8.w),
child: Row(
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
width: 24.w,
height: 24.w,
decoration: BoxDecoration(
color: isSelected ? AppColors.primaryRedColor : Colors.transparent,
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: isSelected ? AppColors.primaryRedColor : AppColors.borderGrayColor,
width: 1.w,
),
),
child: isSelected ? Icon(Icons.check, size: 18.f, color: AppColors.whiteColor) : null,
),
SizedBox(width: 12.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
serviceName.toText16(
weight: FontWeight.w500,
color: AppColors.blackColor,
maxlines: 2,
),
],
),
),
],
),
),
), ),
SizedBox(width: 12.w), );
Expanded( },
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, ),
if (hasSelectedServices)
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 24.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.r,
hasShadow: true,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
serviceName.toText16( Column(
weight: FontWeight.w400, crossAxisAlignment: CrossAxisAlignment.start,
color: AppColors.blackColor, children: [
maxlines: 2, "Selected Services".needTranslation.toText12(
color: AppColors.textColorLight,
fontWeight: FontWeight.w600,
),
"${hmgServicesViewModel.selectedHhcServices.length} service(s) selected".toText14(
isBold: true,
weight: FontWeight.bold,
),
],
), ),
], ],
), ),
), SizedBox(height: 16.h),
], CustomButton(
borderWidth: 0,
text: "Next".needTranslation,
onPressed: () {
Navigator.pop(context);
_proceedWithSelectedService();
},
textColor: AppColors.whiteColor,
borderRadius: 12.r,
borderColor: Colors.transparent,
),
],
),
), ),
), ),
), ],
),
); );
}, },
), ),
],
);
},
); );
} }
@ -426,77 +444,70 @@ class _HhcProceduresPageState extends State<HhcProceduresPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CollapsingListView( return Scaffold(
title: "Home Health Care".needTranslation, backgroundColor: AppColors.bgScaffoldColor,
history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)), body: Column(
bottomChild: Consumer<HmgServicesViewModel>( children: [
builder: (context, hmgServicesViewModel, child) { Expanded(
if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) return SizedBox.shrink(); child: CollapsingListView(
final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); title: "Home Health Care".needTranslation,
if (pendingOrder == null && hmgServicesViewModel.selectedHhcServices.isNotEmpty) { history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)),
return SafeArea( child: Consumer<HmgServicesViewModel>(
top: false, builder: (context, hmgServicesViewModel, child) {
child: Container( if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) {
color: AppColors.whiteColor, return _buildLoadingShimmer();
child: Column( }
mainAxisSize: MainAxisSize.min, final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList);
children: [ if (pendingOrder != null) {
// Selected Services Summary Widget return _buildPendingOrderCard(pendingOrder);
Container( } else {
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 4.h), return Column(
padding: EdgeInsets.all(16.w), children: [
child: Row( Center(
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Utils.getNoDataWidget(
children: [ context,
Column( noDataText: "You have no pending requests.".needTranslation,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Selected Services".needTranslation.toText12(
color: AppColors.textColorLight,
fontWeight: FontWeight.w600,
),
"${hmgServicesViewModel.selectedHhcServices.length} service(s) selected".toText14(
isBold: true,
weight: FontWeight.bold,
),
],
), ),
], ),
), ],
), );
// Next Button }
Padding( },
padding: EdgeInsets.only(left: 16.w, right: 16.w),
child: CustomButton(
borderWidth: 0,
text: "Next".needTranslation,
onPressed: _proceedWithSelectedService,
textColor: AppColors.whiteColor,
borderRadius: 12.r,
borderColor: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 14.h),
),
),
],
),
), ),
); ),
} ),
return SizedBox.shrink(); Consumer(
}, builder: (BuildContext context, HmgServicesViewModel hmgServicesViewModel, Widget? child) {
), if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) {
child: Consumer<HmgServicesViewModel>( return SizedBox.shrink();
builder: (context, hmgServicesViewModel, child) { }
if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) { final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList);
return _buildLoadingShimmer(); if (pendingOrder == null) {
} return Container(
final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
if (pendingOrder != null) { color: AppColors.whiteColor,
return _buildPendingOrderCard(pendingOrder); borderRadius: 24.r,
} else { hasShadow: true,
return _buildServiceSelectionList(hmgServicesViewModel.hhcServicesList); ),
} child: Padding(
}, padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 24.h, top: 24.h),
child: CustomButton(
borderWidth: 0,
text: "Create new request".needTranslation,
onPressed: () => _buildServicesListBottomsSheet(hmgServicesViewModel.hhcServicesList),
textColor: AppColors.whiteColor,
borderRadius: 12.r,
borderColor: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 14.h),
),
),
);
}
return SizedBox.shrink();
},
),
],
), ),
); );
} }

@ -15,6 +15,7 @@ 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/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart'; import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart';
@ -68,40 +69,26 @@ class _HhcSelectionReviewPageState extends State<HhcSelectionReviewPage> {
Widget _buildSelectedServicesCard(bool isArabic) { Widget _buildSelectedServicesCard(bool isArabic) {
return Container( return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( width: double.infinity,
color: AppColors.whiteColor, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r),
borderRadius: 16.r,
),
padding: EdgeInsets.all(16.w), padding: EdgeInsets.all(16.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
"Selected Services".needTranslation.toText14( "Selected Services".needTranslation.toText14(
weight: FontWeight.w600, weight: FontWeight.w600,
color: AppColors.greyTextColor, color: AppColors.textColor,
letterSpacing: -0.4, letterSpacing: -0.4,
), ),
SizedBox(height: 12.h), SizedBox(height: 12.h),
...widget.selectedServices.map((service) { Wrap(
final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); spacing: 8.w,
final price = service.priceTotal ?? 0.0; runSpacing: 12.w,
return Padding( children: widget.selectedServices.map((service) {
padding: EdgeInsets.only(bottom: 4.h), final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? '');
child: Row( return AppCustomChipWidget(labelText: serviceName.needTranslation);
mainAxisAlignment: MainAxisAlignment.spaceBetween, }).toList(),
children: [ ),
Expanded(
child: serviceName.toText14(
weight: FontWeight.w600,
color: AppColors.blackColor,
letterSpacing: -0.5,
maxlines: 2,
),
),
],
),
);
}),
], ],
), ),
); );
@ -117,8 +104,8 @@ class _HhcSelectionReviewPageState extends State<HhcSelectionReviewPage> {
return SizedBox.shrink(); return SizedBox.shrink();
} }
final double lat = mapCapturedLocation.lat ?? 0.0; final double lat = mapCapturedLocation?.lat ?? 0.0;
final double lng = mapCapturedLocation.lng ?? 0.0; final double lng = mapCapturedLocation?.lng ?? 0.0;
if (lat == 0.0 || lng == 0.0) return SizedBox.shrink(); if (lat == 0.0 || lng == 0.0) return SizedBox.shrink();
@ -132,36 +119,25 @@ class _HhcSelectionReviewPageState extends State<HhcSelectionReviewPage> {
latitude: lat, latitude: lat,
longitude: lng, longitude: lng,
address: address, address: address,
title: "Service Location".needTranslation,
onDirectionsTap: () => _launchDirectionsToLocation(lat, lng, address), onDirectionsTap: () => _launchDirectionsToLocation(lat, lng, address),
); );
} }
Widget _buildBottomButton() { Widget _buildBottomButton() {
return SafeArea( return Container(
top: false, padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 24.h),
child: Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), color: AppColors.whiteColor,
decoration: BoxDecoration( borderRadius: 24.r,
color: AppColors.whiteColor, hasShadow: true,
boxShadow: [ ),
BoxShadow( child: CustomButton(
color: Color.fromARGB(13, 0, 0, 0), borderWidth: 0,
blurRadius: 8, text: "Confirm".needTranslation,
offset: Offset(0, -2), onPressed: () => _handleConfirm(),
), textColor: AppColors.whiteColor,
], borderRadius: 12.r,
), borderColor: Colors.transparent,
child: CustomButton(
text: "Confirm".needTranslation,
onPressed: _handleConfirm,
textColor: AppColors.whiteColor,
backgroundColor: AppColors.successColor,
borderRadius: 12.r,
borderColor: Colors.transparent,
borderWidth: 0,
padding: EdgeInsets.symmetric(vertical: 14.h),
),
), ),
); );
} }

@ -10,12 +10,11 @@ import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_mode
import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/medical_report/medical_report_request_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_report/medical_report_request_page.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/presentation/medical_report/widgets/patient_medical_report_card.dart'; import 'package:hmg_patient_app_new/presentation/medical_report/widgets/patient_medical_report_card.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -53,7 +52,8 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
medicalFileViewModel.onMedicalReportTabChange(0); medicalFileViewModel.onMedicalReportTabChange(0);
}, },
backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.bgRedLightColor : AppColors.whiteColor, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), borderColor:
medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
textColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.blackColor, textColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -68,7 +68,8 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
medicalFileViewModel.onMedicalReportTabChange(1); medicalFileViewModel.onMedicalReportTabChange(1);
}, },
backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.bgRedLightColor : AppColors.whiteColor, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), borderColor:
medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
textColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.blackColor, textColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -83,7 +84,8 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
medicalFileViewModel.onMedicalReportTabChange(2); medicalFileViewModel.onMedicalReportTabChange(2);
}, },
backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.bgRedLightColor : AppColors.whiteColor, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), borderColor:
medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
textColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.blackColor, textColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -131,7 +133,8 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
child: AnimatedContainer( child: AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOut, curve: Curves.easeInOut,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
child: PatientMedicalReportCard( child: PatientMedicalReportCard(
patientMedicalReportResponseModel: medicalFileVM.patientMedicalReportList[index], patientMedicalReportResponseModel: medicalFileVM.patientMedicalReportList[index],
medicalFileViewModel: medicalFileVM, medicalFileViewModel: medicalFileVM,
@ -141,7 +144,8 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
), ),
), ),
) )
: Utils.getNoDataWidget(context, noDataText: "You don't have any medical reports yet.".needTranslation).paddingSymmetrical(24.h, 24.h); : Utils.getNoDataWidget(context, noDataText: "You don't have any medical reports yet.".needTranslation)
.paddingSymmetrical(24.h, 24.h);
}, },
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
), ),
@ -188,11 +192,10 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
fontSize: 16, fontSize: 16.f,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 46.h,
height: 45.h,
icon: AppAssets.requests, icon: AppAssets.requests,
iconColor: AppColors.whiteColor, iconColor: AppColors.whiteColor,
iconSize: 20.h, iconSize: 20.h,
@ -218,7 +221,9 @@ class _MedicalReportsPageState extends State<MedicalReportsPage> {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
await medicalFileViewModel.insertRequestForMedicalReport(onSuccess: (val) { await medicalFileViewModel.insertRequestForMedicalReport(onSuccess: (val) {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(context, child: Utils.getSuccessWidget(loadingText: "Your medical report request has been successfully submitted.".needTranslation), callBackFunc: () { showCommonBottomSheetWithoutHeight(context,
child: Utils.getSuccessWidget(loadingText: "Your medical report request has been successfully submitted.".needTranslation),
callBackFunc: () {
medicalFileViewModel.setIsPatientMedicalReportsLoading(true); medicalFileViewModel.setIsPatientMedicalReportsLoading(true);
medicalFileViewModel.onMedicalReportTabChange(0); medicalFileViewModel.onMedicalReportTabChange(0);
medicalFileViewModel.getPatientMedicalReportList(); medicalFileViewModel.getPatientMedicalReportList();

@ -21,7 +21,7 @@ class LocationMapWidget extends StatelessWidget {
final String address; final String address;
/// The title to show above the map (e.g., "Service Location", "Hospital Location") /// The title to show above the map (e.g., "Service Location", "Hospital Location")
final String title; final String? title;
/// The zoom level for the map (default: 14) /// The zoom level for the map (default: 14)
final int zoomLevel; final int zoomLevel;
@ -36,9 +36,6 @@ class LocationMapWidget extends StatelessWidget {
/// Whether to show the address container (default: true) /// Whether to show the address container (default: true)
final bool showAddress; final bool showAddress;
/// Whether to show the title (default: true)
final bool showTitle;
/// Custom map type (default: roadmap) /// Custom map type (default: roadmap)
final String mapType; final String mapType;
final EdgeInsets? padding; final EdgeInsets? padding;
@ -48,12 +45,11 @@ class LocationMapWidget extends StatelessWidget {
required this.latitude, required this.latitude,
required this.longitude, required this.longitude,
required this.address, required this.address,
required this.title, this.title,
this.zoomLevel = 14, this.zoomLevel = 14,
this.mapSize = '350x165', this.mapSize = '350x165',
this.onDirectionsTap, this.onDirectionsTap,
this.showAddress = true, this.showAddress = true,
this.showTitle = true,
this.mapType = 'roadmap', this.mapType = 'roadmap',
this.padding, this.padding,
}); });
@ -70,18 +66,15 @@ class LocationMapWidget extends StatelessWidget {
"https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=$zoomLevel&size=$mapSize&maptype=$mapType&markers=color:red%7C$latitude,$longitude&key=${ApiKeyConstants.googleMapsApiKey}"; "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=$zoomLevel&size=$mapSize&maptype=$mapType&markers=color:red%7C$latitude,$longitude&key=${ApiKeyConstants.googleMapsApiKey}";
return Container( return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r),
color: AppColors.whiteColor,
borderRadius: 16.r,
),
padding: padding ?? EdgeInsets.all(16.w), padding: padding ?? EdgeInsets.all(16.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Title // Title
if (showTitle) ...[ if (title != null) ...[
Text( Text(
title, title ?? "",
style: TextStyle( style: TextStyle(
fontSize: 16.f, fontSize: 16.f,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -94,35 +87,22 @@ class LocationMapWidget extends StatelessWidget {
// Address display // Address display
if (showAddress) ...[ if (showAddress) ...[
Container( Row(
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 14.h), children: [
decoration: BoxDecoration( Expanded(
color: AppColors.bgScaffoldColor, child: Text(
borderRadius: BorderRadius.circular(12.r), address,
border: Border.all( style: TextStyle(
color: AppColors.greyColor.withAlpha(51), fontSize: 14.f,
width: 1, fontWeight: FontWeight.w500,
), color: AppColors.blackColor,
), letterSpacing: -0.4,
child: Row(
children: [
Icon(Icons.location_on, color: AppColors.primaryRedColor, size: 20.h),
SizedBox(width: 8.w),
Expanded(
child: Text(
address,
style: TextStyle(
fontSize: 14.f,
fontWeight: FontWeight.w500,
color: AppColors.blackColor,
letterSpacing: -0.4,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
), ),
maxLines: 2,
overflow: TextOverflow.ellipsis,
), ),
], ),
), ],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
], ],

Loading…
Cancel
Save