scrollTo method
Scrolls the WebView to the position.
x
represents the x position to scroll to.
y
represents the y position to scroll to.
animated
true
to animate the scroll transition, false
to make the scoll transition immediate.
Supported Platforms/Implementations:
- Android native WebView (Official API - View.scrollTo)
- iOS (Official API - UIScrollView.setContentOffset)
Implementation
Future<void> scrollTo(
{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('scrollTo', args);
}