Skip to content

Commit 981c035

Browse files
initial windows implementation #460
1 parent a6b9a95 commit 981c035

35 files changed

+392
-399
lines changed

flutter_inappwebview/lib/src/cookie_manager.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class CookieManager {
4545
return _instance!;
4646
} else {
4747
return CookieManager.fromPlatformCreationParams(
48-
PlatformCookieManagerCreationParams(webViewEnvironment: webViewEnvironment.platform)
49-
);
48+
PlatformCookieManagerCreationParams(
49+
webViewEnvironment: webViewEnvironment.platform));
5050
}
5151
}
5252

flutter_inappwebview/lib/src/in_app_browser/in_app_browser.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ class InAppBrowser implements PlatformInAppBrowserEvents {
1818
/// Constructs a [InAppBrowser].
1919
///
2020
/// {@macro flutter_inappwebview_platform_interface.PlatformInAppBrowser}
21-
InAppBrowser(
22-
{ContextMenu? contextMenu,
23-
PullToRefreshController? pullToRefreshController,
24-
FindInteractionController? findInteractionController,
25-
UnmodifiableListView<UserScript>? initialUserScripts,
26-
int? windowId,
27-
WebViewEnvironment? webViewEnvironment,
28-
})
29-
: this.fromPlatformCreationParams(
21+
InAppBrowser({
22+
ContextMenu? contextMenu,
23+
PullToRefreshController? pullToRefreshController,
24+
FindInteractionController? findInteractionController,
25+
UnmodifiableListView<UserScript>? initialUserScripts,
26+
int? windowId,
27+
WebViewEnvironment? webViewEnvironment,
28+
}) : this.fromPlatformCreationParams(
3029
PlatformInAppBrowserCreationParams(
31-
contextMenu: contextMenu,
32-
pullToRefreshController: pullToRefreshController?.platform,
33-
findInteractionController: findInteractionController?.platform,
34-
initialUserScripts: initialUserScripts,
35-
windowId: windowId,
36-
webViewEnvironment: webViewEnvironment?.platform,),
30+
contextMenu: contextMenu,
31+
pullToRefreshController: pullToRefreshController?.platform,
32+
findInteractionController: findInteractionController?.platform,
33+
initialUserScripts: initialUserScripts,
34+
windowId: windowId,
35+
webViewEnvironment: webViewEnvironment?.platform,
36+
),
3737
);
3838

3939
/// Constructs a [InAppBrowser] from creation params for a specific

flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,21 @@ class InAppWebViewController {
488488
Future<void> openDevTools() => platform.openDevTools();
489489

490490
///{@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);
491+
Future<dynamic> callDevToolsProtocolMethod(
492+
{required String methodName, Map<String, dynamic>? parameters}) =>
493+
platform.callDevToolsProtocolMethod(
494+
methodName: methodName, parameters: parameters);
493495

494496
///{@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+
Future<void> addDevToolsProtocolEventListener(
498+
{required String eventName,
499+
required Function(dynamic data) callback}) =>
500+
platform.addDevToolsProtocolEventListener(
501+
eventName: eventName, callback: callback);
497502

498503
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.removeDevToolsProtocolEventListener}
499-
Future<void> removeDevToolsProtocolEventListener({required String eventName}) =>
504+
Future<void> removeDevToolsProtocolEventListener(
505+
{required String eventName}) =>
500506
platform.removeDevToolsProtocolEventListener(eventName: eventName);
501507

502508
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.getIFrameId}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'webview_environment.dart';
1+
export 'webview_environment.dart';

flutter_inappwebview/lib/src/webview_environment/webview_environment.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@ class WebViewEnvironment {
2727
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.create}
2828
static Future<WebViewEnvironment> create(
2929
{WebViewEnvironmentSettings? settings}) async {
30-
return WebViewEnvironment.fromPlatform(platform: await PlatformWebViewEnvironment.static().create(settings: settings));
30+
return WebViewEnvironment.fromPlatform(
31+
platform: await PlatformWebViewEnvironment.static()
32+
.create(settings: settings));
3133
}
3234

3335
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.getAvailableVersion}
3436
static Future<String?> getAvailableVersion(
35-
{String? browserExecutableFolder}) => PlatformWebViewEnvironment.static().getAvailableVersion(browserExecutableFolder: browserExecutableFolder);
37+
{String? browserExecutableFolder}) =>
38+
PlatformWebViewEnvironment.static().getAvailableVersion(
39+
browserExecutableFolder: browserExecutableFolder);
3640

