|
|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|