InAppWebViewSettings constructor
- bool? useShouldOverrideUrlLoading,
- bool? useOnLoadResource,
- bool? useOnDownloadStart,
- @Deprecated("Use InAppWebViewController.clearAllCache instead") bool? clearCache = false,
- String? userAgent = "",
- String? applicationNameForUserAgent = "",
- bool? javaScriptEnabled = true,
- bool? javaScriptCanOpenWindowsAutomatically = false,
- bool? mediaPlaybackRequiresUserGesture = true,
- int? minimumFontSize,
- bool? verticalScrollBarEnabled = true,
- bool? horizontalScrollBarEnabled = true,
- List<
String> ? resourceCustomSchemes = const [], - List<
ContentBlocker> ? contentBlockers = const [], - UserPreferredContentMode? preferredContentMode = UserPreferredContentMode.RECOMMENDED,
- bool? useShouldInterceptAjaxRequest,
- bool? useOnAjaxReadyStateChange,
- bool? useOnAjaxProgress,
- bool? interceptOnlyAsyncAjaxRequests = true,
- bool? useShouldInterceptFetchRequest,
- bool? incognito = false,
- bool? cacheEnabled = true,
- bool? transparentBackground = false,
- bool? disableVerticalScroll = false,
- bool? disableHorizontalScroll = false,
- bool? disableContextMenu = false,
- bool? supportZoom = true,
- bool? allowFileAccessFromFileURLs = false,
- bool? allowUniversalAccessFromFileURLs = false,
- int? textZoom,
- @Deprecated("Use CookieManager.removeSessionCookies instead") bool? clearSessionCache = false,
- bool? builtInZoomControls = true,
- bool? displayZoomControls = false,
- bool? databaseEnabled = true,
- bool? domStorageEnabled = true,
- bool? useWideViewPort = true,
- bool? safeBrowsingEnabled = true,
- MixedContentMode? mixedContentMode,
- bool? allowContentAccess = true,
- bool? allowFileAccess = true,
- String? appCachePath,
- bool? blockNetworkImage = false,
- bool? blockNetworkLoads = false,
- CacheMode? cacheMode = CacheMode.LOAD_DEFAULT,
- String? cursiveFontFamily = "cursive",
- int? defaultFixedFontSize = 16,
- int? defaultFontSize = 16,
- String? defaultTextEncodingName = "UTF-8",
- ActionModeMenuItem? disabledActionModeMenuItems,
- String? fantasyFontFamily = "fantasy",
- String? fixedFontFamily = "monospace",
- @Deprecated("Use algorithmicDarkeningAllowed instead") ForceDark? forceDark,
- @Deprecated("Use algorithmicDarkeningAllowed instead") ForceDarkStrategy? forceDarkStrategy,
- bool? geolocationEnabled = true,
- LayoutAlgorithm? layoutAlgorithm,
- bool? loadWithOverviewMode = true,
- bool? loadsImagesAutomatically = true,
- int? minimumLogicalFontSize = 8,
- bool? needInitialFocus = true,
- bool? offscreenPreRaster = false,
- String? sansSerifFontFamily = "sans-serif",
- String? serifFontFamily = "sans-serif",
- String? standardFontFamily = "sans-serif",
- @Deprecated('') bool? saveFormData = true,
- bool? thirdPartyCookiesEnabled = true,
- bool? hardwareAcceleration = true,
- int? initialScale = 0,
- bool? supportMultipleWindows = false,
- String? regexToCancelSubFramesLoading,
- String? regexToAllowSyncUrlLoading,
- bool? useHybridComposition = true,
- bool? useShouldInterceptRequest,
- bool? useOnRenderProcessGone,
- OverScrollMode? overScrollMode = OverScrollMode.IF_CONTENT_SCROLLS,
- bool? networkAvailable,
- ScrollBarStyle? scrollBarStyle = ScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY,
- VerticalScrollbarPosition? verticalScrollbarPosition = VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
- int? scrollBarDefaultDelayBeforeFade,
- bool? scrollbarFadingEnabled = true,
- int? scrollBarFadeDuration,
- RendererPriorityPolicy? rendererPriorityPolicy,
- bool? disableDefaultErrorPage = false,
- Color? verticalScrollbarThumbColor,
- Color? verticalScrollbarTrackColor,
- Color? horizontalScrollbarThumbColor,
- Color? horizontalScrollbarTrackColor,
- bool? algorithmicDarkeningAllowed = false,
- bool? enterpriseAuthenticationAppLinkPolicyEnabled = true,
- WebAuthenticationSupport? webAuthenticationSupport,
- String? containerId,
- ProxySettings? proxySettings,
- bool? paymentRequestEnabled,
- Uint8List? defaultVideoPoster,
- Set<
String> ? requestedWithHeaderOriginAllowList, - bool? disallowOverScroll = false,
- bool? enableViewportScale = false,
- bool? suppressesIncrementalRendering = false,
- bool? allowsAirPlayForMediaPlayback = true,
- bool? allowsLinkPreview = true,
- bool? ignoresViewportScaleLimits = false,
- bool? allowsInlineMediaPlayback = false,
- bool? allowsPictureInPictureMediaPlayback = true,
- bool? isFraudulentWebsiteWarningEnabled = true,
- SelectionGranularity? selectionGranularity = SelectionGranularity.DYNAMIC,
- List<
DataDetectorTypes> ? dataDetectorTypes = const [DataDetectorTypes.NONE], - bool? automaticallyAdjustsScrollIndicatorInsets = false,
- bool? accessibilityIgnoresInvertColors = false,
- ScrollViewDecelerationRate? decelerationRate = ScrollViewDecelerationRate.NORMAL,
- bool? alwaysBounceVertical = false,
- bool? alwaysBounceHorizontal = false,
- bool? scrollsToTop = true,
- bool? isPagingEnabled = false,
- double? maximumZoomScale = 1.0,
- double? minimumZoomScale = 1.0,
- ScrollViewContentInsetAdjustmentBehavior? contentInsetAdjustmentBehavior = ScrollViewContentInsetAdjustmentBehavior.NEVER,
- bool? isDirectionalLockEnabled = false,
- String? mediaType,
- double? pageZoom = 1.0,
- bool? applePayAPIEnabled = false,
- WebUri? allowingReadAccessTo,
- bool? disableLongPressContextMenuOnLinks = false,
- bool? disableInputAccessoryView = false,
- bool? disableAutocorrection = false,
- Color? underPageBackgroundColor,
- bool? isTextInteractionEnabled = true,
- IOSWritingToolsBehavior? writingToolsBehavior,
- bool? isSiteSpecificQuirksModeEnabled = true,
- bool? upgradeKnownHostsToHTTPS = true,
- bool? isElementFullscreenEnabled = true,
- bool? useNativeFullscreenContainer = true,
- bool? isFindInteractionEnabled = false,
- EdgeInsets? minimumViewportInset,
- EdgeInsets? maximumViewportInset,
- bool? isInspectable = false,
- bool? shouldPrintBackgrounds = false,
- bool? allowBackgroundAudioPlaying = false,
- WebViewAssetLoader? webViewAssetLoader,
- Set<
String> ? javaScriptHandlersOriginAllowList, - bool? javaScriptHandlersForMainFrameOnly,
- bool? javaScriptBridgeEnabled = true,
- Set<
String> ? javaScriptBridgeOriginAllowList, - bool? javaScriptBridgeForMainFrameOnly,
- Set<
String> ? pluginScriptsOriginAllowList, - bool? pluginScriptsForMainFrameOnly = false,
- int? scrollMultiplier = 1,
- bool? statusBarEnabled = true,
- bool? browserAcceleratorKeysEnabled = true,
- bool? generalAutofillEnabled = true,
- bool? passwordAutosaveEnabled = false,
- bool? pinchZoomEnabled = true,
- bool? reputationCheckingRequired = true,
- bool? nonClientRegionSupportEnabled = false,
- bool? isUserInteractionEnabled = true,
- bool? handleAcceleratorKeyPressed = false,
- double? alpha,
- bool? useOnShowFileChooser,
- String? iframeAllow,
- bool? iframeAllowFullscreen,
- Set<
Sandbox> ? iframeSandbox, - ReferrerPolicy? iframeReferrerPolicy,
- String? iframeName,
- String? iframeCsp,
- String? iframeRole,
- String? iframeAriaHidden,
- bool? enableWriteConsoleMessagesToStdout = false,
- bool? enableSmoothScrolling = true,
- bool? enableCaretBrowsing = false,
- bool? enablePageCache = true,
- bool? drawCompositingIndicators = false,
- bool? enableResizableTextAreas = true,
- bool? enableTabsToLinks = true,
- String? pictographFontFamily,
- List<
String> ? corsAllowlist, - bool? itpEnabled = false,
- bool? darkMode,
- bool? disableAnimations,
- bool? fontAntialias,
- FontHintingStyle? fontHintingStyle,
- FontSubpixelLayout? fontSubpixelLayout,
- double? fontDPI,
- int? cursorBlinkTime,
- int? doubleClickDistance,
- int? doubleClickTime,
- int? dragThreshold,
- int? keyRepeatDelay,
- int? keyRepeatInterval,
- bool? javaScriptCanAccessClipboard = false,
- bool? allowModalDialogs = false,
- bool? disableWebSecurity = false,
- bool? enableWebRTC = true,
- String? webRTCUdpPortsRange,
- bool? enableMedia = true,
- bool? enableEncryptedMedia = true,
- bool? enableMediaCapabilities = true,
- bool? enableMockCaptureDevices = false,
- String? mediaContentTypesRequiringHardwareSupport,
- bool? enableJavaScriptMarkup = true,
- bool? enable2DCanvasAcceleration = false,
Officially Supported Platforms/Implementations:
- Android WebView
- iOS WKWebView
- macOS WKWebView
- Web <iframe>
- Windows WebView2
Implementation
InAppWebViewSettings({
this.useShouldOverrideUrlLoading,
this.useOnLoadResource,
this.useOnDownloadStart,
@Deprecated("Use InAppWebViewController.clearAllCache instead")
this.clearCache = false,
this.userAgent = "",
this.applicationNameForUserAgent = "",
this.javaScriptEnabled = true,
this.javaScriptCanOpenWindowsAutomatically = false,
this.mediaPlaybackRequiresUserGesture = true,
this.minimumFontSize,
this.verticalScrollBarEnabled = true,
this.horizontalScrollBarEnabled = true,
this.resourceCustomSchemes = const [],
this.contentBlockers = const [],
this.preferredContentMode = UserPreferredContentMode.RECOMMENDED,
this.useShouldInterceptAjaxRequest,
this.useOnAjaxReadyStateChange,
this.useOnAjaxProgress,
this.interceptOnlyAsyncAjaxRequests = true,
this.useShouldInterceptFetchRequest,
this.incognito = false,
this.cacheEnabled = true,
this.transparentBackground = false,
this.disableVerticalScroll = false,
this.disableHorizontalScroll = false,
this.disableContextMenu = false,
this.supportZoom = true,
this.allowFileAccessFromFileURLs = false,
this.allowUniversalAccessFromFileURLs = false,
this.textZoom,
@Deprecated("Use CookieManager.removeSessionCookies instead")
this.clearSessionCache = false,
this.builtInZoomControls = true,
this.displayZoomControls = false,
this.databaseEnabled = true,
this.domStorageEnabled = true,
this.useWideViewPort = true,
this.safeBrowsingEnabled = true,
this.mixedContentMode,
this.allowContentAccess = true,
this.allowFileAccess = true,
this.appCachePath,
this.blockNetworkImage = false,
this.blockNetworkLoads = false,
this.cacheMode = CacheMode.LOAD_DEFAULT,
this.cursiveFontFamily = "cursive",
this.defaultFixedFontSize = 16,
this.defaultFontSize = 16,
this.defaultTextEncodingName = "UTF-8",
this.disabledActionModeMenuItems,
this.fantasyFontFamily = "fantasy",
this.fixedFontFamily = "monospace",
@Deprecated("Use algorithmicDarkeningAllowed instead") this.forceDark,
@Deprecated("Use algorithmicDarkeningAllowed instead")
this.forceDarkStrategy,
this.geolocationEnabled = true,
this.layoutAlgorithm,
this.loadWithOverviewMode = true,
this.loadsImagesAutomatically = true,
this.minimumLogicalFontSize = 8,
this.needInitialFocus = true,
this.offscreenPreRaster = false,
this.sansSerifFontFamily = "sans-serif",
this.serifFontFamily = "sans-serif",
this.standardFontFamily = "sans-serif",
@Deprecated('') this.saveFormData = true,
this.thirdPartyCookiesEnabled = true,
this.hardwareAcceleration = true,
this.initialScale = 0,
this.supportMultipleWindows = false,
this.regexToCancelSubFramesLoading,
this.regexToAllowSyncUrlLoading,
this.useHybridComposition = true,
this.useShouldInterceptRequest,
this.useOnRenderProcessGone,
this.overScrollMode = OverScrollMode.IF_CONTENT_SCROLLS,
this.networkAvailable,
this.scrollBarStyle = ScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY,
this.verticalScrollbarPosition =
VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
this.scrollBarDefaultDelayBeforeFade,
this.scrollbarFadingEnabled = true,
this.scrollBarFadeDuration,
this.rendererPriorityPolicy,
this.disableDefaultErrorPage = false,
this.verticalScrollbarThumbColor,
this.verticalScrollbarTrackColor,
this.horizontalScrollbarThumbColor,
this.horizontalScrollbarTrackColor,
this.algorithmicDarkeningAllowed = false,
this.enterpriseAuthenticationAppLinkPolicyEnabled = true,
this.webAuthenticationSupport,
this.containerId,
this.proxySettings,
this.paymentRequestEnabled,
this.defaultVideoPoster,
this.requestedWithHeaderOriginAllowList,
this.disallowOverScroll = false,
this.enableViewportScale = false,
this.suppressesIncrementalRendering = false,
this.allowsAirPlayForMediaPlayback = true,
this.allowsBackForwardNavigationGestures = true,
this.allowsLinkPreview = true,
this.ignoresViewportScaleLimits = false,
this.allowsInlineMediaPlayback = false,
this.allowsPictureInPictureMediaPlayback = true,
this.isFraudulentWebsiteWarningEnabled = true,
this.selectionGranularity = SelectionGranularity.DYNAMIC,
this.dataDetectorTypes = const [DataDetectorTypes.NONE],
this.sharedCookiesEnabled = false,
this.automaticallyAdjustsScrollIndicatorInsets = false,
this.accessibilityIgnoresInvertColors = false,
this.decelerationRate = ScrollViewDecelerationRate.NORMAL,
this.alwaysBounceVertical = false,
this.alwaysBounceHorizontal = false,
this.scrollsToTop = true,
this.isPagingEnabled = false,
this.maximumZoomScale = 1.0,
this.minimumZoomScale = 1.0,
this.contentInsetAdjustmentBehavior =
ScrollViewContentInsetAdjustmentBehavior.NEVER,
this.isDirectionalLockEnabled = false,
this.mediaType,
this.pageZoom = 1.0,
this.limitsNavigationsToAppBoundDomains = false,
this.useOnNavigationResponse,
this.applePayAPIEnabled = false,
this.allowingReadAccessTo,
this.disableLongPressContextMenuOnLinks = false,
this.disableInputAccessoryView = false,
this.disableAutocorrection = false,
this.underPageBackgroundColor,
this.isTextInteractionEnabled = true,
this.writingToolsBehavior,
this.isSiteSpecificQuirksModeEnabled = true,
this.upgradeKnownHostsToHTTPS = true,
this.isElementFullscreenEnabled = true,
this.useNativeFullscreenContainer = true,
this.isFindInteractionEnabled = false,
this.minimumViewportInset,
this.maximumViewportInset,
this.isInspectable = false,
this.shouldPrintBackgrounds = false,
this.allowBackgroundAudioPlaying = false,
this.webViewAssetLoader,
this.javaScriptHandlersOriginAllowList,
this.javaScriptHandlersForMainFrameOnly,
this.javaScriptBridgeEnabled = true,
this.javaScriptBridgeOriginAllowList,
this.javaScriptBridgeForMainFrameOnly,
this.pluginScriptsOriginAllowList,
this.pluginScriptsForMainFrameOnly = false,
this.scrollMultiplier = 1,
this.statusBarEnabled = true,
this.browserAcceleratorKeysEnabled = true,
this.generalAutofillEnabled = true,
this.passwordAutosaveEnabled = false,
this.pinchZoomEnabled = true,
this.hiddenPdfToolbarItems = PdfToolbarItems.NONE,
this.reputationCheckingRequired = true,
this.nonClientRegionSupportEnabled = false,
this.isUserInteractionEnabled = true,
this.handleAcceleratorKeyPressed = false,
this.alpha,
this.useOnShowFileChooser,
this.iframeAllow,
this.iframeAllowFullscreen,
this.iframeSandbox,
this.iframeReferrerPolicy,
this.iframeName,
this.iframeCsp,
this.iframeRole,
this.iframeAriaHidden,
this.enableWriteConsoleMessagesToStdout = false,
this.enableSmoothScrolling = true,
this.enableCaretBrowsing = false,
this.enablePageCache = true,
this.drawCompositingIndicators = false,
this.enableResizableTextAreas = true,
this.enableTabsToLinks = true,
this.enableSpatialNavigation = false,
this.pictographFontFamily,
this.corsAllowlist,
this.itpEnabled = false,
this.darkMode,
this.disableAnimations,
this.fontAntialias,
this.fontHintingStyle,
this.fontSubpixelLayout,
this.fontDPI,
this.cursorBlinkTime,
this.doubleClickDistance,
this.doubleClickTime,
this.dragThreshold,
this.keyRepeatDelay,
this.keyRepeatInterval,
this.javaScriptCanAccessClipboard = false,
this.allowModalDialogs = false,
this.disableWebSecurity = false,
this.enableWebRTC = true,
this.webRTCUdpPortsRange,
this.enableMedia = true,
this.enableEncryptedMedia = true,
this.enableMediaCapabilities = true,
this.enableMockCaptureDevices = false,
this.mediaContentTypesRequiringHardwareSupport,
this.enableJavaScriptMarkup = true,
this.enable2DCanvasAcceleration = false,
this.allowTopNavigationToDataUrls = false,
}) {
if (this.minimumFontSize == null)
this.minimumFontSize = Util.isAndroid ? 8 : 0;
assert(
this.resourceCustomSchemes == null ||
(this.resourceCustomSchemes != null &&
!this.resourceCustomSchemes!.contains("http") &&
!this.resourceCustomSchemes!.contains("https")),
);
assert(
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"),
);
assert(
(minimumViewportInset == null && maximumViewportInset == null) ||
minimumViewportInset != null &&
maximumViewportInset != null &&
minimumViewportInset!.isNonNegative &&
maximumViewportInset!.isNonNegative &&
minimumViewportInset!.vertical <=
maximumViewportInset!.vertical &&
minimumViewportInset!.horizontal <=
maximumViewportInset!.horizontal,
"minimumViewportInset cannot be larger than maximumViewportInset",
);
}