Skip to main content

SemanticsProperties

Struct SemanticsProperties 

Source
pub struct SemanticsProperties {
Show 78 fields pub enabled: Option<bool>, pub checked: Option<bool>, pub mixed: Option<bool>, pub expanded: Option<bool>, pub toggled: Option<bool>, pub selected: Option<bool>, pub button: Option<bool>, pub link: Option<bool>, pub header: Option<bool>, pub text_field: Option<bool>, pub slider: Option<bool>, pub keyboard_key: Option<bool>, pub read_only: Option<bool>, pub focusable: Option<bool>, pub focused: Option<bool>, pub accessibility_focus_block_type: Option<AccessibilityFocusBlockType>, pub in_mutually_exclusive_group: Option<bool>, pub hidden: Option<bool>, pub obscured: Option<bool>, pub multiline: Option<bool>, pub scopes_route: Option<bool>, pub names_route: Option<bool>, pub image: Option<bool>, pub live_region: Option<bool>, pub is_required: Option<bool>, pub max_value_length: Option<i32>, pub current_value_length: Option<i32>, pub identifier: Option<String>, pub traversal_parent_identifier: Option<Rc<dyn Any>>, pub traversal_child_identifier: Option<Rc<dyn Any>>, pub label: Option<String>, pub attributed_label: Option<AttributedString>, pub value: Option<String>, pub attributed_value: Option<AttributedString>, pub increased_value: Option<String>, pub attributed_increased_value: Option<AttributedString>, pub decreased_value: Option<String>, pub attributed_decreased_value: Option<AttributedString>, pub hint: Option<String>, pub attributed_hint: Option<AttributedString>, pub tooltip: Option<String>, pub heading_level: Option<i32>, pub hint_overrides: Option<SemanticsHintOverrides>, pub text_direction: Option<TextDirection>, pub sort_key: Option<SemanticsSortKeyRef>, pub tag_for_children: Option<Rc<SemanticsTag>>, pub link_url: Option<String>, pub on_tap: Option<VoidCallback>, pub on_long_press: Option<VoidCallback>, pub on_scroll_left: Option<VoidCallback>, pub on_scroll_right: Option<VoidCallback>, pub on_scroll_up: Option<VoidCallback>, pub on_scroll_down: Option<VoidCallback>, pub on_increase: Option<VoidCallback>, pub on_decrease: Option<VoidCallback>, pub on_copy: Option<VoidCallback>, pub on_cut: Option<VoidCallback>, pub on_paste: Option<VoidCallback>, pub on_move_cursor_forward_by_character: Option<MoveCursorHandler>, pub on_move_cursor_backward_by_character: Option<MoveCursorHandler>, pub on_move_cursor_forward_by_word: Option<MoveCursorHandler>, pub on_move_cursor_backward_by_word: Option<MoveCursorHandler>, pub on_set_selection: Option<SetSelectionHandler>, pub on_set_text: Option<SetTextHandler>, pub on_did_gain_accessibility_focus: Option<VoidCallback>, pub on_did_lose_accessibility_focus: Option<VoidCallback>, pub on_focus: Option<VoidCallback>, pub on_dismiss: Option<VoidCallback>, pub on_expand: Option<VoidCallback>, pub on_collapse: Option<VoidCallback>, pub custom_semantics_actions: Option<IndexMap<CustomSemanticsAction, VoidCallback>>, pub role: Option<SemanticsRole>, pub controls_nodes: Option<IndexSet<String>>, pub validation_result: SemanticsValidationResult, pub hit_test_behavior: Option<SemanticsHitTestBehavior>, pub input_type: Option<SemanticsInputType>, pub max_value: Option<String>, pub min_value: Option<String>,
}
Expand description

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

The properties of this class are used to generate a SemanticsNodes in the semantics tree.

Dart’s class does not override ==: a render object compares two by identity, so they are held as Rc<SemanticsProperties> and compared with Rc::ptr_eq.

Fields§

§enabled: Option<bool>

If non-null, indicates that this subtree represents something that can be in an enabled or disabled state.

For example, a button that a user can currently interact with would set this field to true. A button that currently does not respond to user interactions would set this field to false.

§checked: Option<bool>

If non-null, indicates that this subtree represents a checkbox or similar widget with a “checked” state, and what its current state is.

