I have a white AppBar color, and when I add a AppDrawer into the icon for the drawer gets blended in with the white AppBar. How do I change the coloring of the icon for the drawer?
Here is some of my code:
@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
and my AppDrawer stateful widget:
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"),
),
],
),
);
}
To change the drawer icon color in Flutter: Simply add the iconTheme property inside the AppBar widget and assign the IconThemeData(color: [your_color]).
Add iconTheme property to 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
Ref: doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With