buildGotoSourceMenuItems function

List<PopupMenuItem<String>> buildGotoSourceMenuItems({
  1. required List<RohdSourceFormat> formats,
  2. int count = 1,
  3. double height = 32,
  4. TextStyle? textStyle,
  5. bool showIcons = true,
  6. SourceFormatIconBuilder iconBuilder = sourceFormatMenuIcon,
})

Build Go to <format> Source popup-menu items for formats.

Each item carries a value encoded by gotoSourceMenuValue; decode the chosen value with gotoSourceFormatFromValue in the menu's result handler.

Implementation

List<PopupMenuItem<String>> buildGotoSourceMenuItems({
  required List<RohdSourceFormat> formats,
  int count = 1,
  double height = 32,
  TextStyle? textStyle,
  bool showIcons = true,
  SourceFormatIconBuilder iconBuilder = sourceFormatMenuIcon,
}) =>
    [
      for (final format in formats)
        buildRohdPopupMenuItem<String>(
          value: gotoSourceMenuValue(format),
          height: height,
          icon: showIcons ? iconBuilder(format) : const SizedBox.shrink(),
          label: gotoSourceMenuLabel(format, count: count),
          textStyle: textStyle,
        ),
    ];