When the Checkbox.value of a tristate Checkbox is null, indicating a mixed-state, this value shall be false, in which case, mixed will be true.

This is mutually exclusive with toggled and mixed.

§mixed: Option<bool>

If non-null, indicates that this subtree represents a checkbox or similar widget with a “half-checked” state or similar, and whether it is currently in this half-checked state.

This must be null when Checkbox.tristate is false, or when the widget is not a checkbox. When a tristate checkbox is fully unchecked/checked, this value shall be false.

This is mutually exclusive with checked and toggled.

§expanded: Option<bool>

If non-null, indicates that this subtree represents something that can be in an “expanded” or “collapsed” state.

For example, if a SubmenuButton is opened, this property should be set to true; otherwise, this property should be false.

§toggled: Option<bool>

If non-null, indicates that this subtree represents a toggle switch or similar widget with an “on” state, and what its current state is.

This is mutually exclusive with checked and mixed.

§selected: Option<bool>

If non-null indicates that this subtree represents something that can be in a selected or unselected state, and what its current state is.

The active tab in a tab bar for example is considered “selected”, whereas all other tabs are unselected.

§button: Option<bool>

If non-null, indicates that this subtree represents a button.

TalkBack/VoiceOver provides users with the hint “button” when a button is focused.

§link: Option<bool>

If non-null, indicates that this subtree represents a link.

iOS’s VoiceOver provides users with a unique hint when a link is focused. Android’s Talkback will announce a link hint the same way it does a button.

§header: Option<bool>

If non-null, indicates that this subtree represents a header.

A header is typically the top element of a page or section, such as a page title or app bar title.

§text_field: Option<bool>

If non-null, indicates that this subtree represents a text field.

TalkBack/VoiceOver provide special affordances to enter text into a text field.

§slider: Option<bool>

If non-null, indicates that this subtree represents a slider.

Talkback/\VoiceOver provides users with the hint “slider” when a slider is focused.

§keyboard_key: Option<bool>

If non-null, indicates that this subtree represents a keyboard key.

§read_only: Option<bool>

If non-null, indicates that this subtree is read only.

Only applicable when textField is true.

TalkBack/VoiceOver will treat it as non-editable text field.

§focusable: Option<bool>

If non-null, whether the node is able to hold input focus.

If focusable is set to false, then focused must not be true.

Input focus indicates that the node will receive keyboard events. It is not to be confused with accessibility focus. Accessibility focus is the green/black rectangular highlight that TalkBack/VoiceOver draws around the element it is reading, and is separate from input focus.

Deprecated: use focused instead; setting focused automatically sets focusable.

§focused: Option<bool>

If non-null, whether the node currently holds input focus.

If null, the node is not focusable.

At most one node in the tree should hold input focus at any point in time, and it should not be set to true if focusable is false.

Input focus indicates that the node will receive keyboard events. It is not to be confused with accessibility focus. Accessibility focus is the green/black rectangular highlight that TalkBack/VoiceOver draws around the element it is reading, and is separate from input focus.

§accessibility_focus_block_type: Option<AccessibilityFocusBlockType>

If non-null, indicates if this subtree or current node is blocked in a11y focus.

This is for accessibility focus, which is the focus used by screen readers like TalkBack and VoiceOver. It is different from input focus, which is usually held by the element that currently responds to keyboard inputs.

§in_mutually_exclusive_group: Option<bool>

If non-null, whether a semantic node is in a mutually exclusive group.

For example, a radio button is in a mutually exclusive group because only one radio button in that group can be marked as checked.

§hidden: Option<bool>

If non-null, whether the node is considered hidden.

Hidden elements are currently not visible on screen. They may be covered by other elements or positioned outside of the visible area of a viewport.

Hidden elements cannot gain accessibility focus though regular touch. The only way they can be focused is by moving the focus to them via linear navigation.

Platforms are free to completely ignore hidden elements and new platforms are encouraged to do so.

Instead of marking an element as hidden it should usually be excluded from the semantics tree altogether. Hidden elements are only included in the semantics tree to work around platform limitations and they are mainly used to implement accessibility scrolling on iOS.

§obscured: Option<bool>

If non-null, whether value should be obscured.

