scrollBy method

  1. @override
Future<void> scrollBy({
  1. required int x,
  2. required int y,
  3. bool animated = false,
})

Moves the scrolled position of the WebView.

x represents the amount of pixels to scroll by horizontally.

y represents the amount of pixels to scroll by vertically.

animated true to animate the scroll transition, false to make the scoll transition immediate.

NOTE for Web: this method will have effect only if the iframe has the same origin.

NOTE for MacOS: this method is implemented using JavaScript.

Officially Supported Platforms/Implementations:

Implementation

@override
Future<void> scrollBy(
    {required int x, required int y, bool animated = false}) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('x', () => x);
  args.putIfAbsent('y', () => y);
  args.putIfAbsent('animated', () => animated);
  await channel?.invokeMethod('scrollBy', args);
}