Skip to content

Commit f5598f5

Browse files
committed
button [nfc]: Factor MenuButton's vertical padding as around just the text
This gives flexibility to pass a switch component with built-in vertical padding as `beforeIcon`.
1 parent 3e496ec commit f5598f5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/widgets/button.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,18 @@ class MenuButton extends StatelessWidget {
342342
]))
343343
: null,
344344
style: MenuItemButton.styleFrom(
345-
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
345+
padding: const EdgeInsets.symmetric(horizontal: 16),
346346
foregroundColor: designVariables.contextMenuItemText,
347347
splashFactory: NoSplash.splashFactory,
348348
).copyWith(backgroundColor: WidgetStateColor.resolveWith((states) =>
349349
designVariables.contextMenuItemBg.withFadedAlpha(
350350
states.contains(WidgetState.pressed) ? 0.20 : 0.12))),
351351
onPressed: onPressed,
352-
child: Text(label,
353-
style: const TextStyle(fontSize: 20, height: 24 / 20)
354-
.merge(weightVariableTextStyle(context, wght: 600))));
352+
child: Padding(
353+
padding: const EdgeInsets.symmetric(vertical: 12),
354+
child: Text(label,
355+
style: const TextStyle(fontSize: 20, height: 24 / 20)
356+
.merge(weightVariableTextStyle(context, wght: 600))),
357+
));
355358
}
356359
}

0 commit comments

Comments
 (0)