This option is usually set in combination with textField to indicate that the text field contains a password (or other sensitive information). Doing so instructs screen readers to not read out the value.

§multiline: Option<bool>

Whether the value is coming from a field that supports multiline text editing.

This option is only meaningful when textField is true to indicate whether it’s a single-line or multiline text field.

This option is null when textField is false.

§scopes_route: Option<bool>

If non-null, whether the node corresponds to the root of a subtree for which a route name should be announced.

Generally, this is set in combination with SemanticsConfiguration.explicitChildNodes, since nodes with this flag are not considered focusable by Android or iOS.

§names_route: Option<bool>

If non-null, whether the node contains the semantic label for a route.

§image: Option<bool>

If non-null, whether the node represents an image.

§live_region: Option<bool>

If non-null, whether the node should be considered a live region.

A live region indicates that updates to semantics node are important. Platforms may use this information to make polite announcements to the user to inform them of updates to this node.

An example of a live region is a SnackBar widget. On Android and iOS, live region causes a polite announcement to be generated automatically, even if the widget does not have accessibility focus. This announcement may not be spoken if the OS accessibility services are already announcing something else, such as reading the label of a focused widget or providing a system announcement.

§is_required: Option<bool>

If non-null, whether the node should be considered required.

If true, user input is required on the semantics node before a form can be submitted. If false, the node is optional before a form can be submitted. If null, the node does not have a required semantics.

For example, a login form requires its email text field to be non-empty.

On web, this will set a aria-required attribute on the DOM element that corresponds to the semantics node.

§max_value_length: Option<i32>

The maximum number of characters that can be entered into an editable text field.

For the purpose of this function a character is defined as one Unicode scalar value.

This should only be set when textField is true. Defaults to null, which means no limit is imposed on the text field.

§current_value_length: Option<i32>

The current number of characters that have been entered into an editable text field.

For the purpose of this function a character is defined as one Unicode scalar value.

This should only be set when textField is true. Must be set when maxValueLength is set.

§identifier: Option<String>

Provides an identifier for the semantics node in native accessibility hierarchy.

This value is not exposed to the users of the app.

It’s usually used for UI testing with tools that work by querying the native accessibility, like UIAutomator, XCUITest, or Appium. It can be matched with CommonFinders.bySemanticsIdentifier.

When set, this property implicitly forces the creation of a new SemanticsNode (equivalent to setting container to true in Semantics). This ensures the identifier is always attached to its own node and is not merged into an ancestor.

On Android, this is used for AccessibilityNodeInfo.setViewIdResourceName. It’ll be appear in accessibility hierarchy as resource-id.

On iOS, this will set UIAccessibilityElement.accessibilityIdentifier.

On web, this will set a flt-semantics-identifier attribute on the DOM element that corresponds to the semantics node.

§traversal_parent_identifier: Option<Rc<dyn Any>>

Provides an identifier for establishing parent-child relationships in the semantics traversal tree.

This property is used to create a logical parent-child relationship between semantics nodes that may not be directly connected in the widget tree. It’s primarily used with OverlayPortal to ensure proper accessibility traversal order when overlay content needs to be semantically connected to its parent widget.

When a semantics node has a traversalParentIdentifier, it indicates that this node can act as a parent for other nodes that reference this identifier in their traversalChildIdentifier. This allows assistive technologies to navigate the UI in the correct logical order.

The traversalParentIdentifier must be unique in the semantics. No two semantics node can have the same traversalParentIdentifier. This unique identifier serves as the only reference for its traversal children. To graft other nodes as the traversal children of this node, assign this same value to their traversalChildIdentifier.

§traversal_child_identifier: Option<Rc<dyn Any>>

Provides an identifier for establishing parent-child relationships in the semantics traversal tree.

This property is used to create a logical parent-child relationship between semantics nodes that may not be directly connected in the widget tree. It’s primarily used with OverlayPortal to ensure proper accessibility traversal order when overlay content needs to be semantically connected to its parent widget.

When a semantics node has a traversalChildIdentifier, it indicates that this node should be treated as a child of another node that has this same identifier as its traversalParentIdentifier. This allows assistive technologies to navigate the UI in the correct logical order.

The traversalChildIdentifier value may be duplicated across multiple semantics nodes. To establish one or more nodes as the traversal children of a parent node, assign this identifier the same value as the parent’s traversalParentIdentifier.

