initial windows implementation #460

This commit is contained in:
unknown 2024-01-31 14:44:18 +01:00
parent a6b9a959e1
commit 981c0356b8
35 changed files with 392 additions and 399 deletions

View File

@ -45,8 +45,8 @@ class CookieManager {
return _instance!;
} else {
return CookieManager.fromPlatformCreationParams(
PlatformCookieManagerCreationParams(webViewEnvironment: webViewEnvironment.platform)
);
PlatformCookieManagerCreationParams(
webViewEnvironment: webViewEnvironment.platform));
}
}

View File

@ -18,22 +18,22 @@ class InAppBrowser implements PlatformInAppBrowserEvents {
/// Constructs a [InAppBrowser].
///
/// {@macro flutter_inappwebview_platform_interface.PlatformInAppBrowser}
InAppBrowser(
{ContextMenu? contextMenu,
PullToRefreshController? pullToRefreshController,
FindInteractionController? findInteractionController,
UnmodifiableListView<UserScript>? initialUserScripts,
int? windowId,
WebViewEnvironment? webViewEnvironment,
})
: this.fromPlatformCreationParams(
InAppBrowser({
ContextMenu? contextMenu,
PullToRefreshController? pullToRefreshController,
FindInteractionController? findInteractionController,
UnmodifiableListView<UserScript>? initialUserScripts,
int? windowId,
WebViewEnvironment? webViewEnvironment,
}) : this.fromPlatformCreationParams(
PlatformInAppBrowserCreationParams(
contextMenu: contextMenu,
pullToRefreshController: pullToRefreshController?.platform,
findInteractionController: findInteractionController?.platform,
initialUserScripts: initialUserScripts,
windowId: windowId,
webViewEnvironment: webViewEnvironment?.platform,),
contextMenu: contextMenu,
pullToRefreshController: pullToRefreshController?.platform,
findInteractionController: findInteractionController?.platform,
initialUserScripts: initialUserScripts,
windowId: windowId,
webViewEnvironment: webViewEnvironment?.platform,
),
);
/// Constructs a [InAppBrowser] from creation params for a specific

View File

@ -488,15 +488,21 @@ class InAppWebViewController {
Future<void> openDevTools() => platform.openDevTools();
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.callDevToolsProtocolMethod}
Future<dynamic> callDevToolsProtocolMethod({required String methodName, Map<String, dynamic>? parameters}) =>
platform.callDevToolsProtocolMethod(methodName: methodName, parameters: parameters);
Future<dynamic> callDevToolsProtocolMethod(
{required String methodName, Map<String, dynamic>? parameters}) =>
platform.callDevToolsProtocolMethod(
methodName: methodName, parameters: parameters);
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.addDevToolsProtocolEventListener}
Future<void> addDevToolsProtocolEventListener({required String eventName, required Function(dynamic data) callback}) =>
platform.addDevToolsProtocolEventListener(eventName: eventName, callback: callback);
Future<void> addDevToolsProtocolEventListener(
{required String eventName,
required Function(dynamic data) callback}) =>
platform.addDevToolsProtocolEventListener(
eventName: eventName, callback: callback);
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.removeDevToolsProtocolEventListener}
Future<void> removeDevToolsProtocolEventListener({required String eventName}) =>
Future<void> removeDevToolsProtocolEventListener(
{required String eventName}) =>
platform.removeDevToolsProtocolEventListener(eventName: eventName);
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getIFrameId}

View File

@ -1 +1 @@
export 'webview_environment.dart';
export 'webview_environment.dart';

View File

@ -27,17 +27,23 @@ class WebViewEnvironment {
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.create}
static Future<WebViewEnvironment> create(
{WebViewEnvironmentSettings? settings}) async {
return WebViewEnvironment.fromPlatform(platform: await PlatformWebViewEnvironment.static().create(settings: settings));
return WebViewEnvironment.fromPlatform(
platform: await PlatformWebViewEnvironment.static()
.create(settings: settings));
}
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.getAvailableVersion}
static Future<String?> getAvailableVersion(
{String? browserExecutableFolder}) => PlatformWebViewEnvironment.static().getAvailableVersion(browserExecutableFolder: browserExecutableFolder);
{String? browserExecutableFolder}) =>
PlatformWebViewEnvironment.static().getAvailableVersion(
browserExecutableFolder: browserExecutableFolder);
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.getAvailableVersion}
static Future<int?> compareBrowserVersions(
{required String version1, required String version2}) => PlatformWebViewEnvironment.static().compareBrowserVersions(version1: version1, version2: version2);
{required String version1, required String version2}) =>
PlatformWebViewEnvironment.static()
.compareBrowserVersions(version1: version1, version2: version2);
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.dispose}
Future<void> dispose() => platform.dispose();
}
}

View File

