@@ -288,12 +288,19 @@ class MenuButton extends StatelessWidget {
288288 required this .label,
289289 required this .onPressed,
290290 this .icon,
291+ this .beforeIcon,
291292 });
292293
293294 final String label;
294295 final VoidCallback onPressed;
295296 final IconData ? icon;
296297
298+ /// An element to go before [icon] , or in its place if it's null.
299+ ///
300+ /// E.g. a switch:
301+ /// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6070-60682&m=dev
302+ final Widget ? beforeIcon;
303+
297304 static double itemSpacing = 16 ;
298305
299306 static bool _debugCheckShapeAncestor (BuildContext context) {
@@ -318,14 +325,21 @@ class MenuButton extends StatelessWidget {
318325 assert (Theme .of (context).visualDensity == VisualDensity .standard);
319326
320327 return MenuItemButton (
321- trailingIcon: icon != null
328+ trailingIcon: ( icon != null || beforeIcon != null )
322329 ? Padding (
323330 // This Material widget gives us 12px padding before the icon --
324331 // or more or less, depending on Theme.of(context).visualDensity,
325332 // hence the `assert` above.
326333 padding: EdgeInsetsDirectional .only (start: itemSpacing - 12 ),
327334
328- child: Icon (icon, color: designVariables.contextMenuItemText))
335+ child: Row (
336+ mainAxisSize: MainAxisSize .min,
337+ crossAxisAlignment: CrossAxisAlignment .center,
338+ spacing: itemSpacing,
339+ children: [
340+ if (beforeIcon != null ) beforeIcon! ,
341+ if (icon != null ) Icon (icon, color: designVariables.contextMenuItemText),
342+ ]))
329343 : null ,
330344 style: MenuItemButton .styleFrom (
331345 padding: const EdgeInsets .symmetric (vertical: 12 , horizontal: 16 ),
0 commit comments