MenuItemComponent class

A stateless widget rendering a single menu item with optional icon and text label.

Displays a tappable menu row with an optional leading icon and text label. Used as a building block for menu lists in MenuModal and custom menu implementations.

Rendering Structure:

InkWell (onTap: onPress)
  └─ Container (padding: 10px vertical)
     └─ Row
        ├─ Icon (if icon != null, 20px, white)
        ├─ SizedBox(width: 10) (if icon != null)
        └─ Text (name, 16px, white)

Common Use Cases:

  1. Menu with Icon:

    MenuItemComponent(
      options: MenuItemOptions(
        icon: Icons.settings,
        name: "Settings",
        onPress: () {
          Navigator.push(context, MaterialPageRoute(
            builder: (_) => SettingsScreen(),
          ));
        },
      ),
    )
    
  2. Menu without Icon:

    MenuItemComponent(
      options: MenuItemOptions(
        name: "About",
        onPress: () => showAboutDialog(context),
      ),
    )
    
  3. Menu List:

    Column(
      children: [
        MenuItemComponent(
          options: MenuItemOptions(
            icon: Icons.videocam,
            name: "Video Settings",
            onPress: () => openVideoSettings(),
          ),
        ),
        MenuItemComponent(
          options: MenuItemOptions(
            icon: Icons.mic,
            name: "Audio Settings",
            onPress: () => openAudioSettings(),
          ),
        ),
        MenuItemComponent(
          options: MenuItemOptions(
            icon: Icons.share,
            name: "Share Event",
            onPress: () => shareEvent(),
          ),
        ),
      ],
    )
    

Styling:

  • Icon: 20px, white color
  • Text: 16px, white color, regular weight
  • Padding: 10px vertical (symmetric)
  • Icon-to-text spacing: 10px (if icon present)

Interaction:

  • Uses InkWell for material ripple effect on tap
  • onPress callback invoked immediately on tap
  • No built-in loading state or disabled state

Typical Usage Context:

  • Menu items in MenuModal
  • Custom dropdown menus
  • Settings lists
  • Action sheets
Inheritance

Constructors

const

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
options MenuItemOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited