scrollBy method
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.
Supported Platforms/Implementations:
- Android native WebView (Official API - View.scrollBy)
- iOS (Official API - UIScrollView.setContentOffset)
Implementation
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);
}