toScrollContext static method
Future<void>
toScrollContext(
- BuildContext context, {
- double alignment = 0.5,
- Duration duration = Durations.long4,
Implementation
static Future<void> toScrollContext(
BuildContext context, {
double alignment = 0.5,
Duration duration = Durations.long4,
}) async {
final renderObject = context.findRenderObject();
if (renderObject == null) return;
final scrollable = Scrollable.maybeOf(context);
if (scrollable == null) return;
await Future.delayed(duration);
await scrollable.position.ensureVisible(
renderObject,
duration: Durations.medium1,
curve: Curves.easeInOut,
alignment: alignment,
);
}