buildSemantics method
- required Widget child,
Builds the semantic wrapper for the popup menu item.
This method creates the Semantics widget that provides accessibility information for the menu item. By default, it sets the semantic role to SemanticsRole.menuItem and includes the enabled state and button flag.
Subclasses can override this method to customize the semantic properties. For example, CheckedPopupMenuItem overrides this to use SemanticsRole.menuItemCheckbox and include checked state information.
Implementation
@protected
Widget buildSemantics({required Widget child}) {
return Semantics(
role: SemanticsRole.menuItem,
enabled: widget.enabled,
button: true,
child: child,
);
}