previousPage method

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

Implementation

Future<void> previousPage(
  List<AnimationController> aniController,
  ScrollController singleChildScrollController,
  // List<StepHorizontalAnimation> stepsList,
  int stepsListLength,
  GlobalKey key,
) async {
  if (currentLevel > 0 && enableButton == false) {
    currentLevel = currentLevel - 1;
    enableButton = true;
    notifyListeners();
    pageViewController.previousPage(duration: const Duration(milliseconds: 600), curve: Curves.linear);
    previusScrollListener(singleChildScrollController, key);

    toggleScale(aniController, stepsListLength);
    // print("currentLevel: $currentLevel");
    await Future.delayed(const Duration(milliseconds: 300));
    enableButton = false;
    notifyListeners();
  } else if (enableButton == false) {
    // print("currentLevel: $currentLevel");
    await Future.delayed(const Duration(milliseconds: 300));
    enableButton = false;
    notifyListeners();
  }
}