我不知道如何将 appBar 的自动后退按钮更改为不同的颜色。它在一个脚手架下,我试图研究它,但我无法绕着它转。
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Image.asset(
'images/.jpg',
fit: BoxFit.fill,
),
centerTitle: true,
),
最佳答案
您必须使用 AppBar 中的 iconTheme
属性,如下所示:
appBar: AppBar(
iconTheme: IconThemeData(
color: Colors.black, //change your color here
),
title: Text("Sample"),
centerTitle: true,
),
或者如果你想自己处理后退按钮。
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => Navigator.of(context).pop(),
),
title: Text("Sample"),
centerTitle: true,
),
更好的是,仅当您想更改后退按钮的颜色时。
appBar: AppBar(
leading: BackButton(
color: Colors.black
),
title: Text("Sample"),
centerTitle: true,
),
https://stackoverflow.com/questions/51508257/
相关文章:
flutter - 检查 Flutter 应用上是否有可用的 Internet 连接
android - 如何在 FlatButton 单击时关闭 AlertDialog?
dart - 如何在 Flutter 中设置主屏幕的背景颜色?
dart - 在没有动画的情况下替换 MaterialApp 中的初始路由?
java - Flutter.io Android 许可证状态未知
dart - Flutter:如何解决错误导入包:http/http.dart
dart - Flutter - 如何在 AppBar 不存在时设置状态栏颜色