Skip to content

Commit

Permalink
initial windows implementation #460
Browse files Browse the repository at this point in the history
  • Loading branch information
pichillilorenzo committed Jan 31, 2024
1 parent a6b9a95 commit 981c035
Show file tree
Hide file tree
Showing 35 changed files with 392 additions and 399 deletions.
4 changes: 2 additions & 2 deletions flutter_inappwebview/lib/src/cookie_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class CookieManager {
return _instance!;
} else {
return CookieManager.fromPlatformCreationParams(
PlatformCookieManagerCreationParams(webViewEnvironment: webViewEnvironment.platform)
);
PlatformCookieManagerCreationParams(
webViewEnvironment: webViewEnvironment.platform));
}
}

Expand Down
30 changes: 15 additions & 15 deletions flutter_inappwebview/lib/src/in_app_browser/in_app_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion flutter_inappwebview/lib/src/webview_environment/main.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'webview_environment.dart';
export 'webview_environment.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 window’s alpha value.
///The default value is `1.0`.
@SupportedPlatforms(platforms: [
MacOSPlatform(),
WindowsPlatform()
])
@SupportedPlatforms(platforms: [MacOSPlatform(), WindowsPlatform()])
double? windowAlphaValue;

///Flags that describe the window’s current style, such as if it’s 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 window’s 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_(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 981c035

Please sign in to comment.