onPageChangedCallback method

void onPageChangedCallback(
  1. int activePageIndex
)

This function is called when the user swipes to a different page.

Implementation

void onPageChangedCallback(int activePageIndex) {
  if (activePageIndex == 3) {
    // If the user swipes past the last page, redirect to WelcomeScreen
    userStorage.write('isFirstTime', false);
    Get.offAll(() => const WelcomeScreen());
  } else {
    currentPage.value = activePageIndex;
  }
}