§label: Option<String>

Provides a textual description of the widget.

If a label is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both label and attributedLabel. One or both must be null.

§attributed_label: Option<AttributedString>

Provides an AttributedString version of textual description of the widget.

If a attributedLabel is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both label and attributedLabel. One or both must be null.

§value: Option<String>

Provides a textual description of the value of the widget.

If a value is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both value and attributedValue, One or both must be null.

§attributed_value: Option<AttributedString>

Provides an AttributedString version of textual description of the value of the widget.

If a attributedValue is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both value and attributedValue, One or both must be null.

§increased_value: Option<String>

The value that value or attributedValue will become after a SemanticsAction.increase action has been performed on this widget.

If a value is provided, onIncrease must also be set and there must either be an ambient Directionality or an explicit textDirection must be provided.

Callers must not provide both increasedValue and attributedIncreasedValue, One or both must be null.

§attributed_increased_value: Option<AttributedString>

The AttributedString that value or attributedValue will become after a SemanticsAction.increase action has been performed on this widget.

If a attributedIncreasedValue is provided, onIncrease must also be set and there must either be an ambient Directionality or an explicit textDirection must be provided.

Callers must not provide both increasedValue and attributedIncreasedValue, One or both must be null.

§decreased_value: Option<String>

The value that value or attributedValue will become after a SemanticsAction.decrease action has been performed on this widget.

If a value is provided, onDecrease must also be set and there must either be an ambient Directionality or an explicit textDirection must be provided.

Callers must not provide both decreasedValue and attributedDecreasedValue, One or both must be null.

§attributed_decreased_value: Option<AttributedString>

The AttributedString that value or attributedValue will become after a SemanticsAction.decrease action has been performed on this widget.

If a attributedDecreasedValue is provided, onDecrease must also be set and there must either be an ambient Directionality or an explicit textDirection must be provided.

Callers must not provide both decreasedValue and attributedDecreasedValue, One or both must be null/// provided.

§hint: Option<String>

Provides a brief textual description of the result of an action performed on the widget.

If a hint is provided, there must either be an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both hint and attributedHint, One or both must be null.

§attributed_hint: Option<AttributedString>

Provides an AttributedString version of brief textual description of the result of an action performed on the widget.

If a attributedHint is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

Callers must not provide both hint and attributedHint, One or both must be null.

§tooltip: Option<String>

Provides a textual description of the widget’s tooltip.

In Android, this property sets the AccessibilityNodeInfo.setTooltipText. In iOS, this property is appended to the end of the UIAccessibilityElement.accessibilityLabel.

If a tooltip is provided, there must either by an ambient Directionality or an explicit textDirection should be provided.

§heading_level: Option<i32>

The heading level in the document structure.

A heading divides content into sections. For example, an address book application might define headings A, B, C, etc. to divide the list of alphabetically sorted contacts into sections.

Screen readers use this value to determine which part of the page structure this heading represents. A level 1 heading usually indicates the main heading of a page, a level 2 heading the first subsection, a level 3 is a subsection of that, and so on.

On web, this sets the aria-level attribute (e.g., aria-level="1"). On Android, this sets the isHeading property for accessibility.

§hint_overrides: Option<SemanticsHintOverrides>

Overrides the default accessibility hints provided by the platform.

This hintOverrides property does not affect how the platform processes hints; it only sets the custom text that will be read by assistive technology.

On Android, these overrides replace the default hints for semantics nodes with tap or long-press actions. For example, if SemanticsHintOverrides.onTapHint is provided, instead of saying Double tap to activate, the screen reader will say Double tap to <onTapHint>.

On iOS, this property is ignored, and default platform behavior applies.

Example usage:

§text_direction: Option<TextDirection>

The reading direction of the label, value, increasedValue, decreasedValue, and hint.

Defaults to the ambient Directionality.

§sort_key: Option<SemanticsSortKeyRef>

Determines the position of this node among its siblings in the traversal sort order.

This is used to describe the order in which the semantic node should be traversed by the accessibility services on the platform (e.g. VoiceOver on iOS and TalkBack on Android).

§tag_for_children: Option<Rc<SemanticsTag>>

