transition method

void transition(
  1. Duration duration,
  2. WidgetBuilder builder
)

Perform a transition.

Note: Only the most recent call to transition will actually do anything, as calling transition cancels the timer.

Implementation

void transition(
  final Duration duration,
  final WidgetBuilder builder,
) {
  _transitionTimer?.cancel();
  _transitionTimer = null;
  setState(() => _builder = widget.transitionBuilder);
  _transitionTimer = Timer(duration, () {
    _transitionTimer = null;
    if (mounted) {
      setState(() => _builder = builder);
    }
  });
}