updated example

This commit is contained in:
Lorenzo Pichilli 2022-04-30 21:23:16 +02:00
parent f728248dbd
commit 2a3e368780
1 changed files with 11 additions and 4 deletions

View File

@ -21,7 +21,8 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
mediaPlaybackRequiresUserGesture: false, mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true, allowsInlineMediaPlayback: true,
iframeAllow: "camera; microphone", iframeAllow: "camera; microphone",
iframeAllowFullscreen: true iframeAllowFullscreen: true,
javaScriptEnabled: false
); );
PullToRefreshController? pullToRefreshController; PullToRefreshController? pullToRefreshController;
@ -113,10 +114,10 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
children: [ children: [
InAppWebView( InAppWebView(
key: webViewKey, key: webViewKey,
// initialUrlRequest:
// URLRequest(url: Uri.parse("https://flutter.dev")),
initialUrlRequest: initialUrlRequest:
URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')), URLRequest(url: Uri.parse("https://flutter.dev")),
// initialUrlRequest:
// URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')),
// initialFile: "assets/index.html", // initialFile: "assets/index.html",
initialUserScripts: UnmodifiableListView<UserScript>([]), initialUserScripts: UnmodifiableListView<UserScript>([]),
initialSettings: settings, initialSettings: settings,
@ -217,6 +218,12 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
webViewController?.reload(); webViewController?.reload();
}, },
), ),
ElevatedButton(
child: Icon(Icons.refresh),
onPressed: () {
webViewController?.evaluateJavascript(source: "document.title='test';");
},
),
], ],
), ),
]))); ])));