2019-12-09 23:29:52 +00:00
|
|
|
import 'dart:async';
|
2020-06-02 23:48:27 +00:00
|
|
|
|
2022-04-21 21:14:51 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2018-11-13 11:02:20 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-01-28 16:10:15 +00:00
|
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
2020-06-02 23:48:27 +00:00
|
|
|
|
|
|
|
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';
|
2022-05-08 23:51:21 +00:00
|
|
|
import 'package:flutter_inappwebview_example/web_authentication_session_example.screen.dart';
|
2021-02-24 23:00:46 +00:00
|
|
|
// import 'package:path_provider/path_provider.dart';
|
2021-02-04 00:43:55 +00:00
|
|
|
// import 'package:permission_handler/permission_handler.dart';
|
2020-06-02 23:48:27 +00:00
|
|
|
|
2022-05-08 23:51:21 +00:00
|
|
|
InAppLocalhostServer localhostServer = new InAppLocalhostServer();
|
2019-03-12 01:14:30 +00:00
|
|
|
|
2018-11-13 11:02:20 +00:00
|
|
|
Future main() async {
|
2020-05-09 02:36:07 +00:00
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
2021-02-04 00:43:55 +00:00
|
|
|
// await Permission.camera.request();
|
|
|
|
// await Permission.microphone.request();
|
2021-03-11 21:42:18 +00:00
|
|
|
// await Permission.storage.request();
|
2021-02-24 23:00:46 +00:00
|
|
|
|
2022-05-02 21:53:09 +00:00
|
|
|
WebView.debugLoggingSettings.maxLogMessageLength = 500;
|
2022-04-27 16:59:19 +00:00
|
|
|
|
2022-04-21 21:14:51 +00:00
|
|
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
2022-04-20 17:20:31 +00:00
|
|
|
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
|
2021-02-04 20:54:09 +00:00
|
|
|
}
|
|
|
|
|
2022-05-08 23:51:21 +00:00
|
|
|
await localhostServer.start();
|
|
|
|
|
2020-05-23 17:33:54 +00:00
|
|
|
runApp(MyApp());
|
2018-11-13 11:02:20 +00:00
|
|
|
}
|
|
|
|
|
2021-01-28 16:10:15 +00:00
|
|
|
Drawer myDrawer({required BuildContext context}) {
|
2020-06-02 23:48:27 +00:00
|
|
|
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');
|
|
|
|
},
|
|
|
|
),
|
2022-05-08 23:51:21 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text('WebAuthenticationSession'),
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pushReplacementNamed(context, '/WebAuthenticationSession');
|
|
|
|
},
|
|
|
|
),
|
2020-06-02 23:48:27 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text('InAppWebView'),
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pushReplacementNamed(context, '/');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text('HeadlessInAppWebView'),
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pushReplacementNamed(context, '/HeadlessInAppWebView');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-11-13 11:02:20 +00:00
|
|
|
class MyApp extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_MyAppState createState() => new _MyAppState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-03-01 19:26:57 +00:00
|
|
|
return MaterialApp(initialRoute: '/', routes: {
|
|
|
|
'/': (context) => InAppWebViewExampleScreen(),
|
|
|
|
'/InAppBrowser': (context) => InAppBrowserExampleScreen(),
|
|
|
|
'/ChromeSafariBrowser': (context) => ChromeSafariBrowserExampleScreen(),
|
|
|
|
'/HeadlessInAppWebView': (context) => HeadlessInAppWebViewExampleScreen(),
|
2022-05-08 23:51:21 +00:00
|
|
|
'/WebAuthenticationSession': (context) => WebAuthenticationSessionExampleScreen(),
|
2021-03-01 19:26:57 +00:00
|
|
|
});
|
2018-11-13 11:02:20 +00:00
|
|
|
}
|
2021-03-01 19:26:57 +00:00
|
|
|
}
|