File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,8 @@ class MenuButton extends StatelessWidget {
294294 final VoidCallback onPressed;
295295 final IconData ? icon;
296296
297+ static double itemSpacing = 16 ;
298+
297299 static bool _debugCheckShapeAncestor (BuildContext context) {
298300 final ancestor = context.findAncestorWidgetOfExactType <MenuButtonsShape >();
299301 assert (() {
@@ -312,9 +314,18 @@ class MenuButton extends StatelessWidget {
312314
313315 final designVariables = DesignVariables .of (context);
314316
317+ // (see `trailingIcon`)
318+ assert (Theme .of (context).visualDensity == VisualDensity .standard);
319+
315320 return MenuItemButton (
316321 trailingIcon: icon != null
317- ? Icon (icon, color: designVariables.contextMenuItemText)
322+ ? Padding (
323+ // This Material widget gives us 12px padding before the icon --
324+ // or more or less, depending on Theme.of(context).visualDensity,
325+ // hence the `assert` above.
326+ padding: EdgeInsetsDirectional .only (start: itemSpacing - 12 ),
327+
328+ child: Icon (icon, color: designVariables.contextMenuItemText))
318329 : null ,
319330 style: MenuItemButton .styleFrom (
320331 padding: const EdgeInsets .symmetric (vertical: 12 , horizontal: 16 ),
You can’t perform that action at this time.
0 commit comments