openTo method
Opens the Slidable to the given ratio
.
The ratio
sign will determine which direction the slidable should open.
controller.openTo(-1); //opens slidable all the way to the left side
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,
);
}