A tag to be applied to the child SemanticsNodes of this widget.

The tag is added to all child SemanticsNodes that pass through the RenderObject corresponding to this widget while looking to be attached to a parent SemanticsNode.

Tags are used to communicate to a parent SemanticsNode that a child SemanticsNode was passed through a particular RenderObject. The parent can use this information to determine the shape of the semantics tree.

§link_url: Option<String>

The URL that this node links to.

On the web, this is used to set the href attribute of the DOM element.

§on_tap: Option<VoidCallback>

The handler for SemanticsAction.tap.

This is the semantic equivalent of a user briefly tapping the screen with the finger without moving it. For example, a button should implement this action.

VoiceOver users on iOS and TalkBack users on Android may trigger this action by double-tapping the screen while an element is focused.

Note: different OSes or assistive technologies may decide to interpret user inputs differently. Some may simulate real screen taps, while others may call semantics tap. One way to handle taps properly is to provide the same handler to both gesture tap and semantics tap.

§on_long_press: Option<VoidCallback>

The handler for SemanticsAction.longPress.

This is the semantic equivalent of a user pressing and holding the screen with the finger for a few seconds without moving it.

VoiceOver users on iOS and TalkBack users on Android may trigger this action by double-tapping the screen without lifting the finger after the second tap.

Note: different OSes or assistive technologies may decide to interpret user inputs differently. Some may simulate real long presses, while others may call semantics long press. One way to handle long press properly is to provide the same handler to both gesture long press and semantics long press.

§on_scroll_left: Option<VoidCallback>

The handler for SemanticsAction.scrollLeft.

This is the semantic equivalent of a user moving their finger across the screen from right to left. It should be recognized by controls that are horizontally scrollable.

VoiceOver users on iOS can trigger this action by swiping left with three fingers. TalkBack users on Android can trigger this action by swiping right and then left in one motion path. On Android, onScrollUp and onScrollLeft share the same gesture. Therefore, only on of them should be provided.

§on_scroll_right: Option<VoidCallback>

The handler for SemanticsAction.scrollRight.

This is the semantic equivalent of a user moving their finger across the screen from left to right. It should be recognized by controls that are horizontally scrollable.

VoiceOver users on iOS can trigger this action by swiping right with three fingers. TalkBack users on Android can trigger this action by swiping left and then right in one motion path. On Android, onScrollDown and onScrollRight share the same gesture. Therefore, only on of them should be provided.

§on_scroll_up: Option<VoidCallback>

The handler for SemanticsAction.scrollUp.

This is the semantic equivalent of a user moving their finger across the screen from bottom to top. It should be recognized by controls that are vertically scrollable.

VoiceOver users on iOS can trigger this action by swiping up with three fingers. TalkBack users on Android can trigger this action by swiping right and then left in one motion path. On Android, onScrollUp and onScrollLeft share the same gesture. Therefore, only on of them should be provided.

§on_scroll_down: Option<VoidCallback>

The handler for SemanticsAction.scrollDown.

This is the semantic equivalent of a user moving their finger across the screen from top to bottom. It should be recognized by controls that are vertically scrollable.

VoiceOver users on iOS can trigger this action by swiping down with three fingers. TalkBack users on Android can trigger this action by swiping left and then right in one motion path. On Android, onScrollDown and onScrollRight share the same gesture. Therefore, only on of them should be provided.

§on_increase: Option<VoidCallback>

The handler for SemanticsAction.increase.

This is a request to increase the value represented by the widget. For example, this action might be recognized by a slider control.

If a value is set, increasedValue must also be provided and onIncrease must ensure that value will be set to increasedValue.

VoiceOver users on iOS can trigger this action by swiping up with one finger. TalkBack users on Android can trigger this action by pressing the volume up button.

§on_decrease: Option<VoidCallback>

The handler for SemanticsAction.decrease.

This is a request to decrease the value represented by the widget. For example, this action might be recognized by a slider control.

If a value is set, decreasedValue must also be provided and onDecrease must ensure that value will be set to decreasedValue.

VoiceOver users on iOS can trigger this action by swiping down with one finger. TalkBack users on Android can trigger this action by pressing the volume down button.

§on_copy: Option<VoidCallback>

The handler for SemanticsAction.copy.

This is a request to copy the current selection to the clipboard.

