animateToYearPicker method

Future<void> animateToYearPicker([
  1. DateTime? date,
  2. Duration duration = const Duration(milliseconds: 200),
  3. Curve curve = Curves.ease
])
inherited

Shows the year picker for the given date's year, or the current year if date is null.

If the year picker is already shown, its grid animates to the decade; otherwise it is shown immediately.

Implementation

Future<void> animateToYearPicker([
  DateTime? date,
  Duration duration = const Duration(milliseconds: 200),
  Curve curve = Curves.ease,
]) async {
  final target = _clamp(start, switch (date) {
    null => _currentMonth,
    final m => .utc(m.year, m.month),
  }, end);

  if (year.controller.hasClients) {
    await year.animateTo(target, duration: duration, curve: curve);
  } else {
    _reattach(year, .year, target);
  }
}