提交 27437e9f authored 作者: shixiaochen's avatar shixiaochen

1、自定义返回箭头;

上级 fd495233
...@@ -16,7 +16,16 @@ class MyApp extends StatefulWidget { ...@@ -16,7 +16,16 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp(home: HomePage()); return MaterialApp(
home: HomePage(),
theme: ThemeData.light().copyWith(
appBarTheme: const AppBarTheme(
backgroundColor: Colors.blue,
foregroundColor: Colors.white,
elevation: 5.0,
),
),
);
} }
} }
...@@ -35,10 +44,11 @@ class HomePage extends StatelessWidget { ...@@ -35,10 +44,11 @@ class HomePage extends StatelessWidget {
onPressed: () { onPressed: () {
var url = var url =
"http://h5.clxkj.cn/userFeedback?productCode=msl&userMobile=1222222222&userName=马上来"; "http://h5.clxkj.cn/userFeedback?productCode=msl&userMobile=1222222222&userName=马上来";
Navigator.push( Navigator.pushAndRemoveUntil(
context, context,
CupertinoPageRoute( CupertinoPageRoute(
builder: (context) => ComplaintWebPage(url: url))); builder: (context) => ComplaintWebPage(url: url)),
(route) => false);
}, },
child: const Text("反馈投诉")), child: const Text("反馈投诉")),
], ],
......
...@@ -37,7 +37,16 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> { ...@@ -37,7 +37,16 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(_title ?? ""), centerTitle: true), appBar: AppBar(
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(Icons.arrow_back_ios),
),
title: Text(_title ?? ""),
centerTitle: true,
),
body: WebViewWidget(controller: _webViewController), body: WebViewWidget(controller: _webViewController),
); );
} }
...@@ -64,10 +73,10 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> { ...@@ -64,10 +73,10 @@ class _ComplaintWebPageState extends State<ComplaintWebPage> {
..setJavaScriptMode(JavaScriptMode.unrestricted) ..setJavaScriptMode(JavaScriptMode.unrestricted)
..addJavaScriptChannel("finishPage", ..addJavaScriptChannel("finishPage",
onMessageReceived: (JavaScriptMessage message) async { onMessageReceived: (JavaScriptMessage message) async {
debugPrint( debugPrint(
"JavascriptChannel:method = finishPage message = ${message.message}"); "JavascriptChannel:method = finishPage message = ${message.message}");
finishPage(message.message); finishPage(message.message);
}) })
..setNavigationDelegate( ..setNavigationDelegate(
NavigationDelegate(onPageFinished: _onPageFinished)) NavigationDelegate(onPageFinished: _onPageFinished))
..loadRequest(Uri.parse(widget.url ?? "")); ..loadRequest(Uri.parse(widget.url ?? ""));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论