2019-12-09 23:29:52 +00:00
|
|
|
import 'dart:async';
|
2020-06-02 23:45:58 +00:00
|
|
|
import 'dart:io';
|
2018-11-13 11:02:20 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-06-02 23:45:58 +00:00
|
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
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();
|
2020-05-23 17:33:54 +00:00
|
|
|
runApp(MyApp());
|
2018-11-13 11:02:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_MyAppState createState() => new _MyAppState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyAppState extends State<MyApp> {
|
2020-06-02 23:45:58 +00:00
|
|
|
InAppWebViewController webView;
|
|
|
|
CookieManager _cookieManager = CookieManager.instance();
|
2018-11-13 11:02:20 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
2020-06-02 23:45:58 +00:00
|
|
|
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 {
|
|
|
|
|
|
|
|
},
|
|
|
|
))
|
|
|
|
])),
|
|
|
|
),
|
2018-11-13 11:02:20 +00:00
|
|
|
);
|
|
|
|
}
|
2020-06-02 23:45:58 +00:00
|
|
|
}
|