Skip to content

Commit 599e2fd

Browse files
windows: added openDevTools, callDevToolsProtocolMethod, addDevToolsProtocolEventListener and removeDevToolsProtocolEventListener methods, added some more inappwebview and inappbrowser basic settings
1 parent ade2edf commit 599e2fd

23 files changed

+710
-136
lines changed

flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart

+15
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,21 @@ class InAppWebViewController {
484484
URLResponse? urlResponse}) =>
485485
platform.loadSimulatedRequest(urlRequest: urlRequest, data: data);
486486

487+
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.openDevTools}
488+
Future<void> openDevTools() => platform.openDevTools();
489+
490+
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.callDevToolsProtocolMethod}
491+
Future<dynamic> callDevToolsProtocolMethod({required String methodName, Map<String, dynamic>? parameters}) =>
492+
platform.callDevToolsProtocolMethod(methodName: methodName, parameters: parameters);
493+
494+
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.addDevToolsProtocolEventListener}
495+
Future<void> addDevToolsProtocolEventListener({required String eventName, required Function(dynamic data) callback}) =>
496+
platform.addDevToolsProtocolEventListener(eventName: eventName, callback: callback);
497+
498+
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.removeDevToolsProtocolEventListener}
499+
Future<void> removeDevToolsProtocolEventListener({required String eventName}) =>
500+
platform.removeDevToolsProtocolEventListener(eventName: eventName);
501+
487502
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getIFrameId}
488503
Future<String?> getIFrameId() => platform.getIFrameId();
489504

flutter_inappwebview_platform_interface/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.11
2+
3+
- Added `PlatformWebViewEnvironment` class
4+
15
## 1.0.10
26

