animateToOffset method
Scrolls to a specific pixel offset
Implementation
Future<void> animateToOffset(double offset, {
Duration duration = const Duration(milliseconds: 400),
Curve curve = Curves.ease,
}) async {
if (!isAttached || _isDisposed) return;
try {
_setAnimating(true);
await _scrollController!.animateTo(
offset,
duration: duration,
curve: curve,
);
} catch (e, stackTrace) {
_callbacks?.onError?.call('Failed to animate to offset $offset: $e', stackTrace);
} finally {
_setAnimating(false);
}
}