updated example
This commit is contained in:
parent
abab589d80
commit
310cd60a6e
@ -42,7 +42,7 @@ class _HeadlessInAppWebViewExampleScreenState
|
||||
this.url = url.toString();
|
||||
});
|
||||
},
|
||||
onUpdateVisitedHistory: (controller, url, androidIsReload) {
|
||||
onUpdateVisitedHistory: (controller, url, isReload) {
|
||||
setState(() {
|
||||
this.url = url.toString();
|
||||
});
|
||||
|
@ -102,6 +102,10 @@ class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {
|
||||
urlRequest:
|
||||
URLRequest(url: Uri.parse("https://flutter.dev")),
|
||||
settings: InAppBrowserClassSettings(
|
||||
browserSettings: InAppBrowserSettings(
|
||||
toolbarTopBackgroundColor: Colors.blue,
|
||||
presentationStyle: ModalPresentationStyle.POPOVER
|
||||
),
|
||||
webViewSettings: InAppWebViewSettings(
|
||||
useShouldOverrideUrlLoading: true,
|
||||
useOnLoadResource: true,
|
||||
|
@ -19,7 +19,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||
InAppWebViewSettings settings = InAppWebViewSettings(
|
||||
useShouldOverrideUrlLoading: true,
|
||||
mediaPlaybackRequiresUserGesture: false,
|
||||
isFindInteractionEnabled: false,
|
||||
allowsInlineMediaPlayback: true,
|
||||
iframeAllow: "camera; microphone",
|
||||
iframeAllowFullscreen: true
|
||||
@ -116,7 +115,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||
InAppWebView(
|
||||
key: webViewKey,
|
||||
initialUrlRequest:
|
||||
URLRequest(url: Uri.parse('https://github.com/flutter')),
|
||||
URLRequest(url: Uri.parse('https://flutter.dev')),
|
||||
// initialUrlRequest:
|
||||
// URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')),
|
||||
// initialFile: "assets/index.html",
|
||||
@ -182,7 +181,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||
urlController.text = this.url;
|
||||
});
|
||||
},
|
||||
onUpdateVisitedHistory: (controller, url, androidIsReload) {
|
||||
onUpdateVisitedHistory: (controller, url, isReload) {
|
||||
setState(() {
|
||||
this.url = url.toString();
|
||||
urlController.text = this.url;
|
||||
|
@ -9,6 +9,7 @@ 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:flutter_inappwebview_example/web_authentication_session_example.screen.dart';
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
// import 'package:path_provider/path_provider.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
@ -26,53 +27,55 @@ Future main() async {
|
||||
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
|
||||
await localhostServer.start();
|
||||
// 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,
|
||||
PointerInterceptor myDrawer({required BuildContext context}) {
|
||||
return PointerInterceptor(
|
||||
child: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text('flutter_inappwebview 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('WebAuthenticationSession'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/WebAuthenticationSession');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('HeadlessInAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/HeadlessInAppWebView');
|
||||
},
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
title: Text('InAppBrowser'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/InAppBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('ChromeSafariBrowser'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/ChromeSafariBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('WebAuthenticationSession'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/WebAuthenticationSession');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('HeadlessInAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacementNamed(context, '/HeadlessInAppWebView');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ dependencies:
|
||||
path_provider: ^2.0.9
|
||||
permission_handler: ^10.0.2
|
||||
url_launcher: ^6.0.20
|
||||
pointer_interceptor: ^0.9.3+3
|
||||
# connectivity: ^0.4.5+6
|
||||
flutter_inappwebview:
|
||||
path: ../
|
||||
|
@ -12,7 +12,7 @@ dependencies:
|
||||
sdk: flutter
|
||||
flutter_web_plugins:
|
||||
sdk: flutter
|
||||
js: ^0.6.3
|
||||
js: ^0.6.4
|
||||
flutter_inappwebview_internal_annotations: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
|
Loading…
x
Reference in New Issue
Block a user