37
- Merged "Added == operator and hashCode to WebUri" [#1941](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1941) (thanks to [daisukeueta](https://github.com/daisukeueta))

flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart

+105-101
Original file line numberDiff line numberDiff line change
@@ -98,194 +98,198 @@ class InAppBrowserSettings_
9898
implements BrowserOptions, AndroidOptions, IosOptions {
9999
///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally.
100100
///The default value is `false`.
101-
///
102-
///**Officially Supported Platforms/Implementations**:
103-
///- Android native WebView
104-
///- iOS
105-
///- MacOS
101+
@SupportedPlatforms(platforms: [
102+
AndroidPlatform(),
103+
IOSPlatform(),
104+
MacOSPlatform(),
105+
WindowsPlatform()
106+
])
106107
bool? hidden;
107108

108109
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
109-
///
110-
///**Officially Supported Platforms/Implementations**:
111-
///- Android native WebView
112-
///- iOS
113-
///- MacOS
110+
@SupportedPlatforms(platforms: [
111+
AndroidPlatform(),
112+
IOSPlatform(),
113+
MacOSPlatform()
114+
])
114115
bool? hideToolbarTop;
115116

116117
///Set the custom background color of the toolbar at the top.
117-
///
118-
///**Officially Supported Platforms/Implementations**:
119-
///- Android native WebView
120-
///- iOS
121-
///- MacOS
118+
@SupportedPlatforms(platforms: [
119+
AndroidPlatform(),
120+
IOSPlatform(),
121+
MacOSPlatform()
122+
])
122123
Color_? toolbarTopBackgroundColor;
123124

124125
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
125-
///
126-
///**Officially Supported Platforms/Implementations**:
127-
///- Android native WebView
128-
///- iOS
129-
///- MacOS
126+
@SupportedPlatforms(platforms: [
127+
AndroidPlatform(),
128+
IOSPlatform(),
129+
MacOSPlatform()
130+
])
130131
bool? hideUrlBar;
131132

132133
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
133-
///
134-
///**Officially Supported Platforms/Implementations**:
135-
///- Android native WebView
136-
///- iOS
137-
///- MacOS
134+
@SupportedPlatforms(platforms: [
135+
AndroidPlatform(),
136+
IOSPlatform(),
137+
MacOSPlatform()
138+
])
138139
bool? hideProgressBar;
139140

140141
///Set to `true` to hide the default menu items. The default value is `false`.
141-
///
142-
///**Officially Supported Platforms/Implementations**:
143-
///- Android native WebView
144-
///- iOS
142+
@SupportedPlatforms(platforms: [
143+
AndroidPlatform(),
144+
IOSPlatform(),
145+
MacOSPlatform()
146+
])
145147
bool? hideDefaultMenuItems;
146148

147149
///Set to `true` if you want the title should be displayed. The default value is `false`.
148-
///
149-
///**Officially Supported Platforms/Implementations**:
150-
///- Android native WebView
150+
@SupportedPlatforms(platforms: [
151+
AndroidPlatform()
152+
])
151153
bool? hideTitleBar;
152154

153155
///Set the action bar's title.
154-
///
155-
///**Officially Supported Platforms/Implementations**:
156-
///- Android native WebView
157-
///- MacOS
156+
@SupportedPlatforms(platforms: [
157+
AndroidPlatform(),
158+
MacOSPlatform(),
159+
WindowsPlatform()
160+
])
158161
String? toolbarTopFixedTitle;
159162

160163
///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`.
161-
///
162-
///**Officially Supported Platforms/Implementations**:
163-
///- Android native WebView
164+
@SupportedPlatforms(platforms: [
165+
AndroidPlatform()
166+
])
164167
bool? closeOnCannotGoBack;
165168

166169
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
167-
///
168-
///**Officially Supported Platforms/Implementations**:
169-
///- Android native WebView
170+
@SupportedPlatforms(platforms: [
171+
AndroidPlatform()
172+
])
170173
bool? allowGoBackWithBackButton;
171174

172175
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
173-
///
174-
///**Officially Supported Platforms/Implementations**:
175-
///- Android native WebView
176+
@SupportedPlatforms(platforms: [
177+
AndroidPlatform()
178+
])
176179
bool? shouldCloseOnBackButtonPressed;
177180

178181
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
179-
///
180-
///**Officially Supported Platforms/Implementations**:
181-
///- iOS
182+
@SupportedPlatforms(platforms: [
183+
IOSPlatform()
184+
])
182185
bool? toolbarTopTranslucent;
183186

184187
///Set the tint color to apply to the navigation bar background.
185-
///
186-
///**Officially Supported Platforms/Implementations**:
187-
///- iOS
188+
@SupportedPlatforms(platforms: [
189+
IOSPlatform()
190+
])
188191
Color_? toolbarTopBarTintColor;
189192

190193
///Set the tint color to apply to the navigation items and bar button items.
191-
///
192-
///**Officially Supported Platforms/Implementations**:
193-
///- iOS
194+
@SupportedPlatforms(platforms: [
195+
IOSPlatform()
196+
])
194197
Color_? toolbarTopTintColor;
195198

196199
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
197-
///
198-
///**Officially Supported Platforms/Implementations**:
199-
///- iOS
200+
@SupportedPlatforms(platforms: [
201+
IOSPlatform()
202+
])
200203
bool? hideToolbarBottom;
201204

202205
///Set the custom background color of the toolbar at the bottom.
203-
///
204-
///**Officially Supported Platforms/Implementations**:
205-
///- iOS
206+
@SupportedPlatforms(platforms: [
207+
IOSPlatform()
208+
])
206209
Color_? toolbarBottomBackgroundColor;
207210

208211
///Set the tint color to apply to the bar button items.
209-
///
210-
///**Officially Supported Platforms/Implementations**:
211-
///- iOS
212+
@SupportedPlatforms(platforms: [
213+
IOSPlatform()
214+
])
212215
Color_? toolbarBottomTintColor;
213216

214217
///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
215-
///
216-
///**Officially Supported Platforms/Implementations**:
217-
///- iOS
218+
@SupportedPlatforms(platforms: [
219+
IOSPlatform()
220+
])
218221
bool? toolbarBottomTranslucent;
219222

220223
///Set the custom text for the close button.
221-
///
222-
///**Officially Supported Platforms/Implementations**:
223-
///- iOS
224+
@SupportedPlatforms(platforms: [
225+
IOSPlatform()
226+
])
224227
String? closeButtonCaption;
225228

226229
///Set the custom color for the close button.
227-
///
228-
///**Officially Supported Platforms/Implementations**:
229-
///- iOS
230+
@SupportedPlatforms(platforms: [
231+
IOSPlatform()
232+
])
230233
Color_? closeButtonColor;
231234

232235
///Set to `true` to hide the close button. The default value is `false`.
233-
///
234-
///**Officially Supported Platforms/Implementations**:
235-
///- iOS
236+
@SupportedPlatforms(platforms: [
237+
IOSPlatform()
238+
])
236239
bool? hideCloseButton;
237240

238241
///Set the custom color for the menu button.
239-
///
240-
///**Officially Supported Platforms/Implementations**:
241-
///- iOS
242+
@SupportedPlatforms(platforms: [
243+
IOSPlatform()
244+
])
242245
Color_? menuButtonColor;
243246

244247
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
245-
///
246-
///**Officially Supported Platforms/Implementations**:
247-
///- iOS
248+
@SupportedPlatforms(platforms: [
249+
IOSPlatform()
250+
])
248251
ModalPresentationStyle_? presentationStyle;
249252

250253
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
251-
///
252-
///**Officially Supported Platforms/Implementations**:
253-
///- iOS
254+
@SupportedPlatforms(platforms: [
255+
IOSPlatform()
256+
])
254257
ModalTransitionStyle_? transitionStyle;
255258

256259
///How the browser window should be added to the main window.
257260
///The default value is [WindowType.WINDOW].
258-
///
259-
///**Officially Supported Platforms/Implementations**:
260-
///- MacOS
261+
@SupportedPlatforms(platforms: [
262+
MacOSPlatform(),
263+
WindowsPlatform()
264+
])
261265
WindowType_? windowType;
262266

263267
///The window’s alpha value.
264268
///The default value is `1.0`.
265-
///
266-
///**Officially Supported Platforms/Implementations**:
267-
///- MacOS
269+
@SupportedPlatforms(platforms: [
270+
MacOSPlatform(),
271+
WindowsPlatform()
272+
])
268273
double? windowAlphaValue;
269274

270275
///Flags that describe the window’s current style, such as if it’s resizable or in full-screen mode.
271-
///
272-
///**Officially Supported Platforms/Implementations**:
273-
///- MacOS
276+
@SupportedPlatforms(platforms: [
277+
MacOSPlatform()
278+
])
274279
WindowStyleMask_? windowStyleMask;
275280

276281
///The type of separator that the app displays between the title bar and content of a window.
277-
///
278-
///**NOTE for MacOS**: available on MacOS 11.0+.
279-
///
280-
///**Officially Supported Platforms/Implementations**:
281-
///- MacOS
282+
@SupportedPlatforms(platforms: [
283+
MacOSPlatform(available: '11.0')
284+
])
282285
WindowTitlebarSeparatorStyle_? windowTitlebarSeparatorStyle;
283286

284287
///Sets the origin and size of the window’s frame rectangle according to a given frame rectangle,
285288
///thereby setting its position and size onscreen.
286-
///
287-
///**Officially Supported Platforms/Implementations**:
288-
///- MacOS
289+
@SupportedPlatforms(platforms: [
290+
MacOSPlatform(),
291+
WindowsPlatform()
292+
])
289293
InAppWebViewRect_? windowFrame;
290294

291295
InAppBrowserSettings_(

flutter_inappwebview_platform_interface/lib/src/in_app_webview/in_app_webview_keep_alive.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ class InAppWebViewControllerKeepAliveProps {
2828
Map<String, ScriptHtmlTagAttributes> injectedScriptsFromURL;
2929
Set<PlatformWebMessageChannel> webMessageChannels = Set();
3030
Set<PlatformWebMessageListener> webMessageListeners = Set();
31+
Map<String, Function(dynamic data)> devToolsProtocolEventListenerMap;
3132

3233
InAppWebViewControllerKeepAliveProps(
3334
{required this.javaScriptHandlersMap,
3435
required this.userScripts,
3536
required this.webMessageListenerObjNames,
3637
required this.injectedScriptsFromURL,
3738
required this.webMessageChannels,
38-
required this.webMessageListeners});
39+
required this.webMessageListeners,
40+
required this.devToolsProtocolEventListenerMap
41+
});
3942
}

0 commit comments

Comments
 (0)