+
+
+
+
+
+ Inline WebView
+
+ Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.
+
+
+
+
+
+
+ """
+ ),
+ initialHeaders: {},
+ initialOptions: InAppWebViewWidgetOptions(
+ inAppWebViewOptions: InAppWebViewOptions(
+ debuggingEnabled: true,
+ useShouldOverrideUrlLoading: true
+ ),
+ androidInAppWebViewOptions: AndroidInAppWebViewOptions(
+ domStorageEnabled: true,
+ regexToCancelSubFramesLoading: ""
+ )
+ ),
+ onWebViewCreated: (InAppWebViewController controller) {
+ webView = controller;
+ },
+ onLoadStart: (InAppWebViewController controller, String url) {
+ print("start $url");
+ },
+ onLoadStop: (InAppWebViewController controller, String url) async {
+ print("stop $url");
+ },
+ onPrint: (InAppWebViewController controller, String url) async {
+ print("print $url");
+ },
+ onCreateWindow: (InAppWebViewController controller, String url) async {
+ print("target blank $url");
+ },
+ shouldOverrideUrlLoading: (InAppWebViewController controller, ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
+ print("overidde url ${shouldOverrideUrlLoadingRequest.url}, method: ${shouldOverrideUrlLoadingRequest.method}, headers: ${shouldOverrideUrlLoadingRequest.headers}, isForMainFrame: ${shouldOverrideUrlLoadingRequest.isForMainFrame}");
+ return ShouldOverrideUrlLoadingAction.ALLOW;
+ },
+ ),
+ )
+ /*Container(
+ child: InAppWebView(
+ initialUrl: "about:blank",
+ //initialUrl: "https://www.youtube.com/embed/fq4N0hgOWzU",
+ initialHeaders: {},
+ initialOptions: InAppWebViewWidgetOptions(
+ inAppWebViewOptions: InAppWebViewOptions(
+ debuggingEnabled: true,
+ )
+ ),
+ onWebViewCreated: (InAppWebViewController controller) {
+ webView = controller;
+ },
+ onLoadStart: (InAppWebViewController controller, String url) {
+
+ },
+ onLoadStop: (InAppWebViewController controller, String url) async {
+
+ if (url == "about:blank" && defaultUserAgent == null) {
+ defaultUserAgent = await controller.evaluateJavascript(
+ source: "navigator.userAgent");
+
+ webView.setOptions(options: InAppWebViewWidgetOptions(
+ inAppWebViewOptions: InAppWebViewOptions(
+ userAgent: defaultUserAgent + " my-custom-value",
+ )
+ ));
+
+ webView.loadUrl(url: "https://flutter.dev");
+ }
+
+ print(await controller.evaluateJavascript(
+ source: "navigator.userAgent"));
+ },
+ ),
+ )*/
+ /*child: FutureBuilder(
+ future: InAppWebViewController.getDefaultUserAgent(),
+ builder: (context, projectSnap) {
+ if (!projectSnap.hasData) {
+ return Center(child: CircularProgressIndicator());
+ } else {
+ return Container(
+ child: InAppWebView(
+ initialUrl: "https://flutter.dev",
+ //initialUrl: "https://www.youtube.com/embed/fq4N0hgOWzU",
+ initialHeaders: {},
+ initialOptions: InAppWebViewWidgetOptions(
+ inAppWebViewOptions: InAppWebViewOptions(
+ debuggingEnabled: true,
+ userAgent: projectSnap.data.toString() + "; my-value"
+ )
+ ),
+ onWebViewCreated: (InAppWebViewController controller) {
+ webView = controller;
+ },
+ onLoadStart: (InAppWebViewController controller, String url) {
+
+ },
+ onLoadStop: (InAppWebViewController controller, String url) async {
+ print(await controller.evaluateJavascript(source: "navigator.userAgent"));
+ },
+ ),
+ );
+ }
+ }
+ ),*/
+ ),
+ ButtonBar(
+ alignment: MainAxisAlignment.center,
+ children: