pull/156/head
haroon amjad 3 days ago
parent fc750174fe
commit 44ce353dac

@ -160,6 +160,7 @@ dependencies {
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
implementation("com.mapbox.maps:android:11.5.0")
implementation("com.mapbox.mapboxsdk:mapbox-sdk-turf:7.3.1")
// implementation("com.mapbox.maps:android:11.4.0")
// AARs

@ -55,11 +55,12 @@ class Utils {
"IsActive": true,
"IsHmg": true,
"IsVidaPlus": false,
"Latitude": "24.8113774",
"Longitude": "46.6239813",
"Latitude": "24.8111548",
"Longitude": "46.6217912",
"MainProjectID": 130,
"ProjectOutSA": false,
"UsingInDoctorApp": false
"UsingInDoctorApp": false,
"IsHMC": false
},{
"Desciption": "Jeddah Fayhaa Hospital",
"DesciptionN": "مستشفى جدة الفيحاء",
@ -75,11 +76,12 @@ class Utils {
"IsActive": true,
"IsHmg": true,
"IsVidaPlus": false,
"Latitude": "24.8113774",
"Longitude": "46.6239813",
"Latitude": "21.5086703",
"Longitude": "39.2121855",
"MainProjectID": 130,
"ProjectOutSA": false,
"UsingInDoctorApp": false
"UsingInDoctorApp": false,
"IsHMC": false
}
];

@ -1,5 +1,7 @@
import 'package:flutter/material.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/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/penguin_method_channel.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart';
@ -17,10 +19,17 @@ class HospitalSelectionBottomSheetViewModel extends ChangeNotifier {
int hmgCount = 0;
TextEditingController searchController = TextEditingController();
final AppState appState;
LocationUtils locationUtils = getIt.get<LocationUtils>();
HospitalSelectionBottomSheetViewModel(this.appState) {
locationUtils.getCurrentLocation(onSuccess: (value) {
Utils.navigationProjectsList.forEach((element) {
HospitalsModel model = HospitalsModel.fromJson(element);
double dist = Utils.distance(value.latitude, value.longitude, double.parse(model.latitude!), double.parse(model.longitude!)).ceilToDouble();
print(dist);
model.distanceInKilometers = dist;
if (model.isHMC == true) {
hmcHospitalList.add(model);
} else {
@ -30,7 +39,12 @@ class HospitalSelectionBottomSheetViewModel extends ChangeNotifier {
});
hmgCount = hmgHospitalList.length;
hmcCount = hmcHospitalList.length;
listOfData.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
hmgHospitalList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
getDisplayList();
});
}
getDisplayList() {

@ -4,15 +4,18 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/route_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/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart';
import 'package:hmg_patient_app_new/features/hospital/hospital_selection_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
@ -36,6 +39,7 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart';
import '../../core/dependencies.dart' show getIt;
import '../emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart';
class ServicesPage extends StatelessWidget {
ServicesPage({super.key});
@ -44,14 +48,8 @@ class ServicesPage extends StatelessWidget {
late MedicalFileViewModel medicalFileViewModel;
late final List<HmgServicesComponentModel> hmgServices = [
HmgServicesComponentModel(
11,
"Emergency Services".needTranslation,
"".needTranslation,
AppAssets.emergency_services_icon,
bgColor: AppColors.primaryRedColor,
true,
route: null, onTap: () {
HmgServicesComponentModel(11, "Emergency Services".needTranslation, "".needTranslation, AppAssets.emergency_services_icon, bgColor: AppColors.primaryRedColor, true, route: null, onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<EmergencyServicesViewModel>().flushData();
getIt.get<EmergencyServicesViewModel>().getTransportationOrders(
showLoader: false,
@ -65,6 +63,9 @@ class ServicesPage extends StatelessWidget {
settings: const RouteSettings(name: '/EmergencyServicesPage'),
),
);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
HmgServicesComponentModel(
11,
@ -75,15 +76,13 @@ class ServicesPage extends StatelessWidget {
true,
route: AppRoutes.bookAppointmentPage,
),
HmgServicesComponentModel(
5,
"Complete Checkup".needTranslation,
"".needTranslation,
AppAssets.comprehensiveCheckup,
bgColor: AppColors.bgGreenColor,
true,
route: AppRoutes.comprehensiveCheckupPage,
),
HmgServicesComponentModel(5, "Complete Checkup".needTranslation, "".needTranslation, AppAssets.comprehensiveCheckup, bgColor: AppColors.bgGreenColor, true, route: null, onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.comprehensiveCheckupPage);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
HmgServicesComponentModel(
11,
"Indoor Navigation".needTranslation,
@ -92,17 +91,51 @@ class ServicesPage extends StatelessWidget {
bgColor: Color(0xff45A2F8),
true,
route: null,
onTap: () {},
onTap: () {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.selectHospital.tr(),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: ChangeNotifierProvider(
create: (context) => HospitalSelectionBottomSheetViewModel(getIt()),
child: Consumer<HospitalSelectionBottomSheetViewModel>(
builder: (_, vm, __) => HospitalBottomSheetBody(
searchText: vm.searchController,
displayList: vm.displayList,
onFacilityClicked: (value) {
vm.setSelectedFacility(value);
vm.getDisplayList();
},
onHospitalClicked: (hospital) {
Navigator.pop(GetIt.instance<NavigationService>().navigatorKey.currentContext!);
vm.openPenguin(hospital);
},
onHospitalSearch: (value) {
vm.searchHospitals(value ?? "");
},
selectedFacility: vm.selectedFacility,
hmcCount: vm.hmcCount,
hmgCount: vm.hmgCount,
),
HmgServicesComponentModel(
11,
"E-Referral Services".needTranslation,
"".needTranslation,
AppAssets.eReferral,
bgColor: AppColors.eReferralCardColor,
true,
route: AppRoutes.eReferralPage,
),
),
isFullScreen: false,
isCloseButtonVisible: true,
hasBottomPadding: false,
backgroundColor: AppColors.bottomSheetBgColor,
callBackFunc: () {
GetIt.instance<NavigationService>().navigatorKey.currentContext!.read<EmergencyServicesViewModel>().clearSearchText();
},
);
},
),
HmgServicesComponentModel(
11, "E-Referral Services".needTranslation, "".needTranslation, AppAssets.eReferral, bgColor: AppColors.eReferralCardColor, true, route: null, onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.eReferralPage);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
HmgServicesComponentModel(
3,
"Blood Donation".needTranslation,
@ -180,7 +213,14 @@ class ServicesPage extends StatelessWidget {
AppAssets.general_health,
bgColor: AppColors.whiteColor,
true,
route: AppRoutes.healthTrackersPage,
route: null,
onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.healthTrackersPage);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
},
),
HmgServicesComponentModel(
11,
@ -191,6 +231,7 @@ class ServicesPage extends StatelessWidget {
true,
route: null, // Set to null since we handle navigation in onTap
onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
@ -209,6 +250,9 @@ class ServicesPage extends StatelessWidget {
context.navigateWithName(AppRoutes.waterConsumptionPage);
},
);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
},
),
HmgServicesComponentModel(
@ -236,7 +280,14 @@ class ServicesPage extends StatelessWidget {
AppAssets.smartwatch_icon,
bgColor: AppColors.whiteColor,
true,
route: AppRoutes.smartWatches,
route: null,
onTap: () async {
if (getIt.get<AppState>().isAuthenticated) {
getIt.get<NavigationService>().pushPageRoute(AppRoutes.smartWatches);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
},
// route: AppRoutes.huaweiHealthExample,
),
];
@ -329,12 +380,15 @@ class ServicesPage extends StatelessWidget {
],
),
Spacer(),
Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) {
getIt.get<AppState>().isAuthenticated
? Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) {
return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false)
.toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h);
}),
})
: "Login to view your wallet balance".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2),
Spacer(),
CustomButton(
getIt.get<AppState>().isAuthenticated
? CustomButton(
height: 40.h,
icon: AppAssets.recharge_icon,
iconSize: 16.w,
@ -350,10 +404,15 @@ class ServicesPage extends StatelessWidget {
onPressed: () {
Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage()));
},
),
)
: SizedBox.shrink(),
],
).onPress(() {
).onPress(() async {
if (getIt.get<AppState>().isAuthenticated) {
Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage()));
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
),
),
@ -375,12 +434,13 @@ class ServicesPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.services_medical_file_icon, width: 30.w, height: 30.h),
"Medical Files".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded,
LocaleKeys.medicalFile.tr().toText14(weight: FontWeight.w600, maxlines: 2).expanded,
Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward),
],
),
Spacer(),
Wrap(
getIt.get<AppState>().isAuthenticated
? Wrap(
spacing: -8.h,
// runSpacing: 0.h,
children: [
@ -409,9 +469,11 @@ class ServicesPage extends StatelessWidget {
fit: BoxFit.contain,
),
],
),
)
: "Login to view your medical file".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2),
Spacer(),
CustomButton(
getIt.get<AppState>().isAuthenticated
? CustomButton(
height: 40.h,
icon: AppAssets.add_icon,
iconSize: 16.w,
@ -434,14 +496,19 @@ class ServicesPage extends StatelessWidget {
medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms);
});
},
),
)
: SizedBox.shrink(),
],
).onPress(() {
).onPress(() async {
if (getIt.get<AppState>().isAuthenticated) {
Navigator.of(context).push(
CustomPageRoute(
page: MedicalFilePage(),
),
);
} else {
await getIt.get<AuthenticationViewModel>().onLoginPressed();
}
}),
),
),

@ -42,15 +42,15 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
? RotatedBox(
quarterTurns: 90,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back,
width: 32.w,
height: 32.h,
icon: AppAssets.forward_top_nav_icon,
width: 24.w,
height: 24.h,
),
)
: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back,
width: 32.w,
height: 32.h,
icon: AppAssets.forward_top_nav_icon,
width: 24.w,
height: 24.h,
),
),
),

Loading…
Cancel
Save