@ -107,189 +107,124 @@ class InAppBrowserSettings_
bool? hidden;
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
bool? hideToolbarTop;
///Set the custom background color of the toolbar at the top.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
Color_? toolbarTopBackgroundColor;
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
bool? hideUrlBar;
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
bool? hideProgressBar;
///Set to `true` to hide the default menu items. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
bool? hideDefaultMenuItems;
///Set to `true` if you want the title should be displayed. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
@SupportedPlatforms(platforms: [AndroidPlatform()])
bool? hideTitleBar;
///Set the action bar's title.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), MacOSPlatform(), WindowsPlatform()])
String? toolbarTopFixedTitle;
///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
@SupportedPlatforms(platforms: [AndroidPlatform()])
bool? closeOnCannotGoBack;
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
@SupportedPlatforms(platforms: [AndroidPlatform()])
bool? allowGoBackWithBackButton;
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
@SupportedPlatforms(platforms: [AndroidPlatform()])
bool? shouldCloseOnBackButtonPressed;
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? toolbarTopTranslucent;
///Set the tint color to apply to the navigation bar background.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? toolbarTopBarTintColor;
///Set the tint color to apply to the navigation items and bar button items.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? toolbarTopTintColor;
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? hideToolbarBottom;
///Set the custom background color of the toolbar at the bottom.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? toolbarBottomBackgroundColor;
///Set the tint color to apply to the bar button items.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? toolbarBottomTintColor;
///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? toolbarBottomTranslucent;
///Set the custom text for the close button.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
String? closeButtonCaption;
///Set the custom color for the close button.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? closeButtonColor;
///Set to `true` to hide the close button. The default value is `false`.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? hideCloseButton;
///Set the custom color for the menu button.
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
Color_? menuButtonColor;
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
ModalPresentationStyle_? presentationStyle;
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
@SupportedPlatforms(platforms: [
IOSPlatform()
])
@SupportedPlatforms(platforms: [IOSPlatform()])
ModalTransitionStyle_? transitionStyle;
///How the browser window should be added to the main window.
///The default value is [WindowType.WINDOW].
@SupportedPlatforms(platforms: [
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
WindowType_? windowType;
///The windows alpha value.
///The default value is `1.0`.
@SupportedPlatforms(platforms: [
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
double? windowAlphaValue;
///Flags that describe the windows current style, such as if its resizable or in full-screen mode.
@SupportedPlatforms(platforms: [
MacOSPlatform()
])
@SupportedPlatforms(platforms: [MacOSPlatform()])
WindowStyleMask_? windowStyleMask;
///The type of separator that the app displays between the title bar and content of a window.
@SupportedPlatforms(platforms: [
MacOSPlatform(available: '11.0')
])
@SupportedPlatforms(platforms: [MacOSPlatform(available: '11.0')])
WindowTitlebarSeparatorStyle_? windowTitlebarSeparatorStyle;
///Sets the origin and size of the windows frame rectangle according to a given frame rectangle,
///thereby setting its position and size onscreen.
@SupportedPlatforms(platforms: [
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
InAppWebViewRect_? windowFrame;
InAppBrowserSettings_(

View File

@ -40,6 +40,7 @@ class InAppBrowserSettings
///- Android native WebView
///- iOS
///- MacOS
///- Windows
bool? hidden;
///Set to `true` to hide the close button. The default value is `false`.
@ -53,6 +54,7 @@ class InAppBrowserSettings
///**Officially Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideDefaultMenuItems;
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
@ -146,6 +148,7 @@ class InAppBrowserSettings
///**Officially Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
///- Windows
String? toolbarTopFixedTitle;
///Set the tint color to apply to the navigation items and bar button items.
@ -171,6 +174,7 @@ class InAppBrowserSettings
///
///**Officially Supported Platforms/Implementations**:
///- MacOS
///- Windows
double? windowAlphaValue;
///Sets the origin and size of the windows frame rectangle according to a given frame rectangle,
@ -178,6 +182,7 @@ class InAppBrowserSettings
///
///**Officially Supported Platforms/Implementations**:
///- MacOS
///- Windows
InAppWebViewRect? windowFrame;
///Flags that describe the windows current style, such as if its resizable or in full-screen mode.
@ -188,10 +193,8 @@ class InAppBrowserSettings
///The type of separator that the app displays between the title bar and content of a window.
///
///**NOTE for MacOS**: available on MacOS 11.0+.
///
///**Officially Supported Platforms/Implementations**:
///- MacOS
///- MacOS 11.0+
WindowTitlebarSeparatorStyle? windowTitlebarSeparatorStyle;
///How the browser window should be added to the main window.
@ -199,6 +202,7 @@ class InAppBrowserSettings
///
///**Officially Supported Platforms/Implementations**:
///- MacOS
///- Windows
WindowType? windowType;
InAppBrowserSettings(
{this.allowGoBackWithBackButton = true,

View File

@ -32,14 +32,14 @@ import '../pull_to_refresh/platform_pull_to_refresh_controller.dart';
@immutable
class PlatformInAppBrowserCreationParams {
/// Used by the platform implementation to create a new [PlatformInAppBrowser].
const PlatformInAppBrowserCreationParams(
{this.contextMenu,
this.pullToRefreshController,
this.findInteractionController,
this.initialUserScripts,
this.windowId,
this.webViewEnvironment,
});
const PlatformInAppBrowserCreationParams({
this.contextMenu,
this.pullToRefreshController,
this.findInteractionController,
this.initialUserScripts,
this.windowId,
this.webViewEnvironment,
});
///{@macro flutter_inappwebview_platform_interface.PlatformInAppBrowser.contextMenu}
final ContextMenu? contextMenu;

View File

@ -37,6 +37,5 @@ class InAppWebViewControllerKeepAliveProps {
this.injectedScriptsFromURL = const {},
this.webMessageChannels = const {},
this.webMessageListeners = const {},
this.devToolsProtocolEventListenerMap = const {}
});
this.devToolsProtocolEventListenerMap = const {}});
}

View File

@ -57,8 +57,12 @@ class InAppWebViewSettings_ {
///If the [PlatformWebViewCreationParams.shouldOverrideUrlLoading] event is implemented and this value is `null`,
///it will be automatically inferred as `true`, otherwise, the default value is `false`.
///This logic will not be applied for [PlatformInAppBrowser], where you must set the value manually.
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform(), WindowsPlatform()])
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform(),
WindowsPlatform()
])
bool? useShouldOverrideUrlLoading;
///Set to `true` to be able to listen at the [PlatformWebViewCreationParams.onLoadResource] event.
@ -100,9 +104,9 @@ class InAppWebViewSettings_ {
apiUrl:
"https://developer.apple.com/documentation/webkit/wkwebview/1414950-customuseragent"),
WindowsPlatform(
apiName: 'ICoreWebView2Settings2.put_UserAgent',
apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings2?view=webview2-1.0.2210.55#put_useragent'
)
apiName: 'ICoreWebView2Settings2.put_UserAgent',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings2?view=webview2-1.0.2210.55#put_useragent')
])
String? userAgent;
@ -138,8 +142,7 @@ class InAppWebViewSettings_ {
WindowsPlatform(
apiName: "ICoreWebView2Settings.put_IsScriptEnabled",
apiUrl:
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_isscriptenabled"
)
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_isscriptenabled")
])
bool? javaScriptEnabled;
@ -318,10 +321,10 @@ because there isn't any way to make the website data store non-persistent for th
IOSPlatform(),
MacOSPlatform(available: "12.0"),
WindowsPlatform(
available: '1.0.774.44',
apiName: 'ICoreWebView2Controller2.put_DefaultBackgroundColor',
apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller2?view=webview2-1.0.2210.55#put_defaultbackgroundcolor'
)
available: '1.0.774.44',
apiName: 'ICoreWebView2Controller2.put_DefaultBackgroundColor',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller2?view=webview2-1.0.2210.55#put_defaultbackgroundcolor')
])
bool? transparentBackground;
@ -336,14 +339,15 @@ because there isn't any way to make the website data store non-persistent for th
bool? disableHorizontalScroll;
///Set to `true` to disable context menu. The default value is `false`.
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), WebPlatform(),
WindowsPlatform(
apiName: "ICoreWebView2Settings.put_AreDefaultContextMenusEnabled",
apiUrl:
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_aredefaultcontextmenusenabled"
)
])
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
WebPlatform(),
WindowsPlatform(
apiName: "ICoreWebView2Settings.put_AreDefaultContextMenusEnabled",
apiUrl:
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_aredefaultcontextmenusenabled")
])
bool? disableContextMenu;
///Set to `false` if the WebView should not support zooming using its on-screen zoom controls and gestures. The default value is `true`.
@ -357,8 +361,7 @@ because there isn't any way to make the website data store non-persistent for th
WindowsPlatform(
apiName: "ICoreWebView2Settings.put_IsZoomControlEnabled",
apiUrl:
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_iszoomcontrolenabled"
)
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_iszoomcontrolenabled")
])
bool? supportZoom;
@ -1566,8 +1569,7 @@ as it can cause framerate drops on animations in Android 9 and lower (see [Hybri
WindowsPlatform(
apiName: "ICoreWebView2Settings.put_AreDevToolsEnabled",
apiUrl:
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_aredevtoolsenabled"
)
"https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings?view=webview2-1.0.2210.55#put_aredevtoolsenabled")
])
bool? isInspectable;

View File

