Issue
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 ?
Solution
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'),
],
),
),
],
),
),
],
Answered By - AL MAMUN Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.