previous method

  1. @override
Future<void> previous({
  1. Duration duration = const Duration(milliseconds: 150),
  2. Curve curve = Curves.easeIn,
})
override

Show the previous step. If current step equals the first step nothing will happen.

Implementation

@override
Future<void> previous({
  Duration duration = const Duration(milliseconds: 150),
  Curve curve = Curves.easeIn,
}) async {
  if (isFirstStep(index) || !getIsGoBackEnabled()) {
    return;
  }
  final oldIndex = index;
  final newIndex = oldIndex - 1;
  if (_onStepChanged != null) {
    await _onStepChanged!(
      oldIndex,
      index,
    );
  }
  _index.add(newIndex);
  await Future.wait([
    stepControllers[newIndex].step.onShowing(),
    stepControllers[oldIndex].step.onHiding(),
    pageController.previousPage(
      duration: duration,
      curve: curve,
    ),
  ]);
  await Future.wait([
    stepControllers[newIndex].step.onShowingCompleted(),
    stepControllers[oldIndex].step.onHidingCompleted(),
  ]);
}