@ -18,7 +18,7 @@ class PlatformHeadlessInAppWebViewCreationParams
/// Used by the platform implementation to create a new [PlatformHeadlessInAppWebView].
const PlatformHeadlessInAppWebViewCreationParams(
{this.initialSize = const Size(-1, -1),
this.webViewEnvironment,
this.webViewEnvironment,
super.controllerFromPlatform,
super.windowId,
super.onWebViewCreated,

View File

@ -2069,7 +2069,8 @@ abstract class PlatformInAppWebViewController extends PlatformInterface
///**Officially Supported Platforms/Implementations**:
///- Windows ([Official API - ICoreWebView2.CallDevToolsProtocolMethod](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#calldevtoolsprotocolmethod))
///{@endtemplate}
Future<dynamic> callDevToolsProtocolMethod({required String methodName, Map<String, dynamic>? parameters}) {
Future<dynamic> callDevToolsProtocolMethod(
{required String methodName, Map<String, dynamic>? parameters}) {
throw UnimplementedError(
'callDevToolsProtocolMethod is not implemented on the current platform');
}
@ -2080,7 +2081,8 @@ abstract class PlatformInAppWebViewController extends PlatformInterface
///**Officially Supported Platforms/Implementations**:
///- Windows ([Official API - ICoreWebView2DevToolsProtocolEventReceiver.add_DevToolsProtocolEventReceived](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2devtoolsprotocoleventreceiver?view=webview2-1.0.2210.55#add_devtoolsprotocoleventreceived))
///{@endtemplate}
Future<void> addDevToolsProtocolEventListener({required String eventName, required Function(dynamic data) callback}) {
Future<void> addDevToolsProtocolEventListener(
{required String eventName, required Function(dynamic data) callback}) {
throw UnimplementedError(
'addDevToolsProtocolEventListener is not implemented on the current platform');
}
@ -2091,7 +2093,8 @@ abstract class PlatformInAppWebViewController extends PlatformInterface
///**Officially Supported Platforms/Implementations**:
///- Windows ([Official API - ICoreWebView2DevToolsProtocolEventReceiver.remove_DevToolsProtocolEventReceived](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2devtoolsprotocoleventreceiver?view=webview2-1.0.2210.55#remove_devtoolsprotocoleventreceived))
///{@endtemplate}
Future<void> removeDevToolsProtocolEventListener({required String eventName}) {
Future<void> removeDevToolsProtocolEventListener(
{required String eventName}) {
throw UnimplementedError(
'removeDevToolsProtocolEventListener is not implemented on the current platform');
}

View File

@ -437,8 +437,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebViewEnvironment] in `flutter_inappwebview` instead.
PlatformWebViewEnvironment createPlatformWebViewEnvironment(
PlatformWebViewEnvironmentCreationParams params,
) {
PlatformWebViewEnvironmentCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewEnvironment is not implemented on the current platform.');
}

View File

@ -41,11 +41,8 @@ class Cookie_ {
int? expiresDate;
///Indicates if the cookie is a session only cookie.
@SupportedPlatforms(platforms: [
IOSPlatform(),
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(
platforms: [IOSPlatform(), MacOSPlatform(), WindowsPlatform()])
bool? isSessionOnly;
///The cookie domain.

View File

@ -18,52 +18,51 @@ class NavigationType_ {
EnumIOSPlatform(
apiName: 'WKNavigationType.linkActivated',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/linkactivated',
'https://developer.apple.com/documentation/webkit/wknavigationtype/linkactivated',
value: 0),
EnumMacOSPlatform(
apiName: 'WKNavigationType.linkActivated',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/linkactivated',
'https://developer.apple.com/documentation/webkit/wknavigationtype/linkactivated',
value: 0),
EnumWindowsPlatform(
value: 0
),
EnumWindowsPlatform(value: 0),
])
static const LINK_ACTIVATED = const NavigationType_._internal('LINK_ACTIVATED');
static const LINK_ACTIVATED =
const NavigationType_._internal('LINK_ACTIVATED');
///A form was submitted.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
value: 1),
EnumMacOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
value: 1),
])
static const FORM_SUBMITTED = const NavigationType_._internal('FORM_SUBMITTED');
static const FORM_SUBMITTED =
const NavigationType_._internal('FORM_SUBMITTED');
///An item from the back-forward list was requested.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
value: 2),
EnumMacOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formsubmitted',
value: 2),
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_NAVIGATION_KIND_BACK_OR_FORWARD',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_navigation_kind',
value: 1
),
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_navigation_kind',
value: 1),
])
static const BACK_FORWARD = const NavigationType_._internal('BACK_FORWARD');
@ -72,19 +71,18 @@ class NavigationType_ {
EnumIOSPlatform(
apiName: 'WKNavigationType.reload',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/reload',
'https://developer.apple.com/documentation/webkit/wknavigationtype/reload',
value: 3),
EnumMacOSPlatform(
apiName: 'WKNavigationType.reload',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/reload',
'https://developer.apple.com/documentation/webkit/wknavigationtype/reload',
value: 3),
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_NAVIGATION_KIND_RELOAD',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_navigation_kind',
value: 2
),
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_navigation_kind',
value: 2),
])
static const RELOAD = const NavigationType_._internal('RELOAD');
@ -93,31 +91,30 @@ class NavigationType_ {
EnumIOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formresubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formresubmitted',
value: 4),
EnumMacOSPlatform(
apiName: 'WKNavigationType.formSubmitted',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/formresubmitted',
'https://developer.apple.com/documentation/webkit/wknavigationtype/formresubmitted',
value: 4),
])
static const FORM_RESUBMITTED = const NavigationType_._internal('FORM_RESUBMITTED');
static const FORM_RESUBMITTED =
const NavigationType_._internal('FORM_RESUBMITTED');
///Navigation is taking place for some other reason.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
apiName: 'WKNavigationType.other',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/other',
'https://developer.apple.com/documentation/webkit/wknavigationtype/other',
value: -1),
EnumMacOSPlatform(
apiName: 'WKNavigationType.other',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationtype/other',
'https://developer.apple.com/documentation/webkit/wknavigationtype/other',
value: -1),
EnumWindowsPlatform(
value: 3
),
EnumWindowsPlatform(value: 3),
])
static const OTHER = const NavigationType_._internal('OTHER');
}

View File

