previous method

Future<void> previous({
  1. Duration duration = const Duration(milliseconds: 200),
  2. Curve curve = Curves.ease,
})
inherited

Animates the current page to the previous page. Does nothing if it is the first page.

Testing

To avoid timeouts in widget tests, always wrap the returned Future in unawaited.

testWidgets('shows', (tester) async {
  await tester.pumpWidget(...);

  unawaited(controller.show());
  await tester.pumpAndSettle();
});

Implementation

Future<void> previous({Duration duration = const Duration(milliseconds: 200), Curve curve = Curves.ease}) async {
  if (_from(_current) case final page when 0 < page) {
    await _animateTo(page - 1, duration, curve);
  }
}