openTo method

Future<void> openTo(
  1. double ratio, {
  2. Duration duration = _defaultMovementDuration,
  3. Curve curve = _defaultCurve,
})

Opens the Slidable to the given ratio.

Implementation

Future<void> openTo(
  double ratio, {
  Duration duration = _defaultMovementDuration,
  Curve curve = _defaultCurve,
}) async {
  assert(ratio >= -1 && ratio <= 1);

  if (_closing) {
    return;
  }

  // Edge case: to be able to correctly set the sign when the value is zero,
  // we have to manually set the ratio to a tiny amount.
  if (_animationController.value == 0) {
    this.ratio = 0.05 * ratio.sign;
  }
  return _animationController.animateTo(
    ratio.abs(),
    duration: duration,
    curve: curve,
  );
}