Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flutter Inappwebview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
Flutter Inappwebview
Commits
ea6134d1
Commit
ea6134d1
authored
Oct 18, 2018
by
pichillilorenzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.4.1
parent
f201e948
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
22 deletions
+59
-22
example/lib/main.dart
example/lib/main.dart
+59
-22
No files found.
example/lib/main.dart
View file @
ea6134d1
import
'dart:async'
;
import
'dart:async'
;
import
'dart:convert'
show
base64
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_inappbrowser/flutter_inappbrowser.dart'
;
import
'package:flutter_inappbrowser/flutter_inappbrowser.dart'
;
...
@@ -13,7 +14,40 @@ class MyInAppBrowser extends InAppBrowser {
...
@@ -13,7 +14,40 @@ class MyInAppBrowser extends InAppBrowser {
Future
onLoadStop
(
String
url
)
async
{
Future
onLoadStop
(
String
url
)
async
{
print
(
"
\n\n
Stopped
$url
\n\n
"
);
print
(
"
\n\n
Stopped
$url
\n\n
"
);
//print("\n\n ${await this.isHidden()} \n\n");
// var screenshot = await this.takeScreenshot();
// await this.injectScriptCode("""
// document.body.innerHTML = '<img style="max-width: 100%; width: 100%" src="data:image/png;base64,${base64.encode(screenshot)}" />';
// """);
// var options = await this.getOptions();
// if (options["javaScriptEnabled"]) {
// await this.setOptions({
// //"progressBar": true,
// //"useOnLoadResource": true,
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title A",
// //"useShouldOverrideUrlLoading": true
// //"hideUrlBar": true,
// "javaScriptEnabled": false,
// "toolbarTop": true,
// "toolbarBottom": false
// });
// }
// else {
// await this.setOptions({
// //"progressBar": false,
// //"useOnLoadResource": false,
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title B",
// //"useShouldOverrideUrlLoading": true
// //"hideUrlBar": false,
// "javaScriptEnabled": true,
// "toolbarTop": false,
// "toolbarBottom": true
// });
// }
// print("\n\n ${await this.isHidden()} \n\n");
// await this.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest', 1, 5,'string', {'key': 5}, [4,6,8]);");
// await this.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest', 1, 5,'string', {'key': 5}, [4,6,8]);");
// await this.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest2', false, null, undefined);");
// await this.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest2', false, null, undefined);");
...
@@ -25,7 +59,9 @@ class MyInAppBrowser extends InAppBrowser {
...
@@ -25,7 +59,9 @@ class MyInAppBrowser extends InAppBrowser {
// await this.injectScriptCode("console.info('testInfo', 6);");
// await this.injectScriptCode("console.info('testInfo', 6);");
// await this.injectScriptCode("console.error('testError', false);");
// await this.injectScriptCode("console.error('testError', false);");
// await this.injectScriptCode("console.debug('testDebug', true);");
// await this.injectScriptCode("console.debug('testDebug', true);");
// print(await this.injectScriptCode("document.body.innerHTML"));
// print(await this.injectScriptCode("document.body.innerHTML"));
// print(await this.injectScriptCode("null"));
// print(await this.injectScriptCode("null"));
// print(await this.injectScriptCode("undefined"));
// print(await this.injectScriptCode("undefined"));
// print(await this.injectScriptCode("3"));
// print(await this.injectScriptCode("3"));
...
@@ -88,13 +124,14 @@ class MyInAppBrowser extends InAppBrowser {
...
@@ -88,13 +124,14 @@ class MyInAppBrowser extends InAppBrowser {
@override
@override
void
onConsoleMessage
(
ConsoleMessage
consoleMessage
)
{
void
onConsoleMessage
(
ConsoleMessage
consoleMessage
)
{
print
(
"""
print
(
consoleMessage
.
message
);
console output:
// print("""
sourceURL:
${consoleMessage.sourceURL}
// console output:
lineNumber:
${consoleMessage.lineNumber}
// sourceURL: ${consoleMessage.sourceURL}
message:
${consoleMessage.message}
// lineNumber: ${consoleMessage.lineNumber}
messageLevel:
${consoleMessage.messageLevel}
// message: ${consoleMessage.message}
"""
);
// messageLevel: ${consoleMessage.messageLevel}
// """);
}
}
}
}
...
@@ -162,18 +199,7 @@ class _MyAppState extends State<MyApp> {
...
@@ -162,18 +199,7 @@ class _MyAppState extends State<MyApp> {
// await InAppBrowser.openWithSystemBrowser("https://flutter.io/");
// await InAppBrowser.openWithSystemBrowser("https://flutter.io/");
await
inAppBrowserFallback
.
openOnLocalhost
(
"assets/index.html"
,
options:
{
// await inAppBrowserFallback.openOnLocalhost("assets/index.html", options: {
"useOnLoadResource"
:
true
,
//"hidden": true,
//"toolbarTopFixedTitle": "Fixed title",
//"useShouldOverrideUrlLoading": true
//"hideUrlBar": true,
//"toolbarTop": false,
//"toolbarBottom": false
});
// await inAppBrowserFallback.open(url: "assets/index.html", options: {
// "isLocalFile": true,
// "useOnLoadResource": true,
// "useOnLoadResource": true,
// //"hidden": true,
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title",
// //"toolbarTopFixedTitle": "Fixed title",
...
@@ -183,8 +209,9 @@ class _MyAppState extends State<MyApp> {
...
@@ -183,8 +209,9 @@ class _MyAppState extends State<MyApp> {
// //"toolbarBottom": false
// //"toolbarBottom": false
// });
// });
// await inAppBrowserFallback.open(url: "https://flutter.io/", options: {
// await inAppBrowserFallback.open(url: "assets/index.html", options: {
// //"useOnLoadResource": true,
// "isLocalFile": true,
// "useOnLoadResource": true,
// //"hidden": true,
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title",
// //"toolbarTopFixedTitle": "Fixed title",
// //"useShouldOverrideUrlLoading": true
// //"useShouldOverrideUrlLoading": true
...
@@ -192,6 +219,16 @@ class _MyAppState extends State<MyApp> {
...
@@ -192,6 +219,16 @@ class _MyAppState extends State<MyApp> {
// //"toolbarTop": false,
// //"toolbarTop": false,
// //"toolbarBottom": false
// //"toolbarBottom": false
// });
// });
await
inAppBrowserFallback
.
open
(
url:
"https://flutter.io/"
,
options:
{
//"useOnLoadResource": true,
//"hidden": true,
//"toolbarTopFixedTitle": "Fixed title",
//"useShouldOverrideUrlLoading": true
//"hideUrlBar": true,
//"toolbarTop": false,
//"toolbarBottom": false
});
//await inAppBrowserFallback.openOnLocalhost("assets/index.html");
//await inAppBrowserFallback.openOnLocalhost("assets/index.html");
},
},
child:
Text
(
"Open InAppBrowser"
)),
child:
Text
(
"Open InAppBrowser"
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment