animateToDayPicker method

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

Shows the day grid on the given date's month, or the current month if date is null.

If the day grid is already shown, it animates to the month; otherwise the month-year wheel is dismissed and the day grid is shown on the month immediately.

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> animateToDayPicker([
  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 (!_wheel && day.controller.hasClients) {
    await day.animateTo(target, duration: duration, curve: curve);
  } else {
    _wheel = false;
    day.reattach(target);
    _currentMonth = day.current;
    notifyListeners();
  }
}