2019-11-12 01:13:20 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2019-11-29 15:59:18 +00:00
|
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
2019-11-12 01:13:20 +00:00
|
|
|
|
|
|
|
import 'custom_widget_test.dart';
|
2019-11-16 11:41:30 +00:00
|
|
|
import 'main_test.dart';
|
2019-11-12 01:13:20 +00:00
|
|
|
|
|
|
|
class InAppWebViewInitialUrlTest extends WidgetTest {
|
2019-11-16 11:41:30 +00:00
|
|
|
final InAppWebViewInitialUrlTestState state = InAppWebViewInitialUrlTestState();
|
2019-11-12 01:13:20 +00:00
|
|
|
|
|
|
|
@override
|
2019-11-16 11:41:30 +00:00
|
|
|
InAppWebViewInitialUrlTestState createState() => state;
|
2019-11-12 01:13:20 +00:00
|
|
|
}
|
|
|
|
|
2019-11-16 11:41:30 +00:00
|
|
|
class InAppWebViewInitialUrlTestState extends WidgetTestState {
|
2019-11-21 01:19:43 +00:00
|
|
|
|
2019-11-16 11:41:30 +00:00
|
|
|
String appBarTitle = "InAppWebViewInitialUrlTest";
|
2019-11-12 01:13:20 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2019-11-25 00:42:27 +00:00
|
|
|
key: this.scaffoldKey,
|
2019-11-16 11:41:30 +00:00
|
|
|
appBar: myAppBar(state: this, title: appBarTitle),
|
2019-11-25 00:42:27 +00:00
|
|
|
drawer: myDrawer(context: context),
|
2019-11-12 01:13:20 +00:00
|
|
|
body: Container(
|
|
|
|
child: Column(children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: InAppWebView(
|
2019-11-21 01:19:43 +00:00
|
|
|
initialUrl: "https://flutter.dev/",
|
2019-11-12 01:13:20 +00:00
|
|
|
initialHeaders: {},
|
2020-05-11 00:48:41 +00:00
|
|
|
initialOptions: InAppWebViewGroupOptions(
|
2019-12-16 22:58:10 +00:00
|
|
|
crossPlatform: InAppWebViewOptions(
|
2019-11-16 11:41:30 +00:00
|
|
|
clearCache: true,
|
|
|
|
debuggingEnabled: true
|
|
|
|
)
|
|
|
|
),
|
2019-11-12 01:13:20 +00:00
|
|
|
onWebViewCreated: (InAppWebViewController controller) {
|
|
|
|
webView = controller;
|
|
|
|
},
|
|
|
|
onLoadStart: (InAppWebViewController controller, String url) {
|
|
|
|
|
|
|
|
},
|
|
|
|
onLoadStop: (InAppWebViewController controller, String url) {
|
2019-11-16 11:41:30 +00:00
|
|
|
setState(() {
|
|
|
|
appBarTitle = url;
|
|
|
|
});
|
2019-11-12 01:13:20 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
])
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|