TalkBack users on Android can trigger this action from the local context menu of a text field, for example.

§on_cut: Option<VoidCallback>

The handler for SemanticsAction.cut.

This is a request to cut the current selection and place it in the clipboard.

TalkBack users on Android can trigger this action from the local context menu of a text field, for example.

§on_paste: Option<VoidCallback>

The handler for SemanticsAction.paste.

This is a request to paste the current content of the clipboard.

TalkBack users on Android can trigger this action from the local context menu of a text field, for example.

§on_move_cursor_forward_by_character: Option<MoveCursorHandler>

The handler for SemanticsAction.moveCursorForwardByCharacter.

This handler is invoked when the user wants to move the cursor in a text field forward by one character.

TalkBack users can trigger this by pressing the volume up key while the input focus is in a text field.

§on_move_cursor_backward_by_character: Option<MoveCursorHandler>

The handler for SemanticsAction.moveCursorBackwardByCharacter.

This handler is invoked when the user wants to move the cursor in a text field backward by one character.

TalkBack users can trigger this by pressing the volume down key while the input focus is in a text field.

§on_move_cursor_forward_by_word: Option<MoveCursorHandler>

The handler for SemanticsAction.moveCursorForwardByWord.

This handler is invoked when the user wants to move the cursor in a text field backward by one word.

TalkBack users can trigger this by pressing the volume down key while the input focus is in a text field.

§on_move_cursor_backward_by_word: Option<MoveCursorHandler>

The handler for SemanticsAction.moveCursorBackwardByWord.

This handler is invoked when the user wants to move the cursor in a text field backward by one word.

TalkBack users can trigger this by pressing the volume down key while the input focus is in a text field.

§on_set_selection: Option<SetSelectionHandler>

The handler for SemanticsAction.setSelection.

This handler is invoked when the user either wants to change the currently selected text in a text field or change the position of the cursor.

TalkBack users can trigger this handler by selecting “Move cursor to beginning/end” or “Select all” from the local context menu.

§on_set_text: Option<SetTextHandler>

The handler for SemanticsAction.setText.

This handler is invoked when the user wants to replace the current text in the text field with a new text.

Voice access users can trigger this handler by speaking type <text> to their Android devices.

§on_did_gain_accessibility_focus: Option<VoidCallback>

The handler for SemanticsAction.didGainAccessibilityFocus.

This handler is invoked when the node annotated with this handler gains the accessibility focus. The accessibility focus is the green (on Android with TalkBack) or black (on iOS with VoiceOver) rectangle shown on screen to indicate what element an accessibility user is currently interacting with.

The accessibility focus is different from the input focus. The input focus is usually held by the element that currently responds to keyboard inputs. Accessibility focus and input focus can be held by two different nodes!

§on_did_lose_accessibility_focus: Option<VoidCallback>

The handler for SemanticsAction.didLoseAccessibilityFocus.

This handler is invoked when the node annotated with this handler loses the accessibility focus. The accessibility focus is the green (on Android with TalkBack) or black (on iOS with VoiceOver) rectangle shown on screen to indicate what element an accessibility user is currently interacting with.

The accessibility focus is different from the input focus. The input focus is usually held by the element that currently responds to keyboard inputs. Accessibility focus and input focus can be held by two different nodes!

§on_focus: Option<VoidCallback>

The handler for SemanticsAction.focus.

This handler is invoked when the assistive technology requests that the focusable widget corresponding to this semantics node gain input focus. The FocusNode that manages the focus of the widget must gain focus. The widget must begin responding to relevant key events. For example:

  • Buttons must respond to tap/click events produced via keyboard shortcuts.
  • Text fields must become focused and editable, showing an on-screen keyboard, if necessary.
  • Checkboxes, switches, and radio buttons must become toggleable using keyboard shortcuts.

Focus behavior is specific to the platform and to the assistive technology used. See the documentation of SemanticsAction.focus for more detail.

§on_dismiss: Option<VoidCallback>

The handler for SemanticsAction.dismiss.

This is a request to dismiss the currently focused node.

TalkBack users on Android can trigger this action in the local context menu, and VoiceOver users on iOS can trigger this action with a standard gesture or menu option.

§on_expand: Option<VoidCallback>

The handler for SemanticsAction.expand.

