buildBitExpansionMenuItems function

List<PopupMenuEntry<String>> buildBitExpansionMenuItems({
  1. required int width,
  2. double fontSize = 13,
  3. double itemHeight = 32,
  4. bool includeDivider = false,
})

Build the standard pair of popup-menu items shown when right-clicking a single multi-bit signal:

  • Expand Bits width
  • Define Bit Fields width...

Callers should typically append these items to their existing PopupMenuEntry<String> list only when the signal selection contains exactly one signal whose width is > 1.

The optional includeDivider inserts a PopupMenuDivider before the items so they visually separate from preceding items.

Implementation

List<PopupMenuEntry<String>> buildBitExpansionMenuItems({
  required int width,
  double fontSize = 13,
  double itemHeight = 32,
  bool includeDivider = false,
}) =>
    <PopupMenuEntry<String>>[
      if (includeDivider) const PopupMenuDivider(height: 8),
      PopupMenuItem<String>(
        height: itemHeight,
        value: BitExpansionMenuValues.expandBits,
        child:
            Text('Expand Bits [$width]', style: TextStyle(fontSize: fontSize)),
      ),
      PopupMenuItem<String>(
        height: itemHeight,
        value: BitExpansionMenuValues.defineFields,
        child: Text(
          'Define Bit Fields [$width]...',
          style: TextStyle(fontSize: fontSize),
        ),
      ),
    ];