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
30102a5c
Commit
30102a5c
authored
Jun 03, 2020
by
Lorenzo Pichilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated example main.dart
parent
17d8aa11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
45 deletions
+60
-45
example/lib/main.dart
example/lib/main.dart
+60
-45
No files found.
example/lib/main.dart
View file @
30102a5c
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:flutter_inappwebview_example/chrome_safari_browser_example.screen.dart'
;
import
'package:flutter_inappwebview_example/headless_in_app_webview.screen.dart'
;
import
'package:flutter_inappwebview_example/in_app_webiew_example.screen.dart'
;
import
'package:flutter_inappwebview_example/in_app_browser_example.screen.dart'
;
// import 'package:permission_handler/permission_handler.dart';
// InAppLocalhostServer localhostServer = new InAppLocalhostServer();
Future
main
(
)
async
{
WidgetsFlutterBinding
.
ensureInitialized
();
// await Permission.camera.request();
// await Permission.storage.request();
// await localhostServer.start();
runApp
(
MyApp
());
}
Drawer
myDrawer
(
{
@required
BuildContext
context
})
{
return
Drawer
(
child:
ListView
(
padding:
EdgeInsets
.
zero
,
children:
<
Widget
>[
DrawerHeader
(
child:
Text
(
'flutter_inappbrowser example'
),
decoration:
BoxDecoration
(
color:
Colors
.
blue
,
),
),
ListTile
(
title:
Text
(
'InAppBrowser'
),
onTap:
()
{
Navigator
.
pushReplacementNamed
(
context
,
'/InAppBrowser'
);
},
),
ListTile
(
title:
Text
(
'ChromeSafariBrowser'
),
onTap:
()
{
Navigator
.
pushReplacementNamed
(
context
,
'/ChromeSafariBrowser'
);
},
),
ListTile
(
title:
Text
(
'InAppWebView'
),
onTap:
()
{
Navigator
.
pushReplacementNamed
(
context
,
'/'
);
},
),
ListTile
(
title:
Text
(
'HeadlessInAppWebView'
),
onTap:
()
{
Navigator
.
pushReplacementNamed
(
context
,
'/HeadlessInAppWebView'
);
},
),
],
),
);
}
class
MyApp
extends
StatefulWidget
{
@override
_MyAppState
createState
()
=>
new
_MyAppState
();
}
class
_MyAppState
extends
State
<
MyApp
>
{
InAppWebViewController
webView
;
CookieManager
_cookieManager
=
CookieManager
.
instance
();
@override
void
initState
()
{
...
...
@@ -30,46 +78,13 @@ class _MyAppState extends State<MyApp> {
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'InAppWebView Example'
),
),
body:
Container
(
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
InAppWebView
(
initialUrl:
"https://github.com/"
,
initialOptions:
InAppWebViewGroupOptions
(
crossPlatform:
InAppWebViewOptions
(
debuggingEnabled:
true
),
),
onWebViewCreated:
(
InAppWebViewController
controller
)
{
webView
=
controller
;
},
onLoadStart:
(
InAppWebViewController
controller
,
String
url
)
{},
onLoadStop:
(
InAppWebViewController
controller
,
String
url
)
async
{
},
)),
Expanded
(
child:
InAppWebView
(
initialUrl:
"https://github.com/"
,
initialOptions:
InAppWebViewGroupOptions
(
crossPlatform:
InAppWebViewOptions
(
debuggingEnabled:
true
),
),
onWebViewCreated:
(
InAppWebViewController
controller
)
{
webView
=
controller
;
},
onLoadStart:
(
InAppWebViewController
controller
,
String
url
)
{},
onLoadStop:
(
InAppWebViewController
controller
,
String
url
)
async
{
},
))
])),
),
initialRoute:
'/'
,
routes:
{
'/'
:
(
context
)
=>
InAppWebViewExampleScreen
(),
'/InAppBrowser'
:
(
context
)
=>
InAppBrowserExampleScreen
(),
'/ChromeSafariBrowser'
:
(
context
)
=>
ChromeSafariBrowserExampleScreen
(),
'/HeadlessInAppWebView'
:
(
context
)
=>
HeadlessInAppWebViewExampleScreen
(),
}
);
}
}
}
\ No newline at end of file
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