This is a request to expand the currently focused node. For example, this action might be recognized by a dropdown.

This handler should only be set when the node is in a collapsed state (i.e., expanded is false).

§on_collapse: Option<VoidCallback>

The handler for SemanticsAction.collapse.

This is a request to collapse the currently focused node. For example, this action might be recognized by a dropdown.

This handler should only be set when the node is in an expanded state (i.e., expanded is true).

§custom_semantics_actions: Option<IndexMap<CustomSemanticsAction, VoidCallback>>

A map from each supported CustomSemanticsAction to a provided handler.

The handler associated with each custom action is called whenever a semantics action of type SemanticsAction.customAction is received. The provided argument will be an identifier used to retrieve an instance of a custom action which can then retrieve the correct handler from this map.

§role: Option<SemanticsRole>

A enum to describe what role the subtree represents.

Setting the role for a widget subtree helps assistive technologies, such as screen readers, to understand and interact with the UI correctly.

Defaults to SemanticsRole.none if not set, which means the subtree does not represent any complex ui or controls.

For a list of available roles, see SemanticsRole.

§controls_nodes: Option<IndexSet<String>>

The SemanticsNode.identifiers of widgets controlled by this subtree.

If a widget is controlling the visibility or content of another widget, for example, Tabs control child visibilities of TabBarView or ExpansionTile controls visibility of its expanded content, one must assign a SemanticsNode.identifier to the content and also provide a set of identifiers including the content’s identifier to this property.

§validation_result: SemanticsValidationResult

Describes the validation result for a form field represented by this widget.

Providing a validation result helps assistive technologies, such as screen readers, to communicate to the user whether they provided correct information in a form.

Defaults to SemanticsValidationResult.none if not set, which means no validation information is available for the respective semantics node.

For a list of available validation results, see SemanticsValidationResult.

§hit_test_behavior: Option<SemanticsHitTestBehavior>

Describes how the semantic node should behave during hit testing.

See ui.SemanticsHitTestBehavior for more details.

§input_type: Option<SemanticsInputType>

The input type for of a editable widget.

This property is only used when the subtree represents a text field.

Assistive technologies use this property to provide better information to users. For example, screen reader reads out the input type of text field when focused.

§max_value: Option<String>

The maximum value of the node.

Used in conjunction with value to define the current value and range of a node. A typical usage is for progress indicators, where value represents the current progress and maxValue defines the maximum possible value.

§min_value: Option<String>

The minimum value of the node.

Used in conjunction with value to define the current value and range of a node. A typical usage is for progress indicators, where value represents the current progress and minValue defines the minimum possible value.

Implementations§

Source§

impl SemanticsProperties

Source

pub fn new() -> SemanticsProperties

Creates a semantic annotation.

Source

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

Dart SemanticsProperties(enabled:).

Source

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

Dart SemanticsProperties(checked:).

Source

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

Dart SemanticsProperties(mixed:).

Source

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

Dart SemanticsProperties(expanded:).

Source

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

Dart SemanticsProperties(toggled:).

Source

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

Dart SemanticsProperties(selected:).

Source

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

Dart SemanticsProperties(button:).

Dart SemanticsProperties(link:).

Source

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

Dart SemanticsProperties(header:).

Source

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

Dart SemanticsProperties(textField:).

Source

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

Dart SemanticsProperties(slider:).

Source

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

Dart SemanticsProperties(keyboardKey:).

Source

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

Dart SemanticsProperties(readOnly:).

Source

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

Dart SemanticsProperties(focusable:).

Source

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

Dart SemanticsProperties(focused:).

Source

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

Dart SemanticsProperties(accessibilityFocusBlockType:).

Source

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

Dart SemanticsProperties(inMutuallyExclusiveGroup:).

Source

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

Dart SemanticsProperties(hidden:).

Source

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

Dart SemanticsProperties(obscured:).

Source

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

Dart SemanticsProperties(multiline:).

Source

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

Dart SemanticsProperties(scopesRoute:).

Source

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

Dart SemanticsProperties(namesRoute:).

Source

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

Dart SemanticsProperties(image:).

Source

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

Dart SemanticsProperties(liveRegion:).

Source

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

Dart SemanticsProperties(isRequired:).

Source

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