@ -25,11 +25,8 @@ class ScreenshotConfiguration_ {
///The web view maintains the aspect ratio of the captured content, but scales it to match the width you specify.
///
///The default value of this property is `null`, which returns an image whose size matches the original size of the captured rectangle.
@SupportedPlatforms(platforms: [
AndroidPlatform(),
IOSPlatform(),
MacOSPlatform()
])
@SupportedPlatforms(
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
double? snapshotWidth;
///The compression format of the captured image.

View File

@ -25,11 +25,14 @@ class WebHistoryItem_ {
int? offset;
///Unique id of the navigation history entry.
@SupportedPlatforms(platforms: [
WindowsPlatform()
])
@SupportedPlatforms(platforms: [WindowsPlatform()])
int? entryId;
WebHistoryItem_(
{this.originalUrl, this.title, this.url, this.index, this.offset, this.entryId});
{this.originalUrl,
this.title,
this.url,
this.index,
this.offset,
this.entryId});
}

View File

@ -64,7 +64,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_CANNOT_CONNECT',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 12)
])
static const CANNOT_CONNECT_TO_HOST =
@ -133,7 +133,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_HOST_NAME_NOT_RESOLVED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 13)
])
static const HOST_LOOKUP = WebResourceErrorType_._internal("HOST_LOOKUP");
@ -200,7 +200,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_TIMEOUT',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 7)
])
static const TIMEOUT = WebResourceErrorType_._internal("TIMEOUT");
@ -236,7 +236,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 0)
])
static const UNKNOWN = WebResourceErrorType_._internal("UNKNOWN");
@ -300,7 +300,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_OPERATION_CANCELED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 14)
])
static const CANCELLED = WebResourceErrorType_._internal("CANCELLED");
@ -320,7 +320,7 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_DISCONNECTED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 11)
])
static const NETWORK_CONNECTION_LOST =
@ -388,9 +388,10 @@ class WebResourceErrorType_ {
'https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse',
value: -1011),
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_ERROR_HTTP_INVALID_SERVER_RESPONSE',
apiName:
'COREWEBVIEW2_WEB_ERROR_STATUS_ERROR_HTTP_INVALID_SERVER_RESPONSE',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 8)
])
static const BAD_SERVER_RESPONSE =
@ -426,9 +427,10 @@ class WebResourceErrorType_ {
'https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired',
value: -1013),
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_VALID_AUTHENTICATION_CREDENTIALS_REQUIRED',
apiName:
'COREWEBVIEW2_WEB_ERROR_STATUS_VALID_AUTHENTICATION_CREDENTIALS_REQUIRED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 17),
])
static const USER_AUTHENTICATION_REQUIRED =
@ -936,29 +938,31 @@ class WebResourceErrorType_ {
///Indicates that the host is unreachable.
@EnumSupportedPlatforms(platforms: [
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_SERVER_UNREACHABLE',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 6),
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_SERVER_UNREACHABLE',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 6),
])
static const SERVER_UNREACHABLE = WebResourceErrorType_._internal("SERVER_UNREACHABLE");
static const SERVER_UNREACHABLE =
WebResourceErrorType_._internal("SERVER_UNREACHABLE");
///Indicates that the connection was stopped.
@EnumSupportedPlatforms(platforms: [
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_CONNECTION_ABORTED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 9)
])
static const CONNECTION_ABORTED = WebResourceErrorType_._internal("CONNECTION_ABORTED");
static const CONNECTION_ABORTED =
WebResourceErrorType_._internal("CONNECTION_ABORTED");
///Indicates that the connection was reset.
@EnumSupportedPlatforms(platforms: [
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_CONNECTION_RESET',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 10),
])
static const RESET = WebResourceErrorType_._internal("RESET");
@ -968,28 +972,32 @@ class WebResourceErrorType_ {
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_REDIRECT_FAILED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 15),
])
static const REDIRECT_FAILED = WebResourceErrorType_._internal("REDIRECT_FAILED");
static const REDIRECT_FAILED =
WebResourceErrorType_._internal("REDIRECT_FAILED");
///Indicates that an unexpected error occurred.
@EnumSupportedPlatforms(platforms: [
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_UNEXPECTED_ERROR',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 16),
])
static const UNEXPECTED_ERROR = WebResourceErrorType_._internal("UNEXPECTED_ERROR");
static const UNEXPECTED_ERROR =
WebResourceErrorType_._internal("UNEXPECTED_ERROR");
///Indicates that user lacks proper authentication credentials for a proxy server.
@EnumSupportedPlatforms(platforms: [
EnumWindowsPlatform(
apiName: 'COREWEBVIEW2_WEB_ERROR_STATUS_VALID_PROXY_AUTHENTICATION_REQUIRED',
apiName:
'COREWEBVIEW2_WEB_ERROR_STATUS_VALID_PROXY_AUTHENTICATION_REQUIRED',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#corewebview2_web_error_status',
value: 18),
])
static const VALID_PROXY_AUTHENTICATION_REQUIRED = WebResourceErrorType_._internal("VALID_PROXY_AUTHENTICATION_REQUIRED");
static const VALID_PROXY_AUTHENTICATION_REQUIRED =
WebResourceErrorType_._internal("VALID_PROXY_AUTHENTICATION_REQUIRED");
}

View File

@ -12,11 +12,17 @@ class WindowType_ {
const WindowType_._internal(this._value);
///Adds the new browser window as a separate new window from the main window.
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'WINDOW'), EnumWindowsPlatform(value: 'WINDOW')])
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'WINDOW'),
EnumWindowsPlatform(value: 'WINDOW')
])
static const WINDOW = const WindowType_._internal('WINDOW');
///Adds the new browser window as a child window of the main window.
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'CHILD'), EnumWindowsPlatform(value: 'CHILD')])
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'CHILD'),
EnumWindowsPlatform(value: 'CHILD')
])
static const CHILD = const WindowType_._internal('CHILD');
///Adds the new browser window as a new tab in a tabbed window of the main window.

View File

@ -1,2 +1,2 @@
export 'platform_webview_environment.dart';
export 'webview_environment_settings.dart' show WebViewEnvironmentSettings;
export 'webview_environment_settings.dart' show WebViewEnvironmentSettings;

View File

