focus method

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

Focuses on date, animating to its page if necessary. Unfocuses if date is null.

Contract

Throws AssertionError if date is not within [start, end].

Implementation

Future<void> focus(
  DateTime? date, {
  Duration duration = const Duration(milliseconds: 200),
  Curve curve = Curves.ease,
}) async {
  if (date == _focused) {
    return;
  }

  _focused = date;
  if (date != null && _from(date) != _from(_current)) {
    assert(debugCheckInclusiveDateRange(start, date, end));
    await _animateTo(_from(date), duration, curve);
  }

  notifyListeners();
}