Amm*_*ang 8 navigation-drawer flutter flutter-layout
导航抽屉的汉堡图标颜色没有变化.它默认为黑色.我想改变这个图标颜色颤动,我卡住了,帮我改变这个图标颜色.这是我的代码.
class Test extends StatefulWidget {
@override
_TestState createState() => new _TestState();
}
class _TestState extends State<Test> {
@override
Widget build(BuildContext context) {
return new Scaffold(
drawer: new Drawer(),
appBar: new AppBar(
title: new Text("Navigation Drawer")
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
Phu*_*ran 33
将iconTheme添加到AppBar
@override
Widget build(BuildContext context) {
return new Scaffold(
drawer: new Drawer(),
appBar: new AppBar(
title: new Text("Navigation Drawer"),
iconTheme: new IconThemeData(color: Colors.green),
),
);
}
Run Code Online (Sandbox Code Playgroud)
Cop*_*oad 13
您还可以使用以下 inTheme的data属性
Theme(
data: ThemeData(primaryIconTheme: IconThemeData(color: Colors.red)), // use this
child: Scaffold(),
)
Run Code Online (Sandbox Code Playgroud)
或者
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.menu, color: Colors.red), // set your color here
onPressed: () {},
),
),
Run Code Online (Sandbox Code Playgroud)
要更改图标的颜色,请使用此
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: AppBar(title: new Text('List view example'),
leading: new Icon(Icons.menu,color: Colors.green,),
),
),
);
}
Run Code Online (Sandbox Code Playgroud)
Icon(Icons.menu,color: Colors.green,) 定义图标内的颜色
| 归档时间: |
|
| 查看次数: |
11340 次 |
| 最近记录: |