nextPage method

Future<void> nextPage(
  1. List<AnimationController> aniController,
  2. ScrollController singleChildScrollController,
  3. int stepsListLength,
  4. GlobalKey<State<StatefulWidget>> key,
  5. BuildContext context,
)

Implementation

Future<void> nextPage(
    List<AnimationController> aniController,
    ScrollController singleChildScrollController,
    // List<StepHorizontalAnimation> stepsList,
    int stepsListLength,
    GlobalKey key,
    BuildContext context) async {
  animationController = aniController;
  stepsLength = stepsListLength;
  singleScrollController = singleChildScrollController;
  globalKey = key;
  notifyListeners();
  final getWizardBarViewModel = Provider.of<WizardBarViewModel>(context, listen: false);
  if (currentLevel < stepsListLength - 1 && enableButton == false) {
    // print(currentLevel);
    enableButton = true;
    notifyListeners();
    try {
      // await apiCallPage(currentLevel, context);
      await Future.delayed(const Duration(milliseconds: 400));
      // if(enableNextPage()==true){
      currentLevel = currentLevel + 1;
      textFieldFilled = 1;
      // enableButton=true;
      notifyListeners();
      pageViewController.nextPage(
        duration: const Duration(milliseconds: 600),
        curve: Curves.linear,
      );
      nextScrollListener(singleChildScrollController, key);

      toggleScale(aniController, stepsListLength);

      await Future.delayed(const Duration(milliseconds: 300));
      enableButton = false;
      notifyListeners();
      // }
    } catch (e) {
      await Future.delayed(const Duration(milliseconds: 300));
      enableButton = false;
      notifyListeners();
      // throw Exception();
    }
    getWizardBarViewModel.initFilled();
  }
  // print(currentLevel);
}