Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
boolean useWideViewPort = call.argument("useWideViewPort");
String invalidUrlRegex = call.argument("invalidUrlRegex");
boolean geolocationEnabled = call.argument("geolocationEnabled");
boolean debuggingEnabled = call.argument("debuggingEnabled");

if (webViewManager == null || webViewManager.closed == true) {
webViewManager = new WebviewManager(activity, context);
Expand All @@ -126,7 +127,8 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
allowFileURLs,
useWideViewPort,
invalidUrlRegex,
geolocationEnabled
geolocationEnabled,
debuggingEnabled
);
result.success(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ void openUrl(
boolean allowFileURLs,
boolean useWideViewPort,
String invalidUrlRegex,
boolean geolocationEnabled
boolean geolocationEnabled,
boolean debuggingEnabled
) {
webView.getSettings().setJavaScriptEnabled(withJavascript);
webView.getSettings().setBuiltInZoomControls(withZoom);
Expand All @@ -362,7 +363,10 @@ void openUrl(
webView.getSettings().setAllowUniversalAccessFromFileURLs(allowFileURLs);

webView.getSettings().setUseWideViewPort(useWideViewPort);


// Handle debugging
webView.setWebContentsDebuggingEnabled(debuggingEnabled);

webViewClient.updateInvalidUrlRegex(invalidUrlRegex);

if (geolocationEnabled) {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class FlutterWebviewPlugin {
bool useWideViewPort,
String invalidUrlRegex,
bool geolocationEnabled,
bool debuggingEnabled,
}) async {
final args = <String, dynamic>{
'url': url,
Expand All @@ -149,6 +150,7 @@ class FlutterWebviewPlugin {
'useWideViewPort': useWideViewPort ?? false,
'invalidUrlRegex': invalidUrlRegex,
'geolocationEnabled': geolocationEnabled ?? false,
'debuggingEnabled': debuggingEnabled ?? false,
};

if (headers != null) {
Expand Down
7 changes: 5 additions & 2 deletions lib/src/webview_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class WebviewScaffold extends StatefulWidget {
this.allowFileURLs,
this.resizeToAvoidBottomInset = false,
this.invalidUrlRegex,
this.geolocationEnabled
this.geolocationEnabled,
this.debuggingEnabled = false,
}) : super(key: key);

final PreferredSizeWidget appBar;
Expand All @@ -58,6 +59,7 @@ class WebviewScaffold extends StatefulWidget {
final bool resizeToAvoidBottomInset;
final String invalidUrlRegex;
final bool geolocationEnabled;
final bool debuggingEnabled;

@override
_WebviewScaffoldState createState() => _WebviewScaffoldState();
Expand Down Expand Up @@ -153,7 +155,8 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
appCacheEnabled: widget.appCacheEnabled,
allowFileURLs: widget.allowFileURLs,
invalidUrlRegex: widget.invalidUrlRegex,
geolocationEnabled: widget.geolocationEnabled
geolocationEnabled: widget.geolocationEnabled,
debuggingEnabled: widget.debuggingEnabled,
);
} else {
if (_rect != value) {
Expand Down