scrollToContext method

dynamic scrollToContext(
  1. BuildContext context, {
  2. required bool animate,
})

scrolls the widget with the specified context into view

Implementation

scrollToContext(BuildContext context, {required bool animate}) {
  Scrollable.ensureVisible(context, duration: animate ? const Duration(seconds: 1) : Duration.zero, alignment: 0.2);
}