onScrollToOffset property

ScrollToOffsetHandler? get onScrollToOffset

The handler for SemanticsAction.scrollToOffset.

This handler is only called on iOS by UIKit, when the iOS focus engine switches its focus to an item too close to a scrollable edge of a scrollable container, to make sure the focused item is always fully visible.

The callback, if not null, should typically set the scroll offset of the associated scrollable container to the given targetOffset without animation as it is already animated by the caller: the iOS focus engine invokes onScrollToOffset every frame during the scroll animation with animated scroll offset values.

Implementation

ScrollToOffsetHandler? get onScrollToOffset => _onScrollToOffset;
set onScrollToOffset (ScrollToOffsetHandler? value)

Implementation

set onScrollToOffset(ScrollToOffsetHandler? value) {
  assert(value != null);
  _addAction(SemanticsAction.scrollToOffset, (Object? args) {
    final Float64List list = args! as Float64List;
    value!(Offset(list[0], list[1]));
  });
  _onScrollToOffset = value;
}