zoomBy method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebView.zoomBy', apiUrl: 'https://developer.android.com/reference/android/webkit/WebView#zoomBy(float)', available: '21'), IOSPlatform(apiName: 'UIScrollView.setZoomScale', apiUrl: 'https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale'), LinuxPlatform(apiName: 'webkit_web_view_set_zoom_level', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.set_zoom_level.html')])
Future<void> zoomBy({
  1. required double zoomFactor,
  2. @Deprecated('Use animated instead') bool? iosAnimated,
  3. @SupportedPlatforms.new(platforms: [IOSPlatform()]) bool animated = false,
})

Performs a zoom operation in this WebView.

zoomFactor represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 (excluded) to 100.0 (included).

animated true to animate the transition to the new scale, false to make the transition immediate.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • zoomFactor: all platforms
  • animated:
    • iOS WKWebView

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebView.zoomBy',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebView#zoomBy(float)',
      available: '21',
    ),
    IOSPlatform(
      apiName: 'UIScrollView.setZoomScale',
      apiUrl:
          'https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale',
    ),
    LinuxPlatform(
      apiName: 'webkit_web_view_set_zoom_level',
      apiUrl:
          'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.set_zoom_level.html',
    ),
  ],
)
Future<void> zoomBy({
  required double zoomFactor,
  @Deprecated('Use animated instead') bool? iosAnimated,
  @SupportedPlatforms(platforms: [IOSPlatform()]) bool animated = false,
}) {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.zoomBy.name} is not implemented on the current platform',
  );
}