I want to set divider between PopupMenuItem and I want to change styling PopupMenuDivider color which that have default color. How can i do this ?
I want to set divider between PopupMenuItem and I want to change styling PopupMenuDivider color which that have default color. How can i do this ?
You can do this very easily using the Theme class, using which you can change the icon color, text color and Default PopupMenuDivider color.
Again, you can easily do this on Divider at PopupMenuItem using PopupMenuDivider.
actions: [
Theme(
data: Theme.of(context).copyWith(
dividerTheme: DividerThemeData(
color: Colors.black,
),
iconTheme: IconThemeData(color: Colors.white),
textTheme: TextTheme().apply(bodyColor: Colors.white),
),
child: PopupMenuButton<int>(
color: Colors.indigo,
//onSelected: (item) => onSelected(context, item),
itemBuilder: (context) => [
PopupMenuItem<int>(
value: 0,
child: Text('Settings'),
),
PopupMenuDivider(),
PopupMenuItem<int>(
value: 1,
child: Text('Share'),
),
PopupMenuDivider(),
PopupMenuItem<int>(
value: 2,
child: Row(
children: [
Icon(Icons.logout),
const SizedBox(width: 8),
Text('Sign Out'),
],
),
),
],
),
),
],