scrollIndicator static method

void scrollIndicator(
  1. BuildContext context,
  2. ScrollDirection direction, {
  3. HighlightStyle? style,
  4. Duration? duration,
})

Directional arrow on the screen edge the agent is scrolling toward.

Implementation

static void scrollIndicator(
  BuildContext context,
  ScrollDirection direction, {
  HighlightStyle? style,
  Duration? duration,
}) {
  if (!HighlighterConfig.enabled) return;
  final overlay = _resolveOverlay(context);
  if (overlay == null) return;
  _directionEntry?.remove();
  final effectiveStyle = style ?? HighlighterConfig.defaultStyle;
  final effectiveDuration =
      duration ?? HighlighterConfig.defaultDirectionDuration;
  late OverlayEntry entry;
  entry = OverlayEntry(
    builder: (_) => _ScrollIndicatorLayer(
      direction: direction,
      style: effectiveStyle,
      duration: effectiveDuration,
      onDone: () {
        if (_directionEntry == entry) {
          entry.remove();
          _directionEntry = null;
        }
      },
    ),
  );
  _directionEntry = entry;
  overlay.insert(entry);
}