expandFrom method

void expandFrom({
  1. MorphOrigin? origin,
  2. Rect? targetRect,
  3. Duration? duration,
  4. Curve? curve,
})

Begin expansion from origintargetRect.

If origin is null, reuses the previously set origin.

Implementation

void expandFrom({
  MorphOrigin? origin,
  Rect? targetRect,
  Duration? duration,
  Curve? curve,
}) {
  if (origin != null) _origin = origin;
  if (targetRect != null) _targetRect = targetRect;

  _isCollapsingIntent = false;
  _setState(_state.copyWith(phase: MorphPhase.expanding, isDragging: false));

  final from = _animationController.value;
  final remaining = _remaining(from, 1.0, duration ?? _expandDuration);
  _animationController.animateTo(
    1.0,
    duration: remaining,
    curve: curve ?? _expandCurve,
  );
}