pub struct Semantics {
pub key: Option<KeyRef>,
pub child: Option<WidgetRef>,
pub properties: Rc<SemanticsProperties>,
pub container: bool,
pub explicit_child_nodes: bool,
pub locale_for_subtree: Option<Locale>,
pub exclude_semantics: bool,
pub block_user_actions: bool,
}Expand description
A widget that annotates the widget tree with a description of the meaning of the widgets.
Used by assistive technologies, search engines, and other semantic analysis software to determine the meaning of the application.
Its render object, a RenderSemanticsAnnotations, is a proxy box: like any box it takes
a hit only inside its size, so it bounds a child that takes hits outside itself.
Dart’s sealed _SemanticsBase is these fields and get_text_direction; its other leaf,
SliverSemantics, waits on RenderSliverSemanticsAnnotations.
See also:
MergeSemantics, which marks a subtree as being a single node for accessibility purposes.ExcludeSemantics, which excludes a subtree from the accessibility tree.RenderSemanticsAnnotations, the render object that implements this behavior.
Fields§
§key: Option<KeyRef>§child: Option<WidgetRef>§properties: Rc<SemanticsProperties>Contains properties used by assistive technologies to make the application more accessible.
container: boolIf container is true, this widget will introduce a new
node in the semantics tree. Otherwise, the semantics will be
merged with the semantics of any ancestors (if the ancestor allows that).
Whether descendants of this widget can add their semantic information to the
SemanticsNode introduced by this configuration is controlled by
explicit_child_nodes.
explicit_child_nodes: boolWhether descendants of this widget are allowed to add semantic information
to the SemanticsNode annotated by this widget.
When set to false descendants are allowed to annotate SemanticsNodes of
their parent with the semantic information they want to contribute to the
semantic tree.
When set to true the only way for descendants to contribute semantic
information to the semantic tree is to introduce new explicit
SemanticsNodes to the tree.
If the semantics properties of this node include
SemanticsProperties::scopes_route set to true, then
explicit_child_nodes must be true also.
This setting is often used in combination with
SemanticsConfiguration.isSemanticBoundary to create semantic boundaries
that are either writable or not for children.
locale_for_subtree: Option<Locale>The Locale for the semantics subtree.
If null, it inherits the locale from the ancestor semantics node.
exclude_semantics: boolWhether to replace all child semantics with this node.
Defaults to false.
When this flag is set to true, all child semantics nodes are ignored.
This can be used as a convenience for cases where a child is wrapped in
an ExcludeSemantics widget and then another Semantics widget.
block_user_actions: boolWhether 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 from this widget and the widgets in the subtree are
blocked.
Implementations§
Source§impl Semantics
impl Semantics
Sourcepub fn new() -> Semantics
pub fn new() -> Semantics
Creates a semantic annotation.
To create a Semantics widget with a whole SemanticsProperties, use
from_properties. Dart’s named arguments are the setters; the
properties’ own write into properties.
Sourcepub fn from_properties(properties: Rc<SemanticsProperties>) -> Semantics
pub fn from_properties(properties: Rc<SemanticsProperties>) -> Semantics
Creates a semantic annotation using SemanticsProperties.
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> Semantics
pub fn child<K>(self, child: impl IntoWidget<K>) -> Semantics
Dart Semantics(child:).
Sourcepub fn explicit_child_nodes(self, explicit_child_nodes: bool) -> Semantics
pub fn explicit_child_nodes(self, explicit_child_nodes: bool) -> Semantics
Dart Semantics(explicitChildNodes:).
Sourcepub fn exclude_semantics(self, exclude_semantics: bool) -> Semantics
pub fn exclude_semantics(self, exclude_semantics: bool) -> Semantics
Dart Semantics(excludeSemantics:).
Sourcepub fn block_user_actions(self, block_user_actions: bool) -> Semantics
pub fn block_user_actions(self, block_user_actions: bool) -> Semantics
Dart Semantics(blockUserActions:).
Dart Semantics(button:).
Sourcepub fn keyboard_key(self, keyboard_key: bool) -> Semantics
pub fn keyboard_key(self, keyboard_key: bool) -> Semantics
Dart Semantics(keyboardKey:).
Sourcepub fn heading_level(self, heading_level: i32) -> Semantics
pub fn heading_level(self, heading_level: i32) -> Semantics
Dart Semantics(headingLevel:).
Sourcepub fn text_field(self, text_field: bool) -> Semantics
pub fn text_field(self, text_field: bool) -> Semantics
Dart Semantics(textField:).
Sourcepub fn accessibility_focus_block_type(
self,
accessibility_focus_block_type: AccessibilityFocusBlockType,
) -> Semantics
pub fn accessibility_focus_block_type( self, accessibility_focus_block_type: AccessibilityFocusBlockType, ) -> Semantics
Dart Semantics(accessibilityFocusBlockType:).
Sourcepub fn in_mutually_exclusive_group(
self,
in_mutually_exclusive_group: bool,
) -> Semantics
pub fn in_mutually_exclusive_group( self, in_mutually_exclusive_group: bool, ) -> Semantics
Dart Semantics(inMutuallyExclusiveGroup:).
Sourcepub fn scopes_route(self, scopes_route: bool) -> Semantics
pub fn scopes_route(self, scopes_route: bool) -> Semantics
Dart Semantics(scopesRoute:).
Sourcepub fn names_route(self, names_route: bool) -> Semantics
pub fn names_route(self, names_route: bool) -> Semantics
Dart Semantics(namesRoute:).
Dart Semantics(hidden:).
Sourcepub fn live_region(self, live_region: bool) -> Semantics
pub fn live_region(self, live_region: bool) -> Semantics
Dart Semantics(liveRegion:).
Sourcepub fn is_required(self, is_required: bool) -> Semantics
pub fn is_required(self, is_required: bool) -> Semantics
Dart Semantics(isRequired:).
Sourcepub fn max_value_length(self, max_value_length: i32) -> Semantics
pub fn max_value_length(self, max_value_length: i32) -> Semantics
Dart Semantics(maxValueLength:).
Sourcepub fn current_value_length(self, current_value_length: i32) -> Semantics
pub fn current_value_length(self, current_value_length: i32) -> Semantics
Dart Semantics(currentValueLength:).
Sourcepub fn identifier(self, identifier: impl Into<String>) -> Semantics
pub fn identifier(self, identifier: impl Into<String>) -> Semantics
Dart Semantics(identifier:).
Sourcepub fn traversal_parent_identifier(
self,
traversal_parent_identifier: Rc<dyn Any>,
) -> Semantics
pub fn traversal_parent_identifier( self, traversal_parent_identifier: Rc<dyn Any>, ) -> Semantics
Dart Semantics(traversalParentIdentifier:).
Sourcepub fn traversal_child_identifier(
self,
traversal_child_identifier: Rc<dyn Any>,
) -> Semantics
pub fn traversal_child_identifier( self, traversal_child_identifier: Rc<dyn Any>, ) -> Semantics
Dart Semantics(traversalChildIdentifier:).
Sourcepub fn attributed_label(self, attributed_label: AttributedString) -> Semantics
pub fn attributed_label(self, attributed_label: AttributedString) -> Semantics
Dart Semantics(attributedLabel:).
Sourcepub fn attributed_value(self, attributed_value: AttributedString) -> Semantics
pub fn attributed_value(self, attributed_value: AttributedString) -> Semantics
Dart Semantics(attributedValue:).
Sourcepub fn increased_value(self, increased_value: impl Into<String>) -> Semantics
pub fn increased_value(self, increased_value: impl Into<String>) -> Semantics
Dart Semantics(increasedValue:).
Sourcepub fn attributed_increased_value(
self,
attributed_increased_value: AttributedString,
) -> Semantics
pub fn attributed_increased_value( self, attributed_increased_value: AttributedString, ) -> Semantics
Dart Semantics(attributedIncreasedValue:).
Sourcepub fn decreased_value(self, decreased_value: impl Into<String>) -> Semantics
pub fn decreased_value(self, decreased_value: impl Into<String>) -> Semantics
Dart Semantics(decreasedValue:).
Sourcepub fn attributed_decreased_value(
self,
attributed_decreased_value: AttributedString,
) -> Semantics
pub fn attributed_decreased_value( self, attributed_decreased_value: AttributedString, ) -> Semantics
Dart Semantics(attributedDecreasedValue:).
Sourcepub fn attributed_hint(self, attributed_hint: AttributedString) -> Semantics
pub fn attributed_hint(self, attributed_hint: AttributedString) -> Semantics
Dart Semantics(attributedHint:).
Sourcepub fn on_tap_hint(self, on_tap_hint: impl Into<String>) -> Semantics
pub fn on_tap_hint(self, on_tap_hint: impl Into<String>) -> Semantics
Dart Semantics(onTapHint:): with the other hint, the properties’ hintOverrides.
Sourcepub fn on_long_press_hint(
self,
on_long_press_hint: impl Into<String>,
) -> Semantics
pub fn on_long_press_hint( self, on_long_press_hint: impl Into<String>, ) -> Semantics
Dart Semantics(onLongPressHint:): with the other hint, the properties’ hintOverrides.
Sourcepub fn text_direction(self, text_direction: TextDirection) -> Semantics
pub fn text_direction(self, text_direction: TextDirection) -> Semantics
Dart Semantics(textDirection:).
Sourcepub fn sort_key(self, sort_key: SemanticsSortKeyRef) -> Semantics
pub fn sort_key(self, sort_key: SemanticsSortKeyRef) -> Semantics
Dart Semantics(sortKey:).
Sourcepub fn tag_for_children(self, tag_for_children: Rc<SemanticsTag>) -> Semantics
pub fn tag_for_children(self, tag_for_children: Rc<SemanticsTag>) -> Semantics
Dart Semantics(tagForChildren:).
Sourcepub fn on_tap(self, on_tap: VoidCallback) -> Semantics
pub fn on_tap(self, on_tap: VoidCallback) -> Semantics
Dart Semantics(onTap:).
Sourcepub fn on_long_press(self, on_long_press: VoidCallback) -> Semantics
pub fn on_long_press(self, on_long_press: VoidCallback) -> Semantics
Dart Semantics(onLongPress:).
Sourcepub fn on_scroll_left(self, on_scroll_left: VoidCallback) -> Semantics
pub fn on_scroll_left(self, on_scroll_left: VoidCallback) -> Semantics
Dart Semantics(onScrollLeft:).
Sourcepub fn on_scroll_right(self, on_scroll_right: VoidCallback) -> Semantics
pub fn on_scroll_right(self, on_scroll_right: VoidCallback) -> Semantics
Dart Semantics(onScrollRight:).
Sourcepub fn on_scroll_up(self, on_scroll_up: VoidCallback) -> Semantics
pub fn on_scroll_up(self, on_scroll_up: VoidCallback) -> Semantics
Dart Semantics(onScrollUp:).
Sourcepub fn on_scroll_down(self, on_scroll_down: VoidCallback) -> Semantics
pub fn on_scroll_down(self, on_scroll_down: VoidCallback) -> Semantics
Dart Semantics(onScrollDown:).
Sourcepub fn on_increase(self, on_increase: VoidCallback) -> Semantics
pub fn on_increase(self, on_increase: VoidCallback) -> Semantics
Dart Semantics(onIncrease:).
Sourcepub fn on_decrease(self, on_decrease: VoidCallback) -> Semantics
pub fn on_decrease(self, on_decrease: VoidCallback) -> Semantics
Dart Semantics(onDecrease:).
Sourcepub fn on_copy(self, on_copy: VoidCallback) -> Semantics
pub fn on_copy(self, on_copy: VoidCallback) -> Semantics
Dart Semantics(onCopy:).
Sourcepub fn on_cut(self, on_cut: VoidCallback) -> Semantics
pub fn on_cut(self, on_cut: VoidCallback) -> Semantics
Dart Semantics(onCut:).
Sourcepub fn on_paste(self, on_paste: VoidCallback) -> Semantics
pub fn on_paste(self, on_paste: VoidCallback) -> Semantics
Dart Semantics(onPaste:).
Sourcepub fn on_dismiss(self, on_dismiss: VoidCallback) -> Semantics
pub fn on_dismiss(self, on_dismiss: VoidCallback) -> Semantics
Dart Semantics(onDismiss:).
Sourcepub fn on_move_cursor_forward_by_character(
self,
on_move_cursor_forward_by_character: MoveCursorHandler,
) -> Semantics
pub fn on_move_cursor_forward_by_character( self, on_move_cursor_forward_by_character: MoveCursorHandler, ) -> Semantics
Dart Semantics(onMoveCursorForwardByCharacter:).
Sourcepub fn on_move_cursor_backward_by_character(
self,
on_move_cursor_backward_by_character: MoveCursorHandler,
) -> Semantics
pub fn on_move_cursor_backward_by_character( self, on_move_cursor_backward_by_character: MoveCursorHandler, ) -> Semantics
Dart Semantics(onMoveCursorBackwardByCharacter:).
Sourcepub fn on_set_selection(
self,
on_set_selection: SetSelectionHandler,
) -> Semantics
pub fn on_set_selection( self, on_set_selection: SetSelectionHandler, ) -> Semantics
Dart Semantics(onSetSelection:).
Sourcepub fn on_set_text(self, on_set_text: SetTextHandler) -> Semantics
pub fn on_set_text(self, on_set_text: SetTextHandler) -> Semantics
Dart Semantics(onSetText:).
Sourcepub fn on_did_gain_accessibility_focus(
self,
on_did_gain_accessibility_focus: VoidCallback,
) -> Semantics
pub fn on_did_gain_accessibility_focus( self, on_did_gain_accessibility_focus: VoidCallback, ) -> Semantics
Dart Semantics(onDidGainAccessibilityFocus:).
Sourcepub fn on_did_lose_accessibility_focus(
self,
on_did_lose_accessibility_focus: VoidCallback,
) -> Semantics
pub fn on_did_lose_accessibility_focus( self, on_did_lose_accessibility_focus: VoidCallback, ) -> Semantics
Dart Semantics(onDidLoseAccessibilityFocus:).
Sourcepub fn on_focus(self, on_focus: VoidCallback) -> Semantics
pub fn on_focus(self, on_focus: VoidCallback) -> Semantics
Dart Semantics(onFocus:).
Sourcepub fn on_expand(self, on_expand: VoidCallback) -> Semantics
pub fn on_expand(self, on_expand: VoidCallback) -> Semantics
Dart Semantics(onExpand:).
Sourcepub fn on_collapse(self, on_collapse: VoidCallback) -> Semantics
pub fn on_collapse(self, on_collapse: VoidCallback) -> Semantics
Dart Semantics(onCollapse:).
Sourcepub fn custom_semantics_actions(
self,
custom_semantics_actions: IndexMap<CustomSemanticsAction, VoidCallback>,
) -> Semantics
pub fn custom_semantics_actions( self, custom_semantics_actions: IndexMap<CustomSemanticsAction, VoidCallback>, ) -> Semantics
Dart Semantics(customSemanticsActions:).
Sourcepub fn role(self, role: SemanticsRole) -> Semantics
pub fn role(self, role: SemanticsRole) -> Semantics
Dart Semantics(role:).
Sourcepub fn controls_nodes(self, controls_nodes: IndexSet<String>) -> Semantics
pub fn controls_nodes(self, controls_nodes: IndexSet<String>) -> Semantics
Dart Semantics(controlsNodes:).
Sourcepub fn validation_result(
self,
validation_result: SemanticsValidationResult,
) -> Semantics
pub fn validation_result( self, validation_result: SemanticsValidationResult, ) -> Semantics
Dart Semantics(validationResult:).
Sourcepub fn hit_test_behavior(
self,
hit_test_behavior: SemanticsHitTestBehavior,
) -> Semantics
pub fn hit_test_behavior( self, hit_test_behavior: SemanticsHitTestBehavior, ) -> Semantics
Dart Semantics(hitTestBehavior:).
Sourcepub fn input_type(self, input_type: SemanticsInputType) -> Semantics
pub fn input_type(self, input_type: SemanticsInputType) -> Semantics
Dart Semantics(inputType:).
Sourcepub fn locale_for_subtree(self, locale_for_subtree: Locale) -> Semantics
pub fn locale_for_subtree(self, locale_for_subtree: Locale) -> Semantics
Dart Semantics(localeForSubtree:).
Trait Implementations§
Source§impl RenderObjectWidget for Semantics
impl RenderObjectWidget for Semantics
Source§type RenderObject = RenderSemanticsAnnotations
type RenderObject = RenderSemanticsAnnotations
covariant RenderObject parameter type.Source§fn create_render_object(
&self,
app: &mut App,
context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn update_render_object(
&self,
app: &mut App,
context: BuildContext,
render_object: RenderHandle<RenderSemanticsAnnotations>,
)
fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<RenderSemanticsAnnotations>, )
create_render_object. Read moreSource§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn debug_visit_onstage_children(
&self,
app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
debugVisitOnstageChildren of the element this widget makes, for a widget whose
Dart element subclass overrides it only to hide children (_OffstageElement,
_IndexedStackElement): calls visitor for each of children, in order, that is
onstage. Waft’s generic single- and multi-child elements stand in for those subclasses
and ask their widget here; an element of a widget’s own overrides
Element::debug_visit_onstage_children instead.Source§fn did_unmount_render_object(
&self,
app: &mut App,
render_object: RenderHandle<Self::RenderObject>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
RenderObject will be of the same type as returned by this object’s
create_render_object.Auto Trait Implementations§
impl !RefUnwindSafe for Semantics
impl !Send for Semantics
impl !Sync for Semantics
impl !UnwindSafe for Semantics
impl Forget for Semantics
impl Freeze for Semanticswhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<SemanticsProperties> is !null: Freeze,
PhantomData<RcInner<SemanticsProperties>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for Semantics
impl Unpin for Semantics
impl UnsafeUnpin for Semanticswhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<SemanticsProperties> is !null: UnsafeUnpin,
PhantomData<RcInner<SemanticsProperties>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.