Dart SemanticsProperties(maxValueLength:).

Source

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

Dart SemanticsProperties(currentValueLength:).

Source

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

Dart SemanticsProperties(identifier:).

Source

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

Dart SemanticsProperties(traversalParentIdentifier:).

Source

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

Dart SemanticsProperties(traversalChildIdentifier:).

Source

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

Dart SemanticsProperties(label:).

Source

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

Dart SemanticsProperties(attributedLabel:).

Source

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

Dart SemanticsProperties(value:).

Source

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

Dart SemanticsProperties(attributedValue:).

Source

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

Dart SemanticsProperties(increasedValue:).

Source

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

Dart SemanticsProperties(attributedIncreasedValue:).

Source

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

Dart SemanticsProperties(decreasedValue:).

Source

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

Dart SemanticsProperties(attributedDecreasedValue:).

Source

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

Dart SemanticsProperties(hint:).

Source

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

Dart SemanticsProperties(attributedHint:).

Source

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

Dart SemanticsProperties(tooltip:).

Source

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

Dart SemanticsProperties(headingLevel:).

Source

pub fn hint_overrides( self, hint_overrides: SemanticsHintOverrides, ) -> SemanticsProperties

Dart SemanticsProperties(hintOverrides:).

Source

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

Dart SemanticsProperties(textDirection:).

Source

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

Dart SemanticsProperties(sortKey:).

Source

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

Dart SemanticsProperties(tagForChildren:).

Dart SemanticsProperties(linkUrl:).

Source

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

Dart SemanticsProperties(onTap:).

Source

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

Dart SemanticsProperties(onLongPress:).

Source

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

Dart SemanticsProperties(onScrollLeft:).

Source

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

Dart SemanticsProperties(onScrollRight:).

Source

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

Dart SemanticsProperties(onScrollUp:).

Source

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

Dart SemanticsProperties(onScrollDown:).

Source

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

Dart SemanticsProperties(onIncrease:).

Source

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

Dart SemanticsProperties(onDecrease:).

Source

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

Dart SemanticsProperties(onCopy:).

Source

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

Dart SemanticsProperties(onCut:).

Source

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

Dart SemanticsProperties(onPaste:).

Source

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

Dart SemanticsProperties(onMoveCursorForwardByCharacter:).

Source

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

Dart SemanticsProperties(onMoveCursorBackwardByCharacter:).

Source

pub fn on_move_cursor_forward_by_word( self, on_move_cursor_forward_by_word: MoveCursorHandler, ) -> SemanticsProperties

Dart SemanticsProperties(onMoveCursorForwardByWord:).

Source

pub fn on_move_cursor_backward_by_word( self, on_move_cursor_backward_by_word: MoveCursorHandler, ) -> SemanticsProperties

Dart SemanticsProperties(onMoveCursorBackwardByWord:).

Source

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

Dart SemanticsProperties(onSetSelection:).

Source

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

Dart SemanticsProperties(onSetText:).

Source

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

Dart SemanticsProperties(onDidGainAccessibilityFocus:).

Source

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

Dart SemanticsProperties(onDidLoseAccessibilityFocus:).

Source

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

Dart SemanticsProperties(onFocus:).

Source

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

Dart SemanticsProperties(onDismiss:).

Source

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

Dart SemanticsProperties(onExpand:).

Source

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

Dart SemanticsProperties(onCollapse:).

Source

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

Dart SemanticsProperties(customSemanticsActions:).

Source

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

Dart SemanticsProperties(role:).

Source

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

Dart SemanticsProperties(controlsNodes:).

Source

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

Dart SemanticsProperties(validationResult:).

Source

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

Dart SemanticsProperties(hitTestBehavior:).

Source

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

Dart SemanticsProperties(inputType:).

Source

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

Dart SemanticsProperties(maxValue:).

Source

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

Dart SemanticsProperties(minValue:).

Source

pub fn debug_check_constructor(&self)

Dart’s constructor asserts that relate two fields. The widgets built on these properties run it from their debug_check_constructor; an assert on one field stays in its setter.

Trait Implementations§

Source§

impl Clone for SemanticsProperties

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SemanticsProperties

Dart’s debugFillProperties, as it lists them.

Source§

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

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

impl Default for SemanticsProperties

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>