blockUserActions property

bool blockUserActions
final

Whether to block user interactions for the rendering subtree.

Setting this to true will prevent users from interacting with The rendering object configured by this widget and its subtree through pointer-related SemanticsActions in assistive technologies.

The SemanticsNode created from this widget is still focusable by assistive technologies. Only pointer-related SemanticsActions, such as SemanticsAction.tap or its friends, are blocked.

If this widget is merged into a parent semantics node, only the SemanticsActions of this widget and the widgets in the subtree are blocked.

For example:

void _myTap() { }
void _myLongPress() { }

Widget build(BuildContext context) {
  return Semantics(
    onTap: _myTap,
    child: Semantics(
      blockUserActions: true,
      onLongPress: _myLongPress,
      child: const Text('label'),
    ),
  );
}

The result semantics node will still have _myTap, but the _myLongPress will be blocked.

Implementation

final bool blockUserActions;