fixed the suggested design changes. (Not reminder ones)

pull/138/head
faizatflutter 2 weeks ago
parent 460e32d25a
commit 57f693e0d9

@ -79,23 +79,22 @@ class ServicesPage extends StatelessWidget {
route: AppRoutes.eReferralPage,
),
HmgServicesComponentModel(
3,
"Blood Donation".needTranslation,
"".needTranslation,
AppAssets.blood_donation_icon,
bgColor: AppColors.bloodDonationCardColor,
true,
route: null,
onTap: () async {
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
LoaderBottomSheet.hideLoader();
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
CustomPageRoute(
page: BloodDonationPage(),
),
);
3,
"Blood Donation".needTranslation,
"".needTranslation,
AppAssets.blood_donation_icon,
bgColor: AppColors.bloodDonationCardColor,
true,
route: null, onTap: () async {
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
LoaderBottomSheet.hideLoader();
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
CustomPageRoute(
page: BloodDonationPage(),
),
);
// }, onError: (err) {
// LoaderBottomSheet.hideLoader();
// });
@ -159,30 +158,20 @@ class ServicesPage extends StatelessWidget {
route: null, // Set to null since we handle navigation in onTap
onTap: () async {
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
// Fetch user details first to check if user has data
await waterMonitorVM.fetchUserDetailsForMonitoring(
onSuccess: (userDetail) {
LoaderBottomSheet.hideLoader();
// Navigate based on whether user has data or not
if (userDetail == null) {
// No data found, populate form with authenticated user data
waterMonitorVM.populateFromAuthenticatedUser();
// Navigate to settings screen
context.navigateWithName(AppRoutes.waterMonitorSettingsScreen);
} else {
// Data exists, navigate to consumption screen
context.navigateWithName(AppRoutes.waterConsumptionScreen);
}
},
onError: (error) {
LoaderBottomSheet.hideLoader();
// On error, navigate to consumption screen (it will handle the error state)
context.navigateWithName(AppRoutes.waterConsumptionScreen);
},
);

Loading…
Cancel
Save