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 {
294
294
final VoidCallback onPressed;
295
295
final IconData ? icon;
296
296
297
+ static double itemSpacing = 16 ;
298
+
297
299
static bool _debugCheckShapeAncestor (BuildContext context) {
298
300
final ancestor = context.findAncestorWidgetOfExactType <MenuButtonsShape >();
299
301
assert (() {
@@ -312,9 +314,18 @@ class MenuButton extends StatelessWidget {
312
314
313
315
final designVariables = DesignVariables .of (context);
314
316
317
+ // (see `trailingIcon`)
318
+ assert (Theme .of (context).visualDensity == VisualDensity .standard);
319
+
315
320
return MenuItemButton (
316
321
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))
318
329
: null ,
319
330
style: MenuItemButton .styleFrom (
320
331
padding: const EdgeInsets .symmetric (vertical: 12 , horizontal: 16 ),
You can’t perform that action at this time.
0 commit comments