@ -27,23 +27,21 @@ class PlatformWebViewEnvironmentCreationParams {
abstract class PlatformWebViewEnvironment extends PlatformInterface
implements Disposable {
///Debug settings used by [PlatformWebViewEnvironment].
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(
maxLogMessageLength: 1000
);
static DebugLoggingSettings debugLoggingSettings =
DebugLoggingSettings(maxLogMessageLength: 1000);
/// Creates a new [PlatformInAppWebViewController]
factory PlatformWebViewEnvironment(
PlatformWebViewEnvironmentCreationParams params) {
assert(
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformWebViewEnvironment webViewEnvironment =
InAppWebViewPlatform.instance!
.createPlatformWebViewEnvironment(params);
InAppWebViewPlatform.instance!.createPlatformWebViewEnvironment(params);
PlatformInterface.verify(webViewEnvironment, _token);
return webViewEnvironment;
}
@ -51,15 +49,14 @@ abstract class PlatformWebViewEnvironment extends PlatformInterface
/// Creates a new [PlatformWebViewEnvironment] to access static methods.
factory PlatformWebViewEnvironment.static() {
assert(
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformWebViewEnvironment webViewEnvironment =
InAppWebViewPlatform.instance!
.createPlatformWebViewEnvironmentStatic();
InAppWebViewPlatform.instance!.createPlatformWebViewEnvironmentStatic();
PlatformInterface.verify(webViewEnvironment, _token);
return webViewEnvironment;
}
@ -69,8 +66,7 @@ abstract class PlatformWebViewEnvironment extends PlatformInterface
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformWebViewEnvironment.implementation(this.params)
: super(token: _token);
PlatformWebViewEnvironment.implementation(this.params) : super(token: _token);
static final Object _token = Object();
@ -114,8 +110,7 @@ abstract class PlatformWebViewEnvironment extends PlatformInterface
///**Officially Supported Platforms/Implementations**:
///- Windows ([Official API - GetAvailableCoreWebView2BrowserVersionString](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#comparebrowserversions))
///{@endtemplate}
Future<String?> getAvailableVersion(
{String? browserExecutableFolder}) {
Future<String?> getAvailableVersion({String? browserExecutableFolder}) {
throw UnimplementedError(
'getAvailableVersion is not implemented on the current platform');
}
@ -144,4 +139,4 @@ abstract class PlatformWebViewEnvironment extends PlatformInterface
throw UnimplementedError(
'dispose is not implemented on the current platform');
}
}
}

View File

@ -8,9 +8,7 @@ part 'webview_environment_settings.g.dart';
///
///The [browserExecutableFolder], [userDataFolder] and [additionalBrowserArguments]
///may be overridden by values either specified in environment variables or in the registry.
@SupportedPlatforms(platforms: [
WindowsPlatform()
])
@SupportedPlatforms(platforms: [WindowsPlatform()])
@ExchangeableObject(copyMethod: true)
class WebViewEnvironmentSettings_ {
///Use [browserExecutableFolder] to specify whether WebView2 controls use a fixed
@ -29,7 +27,11 @@ class WebViewEnvironmentSettings_ {
///When an override `WEBVIEW2_RELEASE_CHANNEL_PREFERENCE` environment variable or
///applicable `releaseChannelPreference` registry value is set to `1`, the channel search order is reversed.
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'CreateCoreWebView2EnvironmentWithOptions.browserExecutableFolder', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#createcorewebview2environmentwithoptions')
WindowsPlatform(
apiName:
'CreateCoreWebView2EnvironmentWithOptions.browserExecutableFolder',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#createcorewebview2environmentwithoptions')
])
final String? browserExecutableFolder;
@ -48,7 +50,10 @@ class WebViewEnvironmentSettings_ {
///options does not match the options of the WebViews that are currently
///running in the shared browser process.
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'CreateCoreWebView2EnvironmentWithOptions.userDataFolder', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#createcorewebview2environmentwithoptions')
WindowsPlatform(
apiName: 'CreateCoreWebView2EnvironmentWithOptions.userDataFolder',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.2210.55#createcorewebview2environmentwithoptions')
])
final String? userDataFolder;
@ -57,35 +62,49 @@ class WebViewEnvironmentSettings_ {
///in which case the features should be comma-seperated.
///Example: `"--disable-features=feature1,feature2 --some-other-switch --do-something"`
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'ICoreWebView2EnvironmentOptions.put_AdditionalBrowserArguments', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_additionalbrowserarguments')
WindowsPlatform(
apiName:
'ICoreWebView2EnvironmentOptions.put_AdditionalBrowserArguments',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_additionalbrowserarguments')
])
final String? additionalBrowserArguments;
///This property is used to enable single sign on with Azure Active Directory (AAD)
///and personal Microsoft Account (MSA) resources inside WebView.
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'ICoreWebView2EnvironmentOptions.put_AllowSingleSignOnUsingOSPrimaryAccount', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_allowsinglesignonusingosprimaryaccount')
WindowsPlatform(
apiName:
'ICoreWebView2EnvironmentOptions.put_AllowSingleSignOnUsingOSPrimaryAccount',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_allowsinglesignonusingosprimaryaccount')
])
final bool? allowSingleSignOnUsingOSPrimaryAccount;
///The default display language for WebView.
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'ICoreWebView2EnvironmentOptions.put_Language', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_language')
WindowsPlatform(
apiName: 'ICoreWebView2EnvironmentOptions.put_Language',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_language')
])
final String? language;
///Specifies the version of the WebView2 Runtime binaries required to be compatible with your app.
@SupportedPlatforms(platforms: [
WindowsPlatform(apiName: 'ICoreWebView2EnvironmentOptions.put_TargetCompatibleBrowserVersion', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_targetcompatiblebrowserversion')
WindowsPlatform(
apiName:
'ICoreWebView2EnvironmentOptions.put_TargetCompatibleBrowserVersion',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.2210.55#put_targetcompatiblebrowserversion')
])
final String? targetCompatibleBrowserVersion;
WebViewEnvironmentSettings_({
this.browserExecutableFolder,
this.userDataFolder,
this.additionalBrowserArguments,
this.allowSingleSignOnUsingOSPrimaryAccount,
this.language,
this.targetCompatibleBrowserVersion
});
}
WebViewEnvironmentSettings_(
{this.browserExecutableFolder,
this.userDataFolder,
this.additionalBrowserArguments,
this.allowSingleSignOnUsingOSPrimaryAccount,
this.language,
this.targetCompatibleBrowserVersion});
}

View File

@ -16,8 +16,7 @@ import 'webview_environment/webview_environment.dart';
class WindowsCookieManagerCreationParams
extends PlatformCookieManagerCreationParams {
/// Creates a new [WindowsCookieManagerCreationParams] instance.
const WindowsCookieManagerCreationParams(
{this.webViewEnvironment});
const WindowsCookieManagerCreationParams({this.webViewEnvironment});
/// Creates a [WindowsCookieManagerCreationParams] instance based on [PlatformCookieManagerCreationParams].
factory WindowsCookieManagerCreationParams.fromPlatformCookieManagerCreationParams(
@ -25,7 +24,8 @@ class WindowsCookieManagerCreationParams
// ignore: avoid_unused_constructor_parameters
PlatformCookieManagerCreationParams params) {
return WindowsCookieManagerCreationParams(
webViewEnvironment: params.webViewEnvironment as WindowsWebViewEnvironment?);
webViewEnvironment:
params.webViewEnvironment as WindowsWebViewEnvironment?);
}
@override
@ -38,11 +38,11 @@ class WindowsCookieManager extends PlatformCookieManager
/// Creates a new [WindowsCookieManager].
WindowsCookieManager(PlatformCookieManagerCreationParams params)
: super.implementation(
params is WindowsCookieManagerCreationParams
? params
: WindowsCookieManagerCreationParams
.fromPlatformCookieManagerCreationParams(params),
) {
params is WindowsCookieManagerCreationParams
? params
: WindowsCookieManagerCreationParams
.fromPlatformCookieManagerCreationParams(params),
) {
channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_cookiemanager');
handler = handleMethod;
@ -52,16 +52,16 @@ class WindowsCookieManager extends PlatformCookieManager
static WindowsCookieManager? _instance;
///Gets the [WindowsCookieManager] shared instance.
static WindowsCookieManager instance({WindowsWebViewEnvironment? webViewEnvironment}) {
static WindowsCookieManager instance(
{WindowsWebViewEnvironment? webViewEnvironment}) {
if (webViewEnvironment == null) {
if (_instance == null) {
_instance = _init();
}
return _instance!;
} else {
return WindowsCookieManager(
WindowsCookieManagerCreationParams(webViewEnvironment: webViewEnvironment)
);
return WindowsCookieManager(WindowsCookieManagerCreationParams(
webViewEnvironment: webViewEnvironment));
}
}
@ -75,18 +75,18 @@ class WindowsCookieManager extends PlatformCookieManager
@override
Future<bool> setCookie(
{required WebUri url,
required String name,
required String value,
String path = "/",
String? domain,
int? expiresDate,
int? maxAge,
bool? isSecure,
bool? isHttpOnly,
HTTPCookieSameSitePolicy? sameSite,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
required String name,
required String value,
String path = "/",
String? domain,
int? expiresDate,
int? maxAge,
bool? isSecure,
bool? isHttpOnly,
HTTPCookieSameSitePolicy? sameSite,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
assert(name.isNotEmpty);
assert(value.isNotEmpty);
@ -103,7 +103,8 @@ class WindowsCookieManager extends PlatformCookieManager
args.putIfAbsent('isSecure', () => isSecure);
args.putIfAbsent('isHttpOnly', () => isHttpOnly);
args.putIfAbsent('sameSite', () => sameSite?.toNativeValue());
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
return await channel?.invokeMethod<bool>('setCookie', args) ?? false;
}
@ -111,16 +112,17 @@ class WindowsCookieManager extends PlatformCookieManager
@override
Future<List<Cookie>> getCookies(
{required WebUri url,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
List<Cookie> cookies = [];
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString());
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
List<dynamic> cookieListMap =
await channel?.invokeMethod<List>('getCookies', args) ?? [];
cookieListMap = cookieListMap.cast<Map<dynamic, dynamic>>();
@ -133,7 +135,7 @@ class WindowsCookieManager extends PlatformCookieManager
isSessionOnly: cookieMap["isSessionOnly"],
domain: cookieMap["domain"],
sameSite:
HTTPCookieSameSitePolicy.fromNativeValue(cookieMap["sameSite"]),
HTTPCookieSameSitePolicy.fromNativeValue(cookieMap["sameSite"]),
isSecure: cookieMap["isSecure"],
isHttpOnly: cookieMap["isHttpOnly"],
path: cookieMap["path"]));
@ -144,16 +146,17 @@ class WindowsCookieManager extends PlatformCookieManager
@override
Future<Cookie?> getCookie(
{required WebUri url,
required String name,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
required String name,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
assert(name.isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString());
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
List<dynamic> cookies =
await channel?.invokeMethod<List>('getCookies', args) ?? [];
cookies = cookies.cast<Map<dynamic, dynamic>>();
@ -178,12 +181,12 @@ class WindowsCookieManager extends PlatformCookieManager
@override
Future<bool> deleteCookie(
{required WebUri url,
required String name,
String path = "/",
String? domain,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
required String name,
String path = "/",
String? domain,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
assert(name.isNotEmpty);
@ -192,32 +195,35 @@ class WindowsCookieManager extends PlatformCookieManager
args.putIfAbsent('name', () => name);
args.putIfAbsent('domain', () => domain);
args.putIfAbsent('path', () => path);
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
return await channel?.invokeMethod<bool>('deleteCookie', args) ?? false;
}
@override
Future<bool> deleteCookies(
{required WebUri url,
String path = "/",
String? domain,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
String path = "/",
String? domain,
@Deprecated("Use webViewController instead")
PlatformInAppWebViewController? iosBelow11WebViewController,
PlatformInAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString());
args.putIfAbsent('domain', () => domain);
args.putIfAbsent('path', () => path);
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
return await channel?.invokeMethod<bool>('deleteCookies', args) ?? false;
}
@override
Future<bool> deleteAllCookies() async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('webViewEnvironmentId', () => params.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => params.webViewEnvironment?.id);
return await channel?.invokeMethod<bool>('deleteAllCookies', args) ?? false;
}

View File

@ -114,7 +114,8 @@ class WindowsFindInteractionController extends PlatformFindInteractionController
}
}
extension InternalFindInteractionController on WindowsFindInteractionController {
extension InternalFindInteractionController
on WindowsFindInteractionController {
void init(dynamic id) {
channel = MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_find_interaction_$id');

View File

@ -26,8 +26,8 @@ class WindowsHttpAuthCredentialDatabaseCreationParams
}
///{@macro flutter_inappwebview_platform_interface.PlatformHttpAuthCredentialDatabase}
class WindowsHttpAuthCredentialDatabase extends PlatformHttpAuthCredentialDatabase
with ChannelController {
class WindowsHttpAuthCredentialDatabase
extends PlatformHttpAuthCredentialDatabase with ChannelController {
/// Creates a new [WindowsHttpAuthCredentialDatabase].
WindowsHttpAuthCredentialDatabase(
PlatformHttpAuthCredentialDatabaseCreationParams params)

View File

@ -33,11 +33,12 @@ class WindowsInAppBrowserCreationParams
return WindowsInAppBrowserCreationParams(
contextMenu: params.contextMenu,
pullToRefreshController: params.pullToRefreshController,
findInteractionController:
params.findInteractionController as WindowsFindInteractionController?,
findInteractionController: params.findInteractionController
as WindowsFindInteractionController?,
initialUserScripts: params.initialUserScripts,
windowId: params.windowId,
webViewEnvironment: params.webViewEnvironment as WindowsWebViewEnvironment?);
webViewEnvironment:
params.webViewEnvironment as WindowsWebViewEnvironment?);
}
@override
@ -174,7 +175,8 @@ class WindowsInAppBrowser extends PlatformInAppBrowser with ChannelController {
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
args.putIfAbsent('pullToRefreshSettings', () => pullToRefreshSettings);
args.putIfAbsent('menuItems', () => menuItemList);
args.putIfAbsent('webViewEnvironmentId', () => _windowsParams.webViewEnvironment?.id);
args.putIfAbsent(
'webViewEnvironmentId', () => _windowsParams.webViewEnvironment?.id);
return args;
}

View File

@ -128,8 +128,8 @@ class CustomPlatformViewController
_methodChannel =
MethodChannel('com.pichillilorenzo/custom_platform_view_$_textureId');
_eventChannel =
EventChannel('com.pichillilorenzo/custom_platform_view_${_textureId}_events');
_eventChannel = EventChannel(
'com.pichillilorenzo/custom_platform_view_${_textureId}_events');
_eventStreamSubscription =
_eventChannel.receiveBroadcastStream().listen((event) {
final map = event as Map<dynamic, dynamic>;
@ -303,9 +303,7 @@ class _CustomPlatformViewState extends State<CustomPlatformView> {
focusNode: _focusNode,
canRequestFocus: true,
debugLabel: "flutter_inappwebview_windows_custom_platform_view",
onFocusChange: (focused) {
},
onFocusChange: (focused) {},
child: SizedBox.expand(key: _key, child: _buildInner()),
);
}
@ -418,7 +416,6 @@ class _CustomPlatformViewState extends State<CustomPlatformView> {
await _controller.ready;
unawaited(_controller._setSize(
box.size, widget.scaleFactor ?? window.devicePixelRatio));
}
}

View File

@ -19,7 +19,7 @@ class WindowsHeadlessInAppWebViewCreationParams
WindowsHeadlessInAppWebViewCreationParams(
{super.controllerFromPlatform,
super.initialSize,
this.webViewEnvironment,
this.webViewEnvironment,
super.windowId,
super.onWebViewCreated,
super.onLoadStart,
@ -135,7 +135,8 @@ class WindowsHeadlessInAppWebViewCreationParams
PlatformHeadlessInAppWebViewCreationParams params)
: this(
controllerFromPlatform: params.controllerFromPlatform,
webViewEnvironment: params.webViewEnvironment as WindowsWebViewEnvironment?,
webViewEnvironment:
params.webViewEnvironment as WindowsWebViewEnvironment?,
initialSize: params.initialSize,
windowId: params.windowId,
onWebViewCreated: params.onWebViewCreated,
@ -285,7 +286,8 @@ class WindowsHeadlessInAppWebView extends PlatformHeadlessInAppWebView
_init() {
_webViewController = WindowsInAppWebViewController(
WindowsInAppWebViewControllerCreationParams(id: id, webviewParams: params),
WindowsInAppWebViewControllerCreationParams(
id: id, webviewParams: params),
);
_controllerFromPlatform =
params.controllerFromPlatform?.call(_webViewController!) ??

View File

@ -24,7 +24,7 @@ class WindowsInAppWebViewWidgetCreationParams
super.keepAlive,
super.preventGestureDelay,
super.windowId,
this.webViewEnvironment,
this.webViewEnvironment,
super.onWebViewCreated,
super.onLoadStart,
super.onLoadStop,
@ -147,7 +147,8 @@ class WindowsInAppWebViewWidgetCreationParams
keepAlive: params.keepAlive,
preventGestureDelay: params.preventGestureDelay,
windowId: params.windowId,
webViewEnvironment: params.webViewEnvironment as WindowsWebViewEnvironment?,
webViewEnvironment:
params.webViewEnvironment as WindowsWebViewEnvironment?,
onWebViewCreated: params.onWebViewCreated,
onLoadStart: params.onLoadStart,
onLoadStop: params.onLoadStop,

View File

@ -76,7 +76,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
Map<String, ScriptHtmlTagAttributes> _injectedScriptsFromURL = {};
Set<WindowsWebMessageChannel> _webMessageChannels = Set();
Set<WindowsWebMessageListener> _webMessageListeners = Set();
Map<String, Function(dynamic data)> _devToolsProtocolEventListenerMap = HashMap();
Map<String, Function(dynamic data)> _devToolsProtocolEventListenerMap =
HashMap();
// static map that contains the properties to be saved and restored for keep alive feature
static final Map<InAppWebViewKeepAlive, InAppWebViewControllerKeepAliveProps?>
@ -94,7 +95,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
WindowsInAppWebViewController(
PlatformInAppWebViewControllerCreationParams params)
: super.implementation(params is WindowsInAppWebViewControllerCreationParams
: super.implementation(params
is WindowsInAppWebViewControllerCreationParams
? params
: WindowsInAppWebViewControllerCreationParams
.fromPlatformInAppWebViewControllerCreationParams(params)) {
@ -134,10 +136,11 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
MethodChannel channel,
WindowsInAppBrowser inAppBrowser,
UnmodifiableListView<UserScript>? initialUserScripts)
: super.implementation(params is WindowsInAppWebViewControllerCreationParams
? params
: WindowsInAppWebViewControllerCreationParams
.fromPlatformInAppWebViewControllerCreationParams(params)) {
: super.implementation(
params is WindowsInAppWebViewControllerCreationParams
? params
: WindowsInAppWebViewControllerCreationParams
.fromPlatformInAppWebViewControllerCreationParams(params)) {
this.channel = channel;
this._inAppBrowser = inAppBrowser;
@ -164,7 +167,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
webStorage = WindowsWebStorage(WindowsWebStorageCreationParams(
localStorage: WindowsLocalStorage.defaultStorage(controller: this),
sessionStorage: WindowsSessionStorage.defaultStorage(controller: this)));
sessionStorage:
WindowsSessionStorage.defaultStorage(controller: this)));
if (params.webviewParams is PlatformInAppWebViewWidgetCreationParams) {
final keepAlive =
@ -181,8 +185,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
webMessageListenerObjNames: _webMessageListenerObjNames,
webMessageChannels: _webMessageChannels,
webMessageListeners: _webMessageListeners,
devToolsProtocolEventListenerMap: _devToolsProtocolEventListenerMap
);
devToolsProtocolEventListenerMap:
_devToolsProtocolEventListenerMap);
} else {
// restore controller properties
_injectedScriptsFromURL = props.injectedScriptsFromURL;
@ -193,7 +197,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
props.webMessageChannels as Set<WindowsWebMessageChannel>;
_webMessageListeners =
props.webMessageListeners as Set<WindowsWebMessageListener>;
_devToolsProtocolEventListenerMap = props.devToolsProtocolEventListenerMap;
_devToolsProtocolEventListenerMap =
props.devToolsProtocolEventListenerMap;
}
}
}
@ -1409,7 +1414,9 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
break;
case "onDevToolsProtocolEventReceived":
String eventName = call.arguments["eventName"];
dynamic data = call.arguments["data"] != null ? jsonDecode(call.arguments["data"]) : null;
dynamic data = call.arguments["data"] != null
? jsonDecode(call.arguments["data"])
: null;
if (this._devToolsProtocolEventListenerMap.containsKey(eventName)) {
this._devToolsProtocolEventListenerMap[eventName]!.call(data);
@ -2646,11 +2653,14 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
}
@override
Future<dynamic> callDevToolsProtocolMethod({required String methodName, Map<String, dynamic>? parameters}) async {
Future<dynamic> callDevToolsProtocolMethod(
{required String methodName, Map<String, dynamic>? parameters}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('methodName', () => methodName);
args.putIfAbsent('parametersAsJson', () => parameters != null ? jsonEncode(parameters) : null);
final result = await channel?.invokeMethod<String>('callDevToolsProtocolMethod', args);
args.putIfAbsent('parametersAsJson',
() => parameters != null ? jsonEncode(parameters) : null);
final result =
await channel?.invokeMethod<String>('callDevToolsProtocolMethod', args);
if (result != null) {
return jsonDecode(result);
}
@ -2658,7 +2668,9 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
}
@override
Future<void> addDevToolsProtocolEventListener({required String eventName, required Function(dynamic data) callback}) async {
Future<void> addDevToolsProtocolEventListener(
{required String eventName,
required Function(dynamic data) callback}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('eventName', () => eventName);
await channel?.invokeMethod('addDevToolsProtocolEventListener', args);
@ -2666,7 +2678,8 @@ class WindowsInAppWebViewController extends PlatformInAppWebViewController
}
@override
Future<void> removeDevToolsProtocolEventListener({required String eventName}) async {
Future<void> removeDevToolsProtocolEventListener(
{required String eventName}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('eventName', () => eventName);
await channel?.invokeMethod('removeDevToolsProtocolEventListener', args);

View File

@ -21,12 +21,11 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [CookieManager] in `flutter_inappwebview` instead.
@override
WindowsCookieManager createPlatformCookieManager(
PlatformCookieManagerCreationParams params,
) {
PlatformCookieManagerCreationParams params,
) {
return WindowsCookieManager(params);
}
/// Creates a new [WindowsInAppWebViewController].
///
/// This function should only be called by the app-facing package.
@ -84,8 +83,8 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [HeadlessInAppWebView] in `flutter_inappwebview` instead.
@override
WindowsHeadlessInAppWebView createPlatformHeadlessInAppWebView(
PlatformHeadlessInAppWebViewCreationParams params,
) {
PlatformHeadlessInAppWebViewCreationParams params,
) {
return WindowsHeadlessInAppWebView(params);
}
@ -95,8 +94,8 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [WebViewEnvironment] in `flutter_inappwebview` instead.
@override
WindowsWebViewEnvironment createPlatformWebViewEnvironment(
PlatformWebViewEnvironmentCreationParams params,
) {
PlatformWebViewEnvironmentCreationParams params,
) {
return WindowsWebViewEnvironment(params);
}
@ -115,8 +114,8 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [WebStorage] in `flutter_inappwebview` instead.
@override
WindowsWebStorage createPlatformWebStorage(
PlatformWebStorageCreationParams params,
) {
PlatformWebStorageCreationParams params,
) {
return WindowsWebStorage(params);
}
@ -126,8 +125,8 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [LocalStorage] in `flutter_inappwebview` instead.
@override
WindowsLocalStorage createPlatformLocalStorage(
PlatformLocalStorageCreationParams params,
) {
PlatformLocalStorageCreationParams params,
) {
return WindowsLocalStorage(params);
}
@ -137,8 +136,8 @@ class WindowsInAppWebViewPlatform extends InAppWebViewPlatform {
/// Look at using [SessionStorage] in `flutter_inappwebview` instead.
@override
WindowsSessionStorage createPlatformSessionStorage(
PlatformSessionStorageCreationParams params,
) {
PlatformSessionStorageCreationParams params,
) {
return WindowsSessionStorage(params);
}
}

View File

@ -50,8 +50,8 @@ class WindowsWebMessageChannel extends PlatformWebMessageChannel
static final WindowsWebMessageChannel _staticValue = WindowsWebMessageChannel(
WindowsWebMessageChannelCreationParams(
id: '',
port1:
WindowsWebMessagePort(WindowsWebMessagePortCreationParams(index: 0)),
port1: WindowsWebMessagePort(
WindowsWebMessagePortCreationParams(index: 0)),
port2: WindowsWebMessagePort(
WindowsWebMessagePortCreationParams(index: 1))));

View File

@ -1 +1 @@
export 'webview_environment.dart' hide InternalWindowsWebViewEnvironment;
export 'webview_environment.dart' hide InternalWindowsWebViewEnvironment;

View File

@ -7,7 +7,8 @@ import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_pla
/// Platform specific implementations can add additional fields by extending
/// this class.
@immutable
class WindowsWebViewEnvironmentCreationParams extends PlatformWebViewEnvironmentCreationParams {
class WindowsWebViewEnvironmentCreationParams
extends PlatformWebViewEnvironmentCreationParams {
/// Creates a new [WindowsInAppWebViewControllerCreationParams] instance.
const WindowsWebViewEnvironmentCreationParams({super.settings});
@ -16,9 +17,7 @@ class WindowsWebViewEnvironmentCreationParams extends PlatformWebViewEnvironment
// Recommended placeholder to prevent being broken by platform interface.
// ignore: avoid_unused_constructor_parameters
PlatformWebViewEnvironmentCreationParams params) {
return WindowsWebViewEnvironmentCreationParams(
settings: params.settings
);
return WindowsWebViewEnvironmentCreationParams(settings: params.settings);
}
}
@ -28,21 +27,20 @@ class WindowsWebViewEnvironmentCreationParams extends PlatformWebViewEnvironment
///- Windows
class WindowsWebViewEnvironment extends PlatformWebViewEnvironment
with ChannelController {
static final MethodChannel _staticChannel = MethodChannel('com.pichillilorenzo/flutter_webview_environment');
static final MethodChannel _staticChannel =
MethodChannel('com.pichillilorenzo/flutter_webview_environment');
@override
final String id = IdGenerator.generate();
WindowsWebViewEnvironment(
PlatformWebViewEnvironmentCreationParams params)
WindowsWebViewEnvironment(PlatformWebViewEnvironmentCreationParams params)
: super.implementation(params is WindowsWebViewEnvironmentCreationParams
? params
: WindowsWebViewEnvironmentCreationParams
.fromPlatformWebViewEnvironmentCreationParams(params));
? params
: WindowsWebViewEnvironmentCreationParams
.fromPlatformWebViewEnvironmentCreationParams(params));
static final WindowsWebViewEnvironment _staticValue =
WindowsWebViewEnvironment(
WindowsWebViewEnvironmentCreationParams());
WindowsWebViewEnvironment(WindowsWebViewEnvironmentCreationParams());
factory WindowsWebViewEnvironment.static() {
return _staticValue;
@ -52,8 +50,7 @@ class WindowsWebViewEnvironment extends PlatformWebViewEnvironment
debugLog(
className: this.runtimeType.toString(),
id: id,
debugLoggingSettings:
PlatformWebViewEnvironment.debugLoggingSettings,
debugLoggingSettings: PlatformWebViewEnvironment.debugLoggingSettings,
method: method,
args: args);
}
@ -74,24 +71,22 @@ class WindowsWebViewEnvironment extends PlatformWebViewEnvironment
Future<WindowsWebViewEnvironment> create(
{WebViewEnvironmentSettings? settings}) async {
final env = WindowsWebViewEnvironment(
WindowsWebViewEnvironmentCreationParams(settings: settings)
);
WindowsWebViewEnvironmentCreationParams(settings: settings));
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('id', () => env.id);
args.putIfAbsent('settings', () => env.settings?.toMap());
await _staticChannel.invokeMethod(
'create', args);
await _staticChannel.invokeMethod('create', args);
env.channel = MethodChannel('com.pichillilorenzo/flutter_webview_environment_$id');
env.channel =
MethodChannel('com.pichillilorenzo/flutter_webview_environment_$id');
env.handler = env.handleMethod;
env.initMethodCallHandler();
return env;
}
@override
Future<String?> getAvailableVersion(
{String? browserExecutableFolder}) async {
Future<String?> getAvailableVersion({String? browserExecutableFolder}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('browserExecutableFolder', () => browserExecutableFolder);
return await _staticChannel.invokeMethod<String>(
@ -118,4 +113,4 @@ class WindowsWebViewEnvironment extends PlatformWebViewEnvironment
extension InternalWindowsWebViewEnvironment on WindowsWebViewEnvironment {
get handleMethod => _handleMethod;
}
}

View File

@ -11,7 +11,7 @@
"watch": "flutter pub run build_runner watch --delete-conflicting-outputs",
"publish:dry": "flutter pub publish --dry-run",
"publish": "flutter pub publish",
"format": "dart format flutter_inappwebview/lib flutter_inappwebview/example/integration_test flutter_inappwebview_platform_interface/lib flutter_inappwebview_android/lib flutter_inappwebview_ios/lib flutter_inappwebview_macos/lib flutter_inappwebview_web/lib",
"format": "dart format flutter_inappwebview/lib flutter_inappwebview/example/integration_test flutter_inappwebview_platform_interface/lib flutter_inappwebview_android/lib flutter_inappwebview_ios/lib flutter_inappwebview_macos/lib flutter_inappwebview_web/lib flutter_inappwebview_windows/lib",
"build:publish": "npm run format && npm run build && flutter pub publish",
"docs:gen": "flutter pub global activate dartdoc && flutter pub global run dartdoc:dartdoc",
"docs:serve": "flutter pub global activate dhttpd && flutter pub global run dhttpd:dhttpd --path doc/api"