我有一个白色的AppBar颜色,当我在图标中添加一个AppDrawer时,抽屉就会与白色的AppBar融合在一起。如何更改抽屉图标的颜色?
这是我的一些代码:
@override
Widget build(BuildContext context) {
return Scaffold(
endDrawer: AppDrawer(),
appBar: AppBar(
backgroundColor: Colors.white,
title: Image.asset(
'images/appbar_logo.jpg',
fit: BoxFit.fill,
),
centerTitle: true,
), // AppBar
和我的AppDrawer状态控件:
class AppDrawer extends StatefulWidget {
@override
_AppDrawerState createState() => _AppDrawerState();
}
class _AppDrawerState extends State<AppDrawer> {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: <Widget>[
new DrawerHeader(
child: new Image.asset("images/drawer_header_img.jpg")),
ListTile(
title: new Text("Item 1"),
),
ListTile(
title: new Text("Item 2"),
),
],
),
);
}
答案 0 :(得分:0)
将iconTheme属性添加到appBar
@override
Widget build(BuildContext context) {
return Scaffold(
endDrawer: AppDrawer(),
appBar: AppBar(
backgroundColor: Colors.white,
title: Image.asset(
'images/appbar_logo.jpg',
fit: BoxFit.fill,
),
centerTitle: true,
iconTheme: IconThemeData(color: Colors.blue), //add this line here
), // AppBar
参考:doc