animateTo method

Future<void> animateTo(
  1. double size, {
  2. Duration duration = const Duration(milliseconds: 250),
  3. Curve curve = Curves.easeInOut,
})

Animates the sheet to size using the provided duration and curve.

If no sheet is mounted yet (e.g. called before the sheet is built), falls back to jumpTo — the size is set immediately without animation.

Implementation

Future<void> animateTo(
  double size, {
  Duration duration = const Duration(milliseconds: 250),
  Curve curve = Curves.easeInOut,
}) async {
  final clamped = size.clamp(0.0, 1.0);
  final delegate = _animateDelegate;
  if (delegate == null) {
    jumpTo(clamped);
    return;
  }
  await delegate(clamped, duration, curve);
}