Skip to main content

Semantics

Struct Semantics 

Source
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:

Fields§

§key: Option<KeyRef>§child: Option<WidgetRef>§properties: Rc<SemanticsProperties>

Contains properties used by assistive technologies to make the application more accessible.

§container: bool

If 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: bool

Whether 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: bool

Whether 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: bool

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 from this widget and the widgets in the subtree are blocked.

Implementations§

Source§

impl Semantics

Source

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.

Source

pub fn from_properties(properties: Rc<SemanticsProperties>) -> Semantics

Creates a semantic annotation using SemanticsProperties.

Source

pub fn key(self, key: KeyRef) -> Semantics

Dart Semantics(key:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> Semantics

Dart Semantics(child:).

Source

pub fn container(self, container: bool) -> Semantics

Dart Semantics(container:).

Source

pub fn explicit_child_nodes(self, explicit_child_nodes: bool) -> Semantics

Dart Semantics(explicitChildNodes:).

Source

pub fn exclude_semantics(self, exclude_semantics: bool) -> Semantics

Dart Semantics(excludeSemantics:).

Source

pub fn block_user_actions(self, block_user_actions: bool) -> Semantics

Dart Semantics(blockUserActions:).

Source

pub fn enabled(self, enabled: bool) -> Semantics

Dart Semantics(enabled:).

Source

pub fn checked(self, checked: bool) -> Semantics

Dart Semantics(checked:).

Source

pub fn mixed(self, mixed: bool) -> Semantics

Dart Semantics(mixed:).

Source

pub fn selected(self, selected: bool) -> Semantics

Dart Semantics(selected:).

Source

pub fn toggled(self, toggled: bool) -> Semantics

Dart Semantics(toggled:).

Source

pub fn button(self, button: bool) -> Semantics

Dart Semantics(button:).

Source

pub fn slider(self, slider: bool) -> Semantics

Dart Semantics(slider:).

Source

pub fn keyboard_key(self, keyboard_key: bool) -> Semantics

Dart Semantics(keyboardKey:).

Dart Semantics(link:).

Dart Semantics(linkUrl:).

Source

pub fn header(self, header: bool) -> Semantics

Dart Semantics(header:).

Source

pub fn heading_level(self, heading_level: i32) -> Semantics

Dart Semantics(headingLevel:).

Source

pub fn text_field(self, text_field: bool) -> Semantics

Dart Semantics(textField:).

Source

pub fn read_only(self, read_only: bool) -> Semantics

Dart Semantics(readOnly:).

Source

pub fn focusable(self, focusable: bool) -> Semantics

Dart Semantics(focusable:).

Source

pub fn focused(self, focused: bool) -> Semantics

Dart Semantics(focused:).

Source

pub fn accessibility_focus_block_type( self, accessibility_focus_block_type: AccessibilityFocusBlockType, ) -> Semantics

Dart Semantics(accessibilityFocusBlockType:).

Source

pub fn in_mutually_exclusive_group( self, in_mutually_exclusive_group: bool, ) -> Semantics

Dart Semantics(inMutuallyExclusiveGroup:).

Source

pub fn obscured(self, obscured: bool) -> Semantics

Dart Semantics(obscured:).

Source

pub fn multiline(self, multiline: bool) -> Semantics

Dart Semantics(multiline:).

Source

pub fn scopes_route(self, scopes_route: bool) -> Semantics

Dart Semantics(scopesRoute:).

Source

pub fn names_route(self, names_route: bool) -> Semantics

Dart Semantics(namesRoute:).

Source

pub fn hidden(self, hidden: bool) -> Semantics

Dart Semantics(hidden:).

Source

pub fn image(self, image: bool) -> Semantics

Dart Semantics(image:).

Source

pub fn live_region(self, live_region: bool) -> Semantics

Dart Semantics(liveRegion:).

Source

pub fn expanded(self, expanded: bool) -> Semantics

Dart Semantics(expanded:).

Source

pub fn is_required(self, is_required: bool) -> Semantics

Dart Semantics(isRequired:).

Source

pub fn max_value_length(self, max_value_length: i32) -> Semantics

Dart Semantics(maxValueLength:).

Source

pub fn current_value_length(self, current_value_length: i32) -> Semantics

Dart Semantics(currentValueLength:).

Source

pub fn identifier(self, identifier: impl Into<String>) -> Semantics

Dart Semantics(identifier:).

Source

pub fn traversal_parent_identifier( self, traversal_parent_identifier: Rc<dyn Any>, ) -> Semantics

Dart Semantics(traversalParentIdentifier:).

Source

pub fn traversal_child_identifier( self, traversal_child_identifier: Rc<dyn Any>, ) -> Semantics

Dart Semantics(traversalChildIdentifier:).

Source

pub fn label(self, label: impl Into<String>) -> Semantics

Dart Semantics(label:).

Source

pub fn attributed_label(self, attributed_label: AttributedString) -> Semantics

Dart Semantics(attributedLabel:).

Source

pub fn value(self, value: impl Into<String>) -> Semantics

Dart Semantics(value:).

Source

pub fn attributed_value(self, attributed_value: AttributedString) -> Semantics

Dart Semantics(attributedValue:).

Source

pub fn increased_value(self, increased_value: impl Into<String>) -> Semantics

Dart Semantics(increasedValue:).

Source

pub fn attributed_increased_value( self, attributed_increased_value: AttributedString, ) -> Semantics

Dart Semantics(attributedIncreasedValue:).

Source

pub fn decreased_value(self, decreased_value: impl Into<String>) -> Semantics

Dart Semantics(decreasedValue:).

Source

pub fn attributed_decreased_value( self, attributed_decreased_value: AttributedString, ) -> Semantics

Dart Semantics(attributedDecreasedValue:).

Source

pub fn hint(self, hint: impl Into<String>) -> Semantics

Dart Semantics(hint:).

Source

pub fn attributed_hint(self, attributed_hint: AttributedString) -> Semantics

Dart Semantics(attributedHint:).

Source

pub fn tooltip(self, tooltip: impl Into<String>) -> Semantics

Dart Semantics(tooltip:).

Source

pub fn on_tap_hint(self, on_tap_hint: impl Into<String>) -> Semantics

Dart Semantics(onTapHint:): with the other hint, the properties’ hintOverrides.

Source

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.

Source

pub fn text_direction(self, text_direction: TextDirection) -> Semantics

Dart Semantics(textDirection:).

Source

pub fn sort_key(self, sort_key: SemanticsSortKeyRef) -> Semantics

Dart Semantics(sortKey:).

Source

pub fn tag_for_children(self, tag_for_children: Rc<SemanticsTag>) -> Semantics

Dart Semantics(tagForChildren:).

Source

pub fn on_tap(self, on_tap: VoidCallback) -> Semantics

Dart Semantics(onTap:).

Source

pub fn on_long_press(self, on_long_press: VoidCallback) -> Semantics

Dart Semantics(onLongPress:).

Source

pub fn on_scroll_left(self, on_scroll_left: VoidCallback) -> Semantics

Dart Semantics(onScrollLeft:).

Source

pub fn on_scroll_right(self, on_scroll_right: VoidCallback) -> Semantics

Dart Semantics(onScrollRight:).

Source

pub fn on_scroll_up(self, on_scroll_up: VoidCallback) -> Semantics

Dart Semantics(onScrollUp:).

Source

pub fn on_scroll_down(self, on_scroll_down: VoidCallback) -> Semantics

Dart Semantics(onScrollDown:).

Source

pub fn on_increase(self, on_increase: VoidCallback) -> Semantics

Dart Semantics(onIncrease:).

Source

pub fn on_decrease(self, on_decrease: VoidCallback) -> Semantics

Dart Semantics(onDecrease:).

Source

pub fn on_copy(self, on_copy: VoidCallback) -> Semantics

Dart Semantics(onCopy:).

Source

pub fn on_cut(self, on_cut: VoidCallback) -> Semantics

Dart Semantics(onCut:).

Source

pub fn on_paste(self, on_paste: VoidCallback) -> Semantics

Dart Semantics(onPaste:).

Source

pub fn on_dismiss(self, on_dismiss: VoidCallback) -> Semantics

Dart Semantics(onDismiss:).

Source

pub fn on_move_cursor_forward_by_character( self, on_move_cursor_forward_by_character: MoveCursorHandler, ) -> Semantics

Dart Semantics(onMoveCursorForwardByCharacter:).

Source

pub fn on_move_cursor_backward_by_character( self, on_move_cursor_backward_by_character: MoveCursorHandler, ) -> Semantics

Dart Semantics(onMoveCursorBackwardByCharacter:).

Source

pub fn on_set_selection( self, on_set_selection: SetSelectionHandler, ) -> Semantics

Dart Semantics(onSetSelection:).

Source

pub fn on_set_text(self, on_set_text: SetTextHandler) -> Semantics

Dart Semantics(onSetText:).

Source

pub fn on_did_gain_accessibility_focus( self, on_did_gain_accessibility_focus: VoidCallback, ) -> Semantics

Dart Semantics(onDidGainAccessibilityFocus:).

Source

pub fn on_did_lose_accessibility_focus( self, on_did_lose_accessibility_focus: VoidCallback, ) -> Semantics

Dart Semantics(onDidLoseAccessibilityFocus:).

Source

pub fn on_focus(self, on_focus: VoidCallback) -> Semantics

Dart Semantics(onFocus:).

Source

pub fn on_expand(self, on_expand: VoidCallback) -> Semantics

Dart Semantics(onExpand:).

Source

pub fn on_collapse(self, on_collapse: VoidCallback) -> Semantics

Dart Semantics(onCollapse:).

Source

pub fn custom_semantics_actions( self, custom_semantics_actions: IndexMap<CustomSemanticsAction, VoidCallback>, ) -> Semantics

Dart Semantics(customSemanticsActions:).

Source

pub fn role(self, role: SemanticsRole) -> Semantics

Dart Semantics(role:).

Source

pub fn controls_nodes(self, controls_nodes: IndexSet<String>) -> Semantics

Dart Semantics(controlsNodes:).

Source

pub fn validation_result( self, validation_result: SemanticsValidationResult, ) -> Semantics

Dart Semantics(validationResult:).

Source

pub fn hit_test_behavior( self, hit_test_behavior: SemanticsHitTestBehavior, ) -> Semantics

Dart Semantics(hitTestBehavior:).

Source

pub fn input_type(self, input_type: SemanticsInputType) -> Semantics

Dart Semantics(inputType:).

Source

pub fn locale_for_subtree(self, locale_for_subtree: Locale) -> Semantics

Dart Semantics(localeForSubtree:).

Source

pub fn min_value(self, min_value: impl Into<String>) -> Semantics

Dart Semantics(minValue:).

Source

pub fn max_value(self, max_value: impl Into<String>) -> Semantics

Dart Semantics(maxValue:).

Trait Implementations§

Source§

impl Debug for Semantics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Semantics

Source§

fn default() -> Semantics

Returns the “default value” for a type. Read more
Source§

impl RenderObjectWidget for Semantics

Source§

type RenderObject = RenderSemanticsAnnotations

The render object this widget creates; Dart’s covariant RenderObject parameter type.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject

Creates an instance of the RenderObject class that this widget represents, using the configuration described by this widget. Read more
Source§

fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<RenderSemanticsAnnotations>, )

Copies the configuration described by this widget to the given render object, which will be of the same type as returned by this object’s create_render_object. Read more
Source§

fn debug_check_constructor(&self)

Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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

Dart’s 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), )

Dart’s 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>, )

A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object’s create_render_object.
Source§

impl SingleChildRenderObjectWidget for Semantics

Source§

fn child(&self) -> Option<&WidgetRef>

The widget below this widget in the tree.
Source§

fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
where Self: Sized,

Creates the element that manages this widget’s child. Read more

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 Semantics
where *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
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, Rc<SemanticsProperties>: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Semantics
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<SingleChildRenderObjectKind> for W

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>