6

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"),
          ),
        ],
      ),
    );
  }
HDiamond
  • 1,037
  • 2
  • 11
  • 14
  • 2
    Possible duplicate of [Flutter navigation drawer hamburger icon color change](https://stackoverflow.com/questions/50580234/flutter-navigation-drawer-hamburger-icon-color-change) – Shady Aziza Aug 02 '18 at 16:48

1 Answers1

7

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

Felix Runye
  • 2,135
  • 1
  • 20
  • 20