3741
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.getAvailableVersion}
3842
static Future<int?> compareBrowserVersions(
39-
{required String version1, required String version2}) => PlatformWebViewEnvironment.static().compareBrowserVersions(version1: version1, version2: version2);
43+
{required String version1, required String version2}) =>
44+
PlatformWebViewEnvironment.static()
45+
.compareBrowserVersions(version1: version1, version2: version2);
4046

4147
///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.dispose}
4248
Future<void> dispose() => platform.dispose();
43-
}
49+
}

flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.dart

Lines changed: 34 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -107,189 +107,124 @@ class InAppBrowserSettings_
107107
bool? hidden;
108108

109109
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
110-
@SupportedPlatforms(platforms: [
111-
AndroidPlatform(),
112-
IOSPlatform(),
113-
MacOSPlatform()
114-
])
110+
@SupportedPlatforms(
111+
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
115112
bool? hideToolbarTop;
116113

117114
///Set the custom background color of the toolbar at the top.
118-
@SupportedPlatforms(platforms: [
119-
AndroidPlatform(),
120-
IOSPlatform(),
121-
MacOSPlatform()
122-
])
115+
@SupportedPlatforms(
116+
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
123117
Color_? toolbarTopBackgroundColor;
124118

125119
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
126-
@SupportedPlatforms(platforms: [
127-
AndroidPlatform(),
128-
IOSPlatform(),
129-
MacOSPlatform()
130-
])
120+
@SupportedPlatforms(
121+
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
131122
bool? hideUrlBar;
132123

133124
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
134-
@SupportedPlatforms(platforms: [
135-
AndroidPlatform(),
136-
IOSPlatform(),
137-
MacOSPlatform()
138-
])
125+
@SupportedPlatforms(
126+
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
139127
bool? hideProgressBar;
140128

141129
///Set to `true` to hide the default menu items. The default value is `false`.
142-
@SupportedPlatforms(platforms: [
143-
AndroidPlatform(),
144-
IOSPlatform(),
145-
MacOSPlatform()
146-
])
130+
@SupportedPlatforms(
131+
platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform()])
147132
bool? hideDefaultMenuItems;
148133

149134
///Set to `true` if you want the title should be displayed. The default value is `false`.
150-
@SupportedPlatforms(platforms: [
151-
AndroidPlatform()
152-
])
135+
@SupportedPlatforms(platforms: [AndroidPlatform()])
153136
bool? hideTitleBar;
154137

155138
///Set the action bar's title.
156-
@SupportedPlatforms(platforms: [
157-
AndroidPlatform(),
158-
MacOSPlatform(),
159-
WindowsPlatform()
160-
])
139+
@SupportedPlatforms(
140+
platforms: [AndroidPlatform(), MacOSPlatform(), WindowsPlatform()])
161141
String? toolbarTopFixedTitle;
162142

163143
///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`.
164-
@SupportedPlatforms(platforms: [
165-
AndroidPlatform()
166-
])
144+
@SupportedPlatforms(platforms: [AndroidPlatform()])
167145
bool? closeOnCannotGoBack;
168146

169147
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
170-
@SupportedPlatforms(platforms: [
171-
AndroidPlatform()
172-
])
148+
@SupportedPlatforms(platforms: [AndroidPlatform()])
173149
bool? allowGoBackWithBackButton;
174150

175151
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
176-
@SupportedPlatforms(platforms: [
177-
AndroidPlatform()
178-
])
152+
@SupportedPlatforms(platforms: [AndroidPlatform()])
179153
bool? shouldCloseOnBackButtonPressed;
180154

181155
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
182-
@SupportedPlatforms(platforms: [
183-
IOSPlatform()
184-
])
156+
@SupportedPlatforms(platforms: [IOSPlatform()])
185157
bool? toolbarTopTranslucent;
186158

187159
///Set the tint color to apply to the navigation bar background.
188-
@SupportedPlatforms(platforms: [
189-
IOSPlatform()
190-
])
160+
@SupportedPlatforms(platforms: [IOSPlatform()])
191161
Color_? toolbarTopBarTintColor;
192162

193163
///Set the tint color to apply to the navigation items and bar button items.
194-
@SupportedPlatforms(platforms: [
195-
IOSPlatform()
196-
])
164+
@SupportedPlatforms(platforms: [IOSPlatform()])
197165
Color_? toolbarTopTintColor;
198166

199167
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
200-
@SupportedPlatforms(platforms: [
201-
IOSPlatform()
202-
])
168+
@SupportedPlatforms(platforms: [IOSPlatform()])
203169
bool? hideToolbarBottom;
204170

205171
///Set the custom background color of the toolbar at the bottom.
206-
@SupportedPlatforms(platforms: [
207-
IOSPlatform()
208-
])
172+
@SupportedPlatforms(platforms: [IOSPlatform()])
209173
Color_? toolbarBottomBackgroundColor;
210174

211175
///Set the tint color to apply to the bar button items.
212-
@SupportedPlatforms(platforms: [
213-
IOSPlatform()
214-
])
176+
@SupportedPlatforms(platforms: [IOSPlatform()])
215177
Color_? toolbarBottomTintColor;
216178

217179
///Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
218-
@SupportedPlatforms(platforms: [
219-
IOSPlatform()
220-
])
180+
@SupportedPlatforms(platforms: [IOSPlatform()])
221181
bool? toolbarBottomTranslucent;
222182

223183
///Set the custom text for the close button.
224-
@SupportedPlatforms(platforms: [
225-
IOSPlatform()
226-
])
184+
@SupportedPlatforms(platforms: [IOSPlatform()])
227185
String? closeButtonCaption;
228186

229187
///Set the custom color for the close button.
230-
@SupportedPlatforms(platforms: [
231-
IOSPlatform()
232-
])
188+
@SupportedPlatforms(platforms: [IOSPlatform()])
233189
Color_? closeButtonColor;
234190

235191
///Set to `true` to hide the close button. The default value is `false`.
236-
@SupportedPlatforms(platforms: [
237-
IOSPlatform()
238-
])
192+
@SupportedPlatforms(platforms: [IOSPlatform()])
239193
bool? hideCloseButton;
240194

241195
///Set the custom color for the menu button.
242-
@SupportedPlatforms(platforms: [
243-
IOSPlatform()
244-
])
196+
@SupportedPlatforms(platforms: [IOSPlatform()])
245197
Color_? menuButtonColor;
246198

247199
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
248-
@SupportedPlatforms(platforms: [
249-
IOSPlatform()
250-
])
200+
@SupportedPlatforms(platforms: [IOSPlatform()])
251201
ModalPresentationStyle_? presentationStyle;
252202

253203
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
254-
@SupportedPlatforms(platforms: [
255-
IOSPlatform()
256-
])
204+
@SupportedPlatforms(platforms: [IOSPlatform()])
257205
ModalTransitionStyle_? transitionStyle;
258206

259207
///How the browser window should be added to the main window.
260208
///The default value is [WindowType.WINDOW].
261-
@SupportedPlatforms(platforms: [
262-
MacOSPlatform(),
263-
WindowsPlatform()
264-
])
209+
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
265210
WindowType_? windowType;
266211

267212
///The window’s alpha value.
268213
///The default value is `1.0`.
269-
@SupportedPlatforms(platforms: [
270-
MacOSPlatform(),
271-
WindowsPlatform()
272-
])
214+
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
273215
double? windowAlphaValue;
274216

275217
///Flags that describe the window’s current style, such as if it’s resizable or in full-screen mode.
276-
@SupportedPlatforms(platforms: [
277-
MacOSPlatform()
278-
])
218+
@SupportedPlatforms(platforms: [MacOSPlatform()])
279219
WindowStyleMask_? windowStyleMask;
280220

281221
///The type of separator that the app displays between the title bar and content of a window.
282-
@SupportedPlatforms(platforms: [
283-
MacOSPlatform(available: '11.0')
284-
])
222+
@SupportedPlatforms(platforms: [MacOSPlatform(available: '11.0')])
285223
WindowTitlebarSeparatorStyle_? windowTitlebarSeparatorStyle;
286224

287225
///Sets the origin and size of the window’s frame rectangle according to a given frame rectangle,
288226
///thereby setting its position and size onscreen.
289-
@SupportedPlatforms(platforms: [
290-
MacOSPlatform(),
291-
WindowsPlatform()
292-
])
227+
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
293228
InAppWebViewRect_? windowFrame;
294229

295230
InAppBrowserSettings_(

flutter_inappwebview_platform_interface/lib/src/in_app_browser/in_app_browser_settings.g.dart

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)