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.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - View.scrollTo)
- iOS WKWebView (Official API - UIScrollView.setContentOffset)
- macOS WKWebView:
- This method is implemented using JavaScript.
- Linux WPE WebKit
- Web <iframe> but requires same origin (Official API - Window.scrollTo)
- Windows WebView2:
- This method is implemented using JavaScript.
Parameters - Officially Supported Platforms/Implementations:
x: all platformsy: all platformsanimated: all platforms
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
Future<void> scrollTo({
required int x,
required int y,
bool animated = false,
}) => platform.scrollTo(x: x, y: y, animated: animated);