I'm trying to change the UserAccountsDrawerHeader background from light blue to another color in my Drawer but I'm not able to find a solution. Can anyone help me?
return Drawer(
child: ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text(sessionUsername),
accountEmail: Text(mail),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.red,
backgroundImage: NetworkImage(gravatarUrl),
),
),
ListTile(
title: Text('Home'),
leading: Icon(Icons.home, color: myColor),
onTap: () {
print("Going to home");
//Close the drawer
Navigator.of(context).pop();
//Navigate to home page
//Navigate with avoiding the possibility to return
Navigator.of(context).pushReplacementNamed(HomePage.tag);
},
),
],
),
);
MyDrawer:
Since you've not specified the decoration
property, color is set to default primaryColor of theme. Use decoration
property to set color.
UserAccountsDrawerHeader(
decoration: BoxDecoration(
color: Colors.red,
),
accountName: Text(sessionUsername),
accountEmail: Text(mail),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.red,
backgroundImage: NetworkImage(gravatarUrl),
),
),
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