Unverified Commit 914556ea authored by gaaclarke's avatar gaaclarke Committed by GitHub

Started sharing SemanticsProperties between the Widget and the RenderObject (#104281)

parent 7ece8f9f
...@@ -3947,125 +3947,35 @@ class RenderSemanticsAnnotations extends RenderProxyBox { ...@@ -3947,125 +3947,35 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
/// ///
/// The [container] argument must not be null. /// The [container] argument must not be null.
/// ///
/// If the [attributedLabel] is not null, the [textDirection] must also not be null. /// If the [SemanticsProperties.attributedLabel] is not null, the [textDirection] must also not be null.
RenderSemanticsAnnotations({ RenderSemanticsAnnotations({
RenderBox? child, RenderBox? child,
required SemanticsProperties properties,
bool container = false, bool container = false,
bool explicitChildNodes = false, bool explicitChildNodes = false,
bool excludeSemantics = false, bool excludeSemantics = false,
bool? enabled,
bool? checked,
bool? toggled,
bool? selected,
bool? button,
bool? slider,
bool? keyboardKey,
bool? link,
bool? header,
bool? textField,
bool? readOnly,
bool? focusable,
bool? focused,
bool? inMutuallyExclusiveGroup,
bool? obscured,
bool? multiline,
bool? scopesRoute,
bool? namesRoute,
bool? hidden,
bool? image,
bool? liveRegion,
int? maxValueLength,
int? currentValueLength,
AttributedString? attributedLabel,
AttributedString? attributedValue,
AttributedString? attributedIncreasedValue,
AttributedString? attributedDecreasedValue,
AttributedString? attributedHint,
String? tooltip,
SemanticsHintOverrides? hintOverrides,
TextDirection? textDirection, TextDirection? textDirection,
SemanticsSortKey? sortKey, }) : assert(container != null),
SemanticsTag? tagForChildren, _container = container,
VoidCallback? onTap, _explicitChildNodes = explicitChildNodes,
VoidCallback? onDismiss, _excludeSemantics = excludeSemantics,
VoidCallback? onLongPress, _textDirection = textDirection,
VoidCallback? onScrollLeft, _properties = properties,
VoidCallback? onScrollRight, super(child) {
VoidCallback? onScrollUp, _updateAttributedFields(_properties);
VoidCallback? onScrollDown, }
VoidCallback? onIncrease,
VoidCallback? onDecrease, /// All of the [SemanticsProperties] for this [RenderSemanticsAnnotations].
VoidCallback? onCopy, SemanticsProperties get properties => _properties;
VoidCallback? onCut, SemanticsProperties _properties;
VoidCallback? onPaste, set properties(SemanticsProperties value) {
MoveCursorHandler? onMoveCursorForwardByCharacter, assert(value != null);
MoveCursorHandler? onMoveCursorBackwardByCharacter, if (_properties == value)
MoveCursorHandler? onMoveCursorForwardByWord, return;
MoveCursorHandler? onMoveCursorBackwardByWord, _properties = value;
SetSelectionHandler? onSetSelection, _updateAttributedFields(_properties);
SetTextHandler? onSetText, markNeedsSemanticsUpdate();
VoidCallback? onDidGainAccessibilityFocus, }
VoidCallback? onDidLoseAccessibilityFocus,
Map<CustomSemanticsAction, VoidCallback>? customSemanticsActions,
}) : assert(container != null),
_container = container,
_explicitChildNodes = explicitChildNodes,
_excludeSemantics = excludeSemantics,
_enabled = enabled,
_checked = checked,
_toggled = toggled,
_selected = selected,
_button = button,
_slider = slider,
_keyboardKey = keyboardKey,
_link = link,
_header = header,
_textField = textField,
_readOnly = readOnly,
_focusable = focusable,
_focused = focused,
_inMutuallyExclusiveGroup = inMutuallyExclusiveGroup,
_obscured = obscured,
_multiline = multiline,
_scopesRoute = scopesRoute,
_namesRoute = namesRoute,
_liveRegion = liveRegion,
_maxValueLength = maxValueLength,
_currentValueLength = currentValueLength,
_hidden = hidden,
_image = image,
_onDismiss = onDismiss,
_attributedLabel = attributedLabel,
_attributedValue = attributedValue,
_attributedIncreasedValue = attributedIncreasedValue,
_attributedDecreasedValue = attributedDecreasedValue,
_attributedHint = attributedHint,
_tooltip = tooltip,
_hintOverrides = hintOverrides,
_textDirection = textDirection,
_sortKey = sortKey,
_tagForChildren = tagForChildren,
_onTap = onTap,
_onLongPress = onLongPress,
_onScrollLeft = onScrollLeft,
_onScrollRight = onScrollRight,
_onScrollUp = onScrollUp,
_onScrollDown = onScrollDown,
_onIncrease = onIncrease,
_onDecrease = onDecrease,
_onCopy = onCopy,
_onCut = onCut,
_onPaste = onPaste,
_onMoveCursorForwardByCharacter = onMoveCursorForwardByCharacter,
_onMoveCursorBackwardByCharacter = onMoveCursorBackwardByCharacter,
_onMoveCursorForwardByWord = onMoveCursorForwardByWord,
_onMoveCursorBackwardByWord = onMoveCursorBackwardByWord,
_onSetSelection = onSetSelection,
_onSetText = onSetText,
_onDidGainAccessibilityFocus = onDidGainAccessibilityFocus,
_onDidLoseAccessibilityFocus = onDidLoseAccessibilityFocus,
_customSemanticsActions = customSemanticsActions,
super(child);
/// If 'container' is true, this [RenderObject] will introduce a new /// If 'container' is true, this [RenderObject] will introduce a new
/// node in the semantics tree. Otherwise, the semantics will be /// node in the semantics tree. Otherwise, the semantics will be
...@@ -4123,346 +4033,59 @@ class RenderSemanticsAnnotations extends RenderProxyBox { ...@@ -4123,346 +4033,59 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsFlag.hasCheckedState] semantic to true and void _updateAttributedFields(SemanticsProperties value) {
/// the [SemanticsConfiguration.isChecked] semantic to the given value. _attributedLabel = _effectiveAttributedLabel(value);
bool? get checked => _checked; _attributedValue = _effectiveAttributedValue(value);
bool? _checked; _attributedIncreasedValue = _effectiveAttributedIncreasedValue(value);
set checked(bool? value) { _attributedDecreasedValue = _effectiveAttributedDecreasedValue(value);
if (checked == value) _attributedHint = _effectiveAttributedHint(value);
return;
_checked = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsFlag.hasEnabledState] semantic to true and
/// the [SemanticsConfiguration.isEnabled] semantic to the given value.
bool? get enabled => _enabled;
bool? _enabled;
set enabled(bool? value) {
if (enabled == value)
return;
_enabled = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isSelected] semantic to the
/// given value.
bool? get selected => _selected;
bool? _selected;
set selected(bool? value) {
if (selected == value)
return;
_selected = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isButton] semantic to the
/// given value.
bool? get button => _button;
bool? _button;
set button(bool? value) {
if (button == value)
return;
_button = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isSlider] semantic to the
/// given value.
bool? get slider => _slider;
bool? _slider;
set slider(bool? value) {
if (slider == value)
return;
_slider = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isKeyboardKey] semantic to the
/// given value.
bool? get keyboardKey => _keyboardKey;
bool? _keyboardKey;
set keyboardKey(bool? value) {
if (keyboardKey == value)
return;
_keyboardKey = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isLink] semantic to the
/// given value.
bool? get link => _link;
bool? _link;
set link(bool? value) {
if (link == value)
return;
_link = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isHeader] semantic to the
/// given value.
bool? get header => _header;
bool? _header;
set header(bool? value) {
if (header == value)
return;
_header = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isTextField] semantic to the
/// given value.
bool? get textField => _textField;
bool? _textField;
set textField(bool? value) {
if (textField == value)
return;
_textField = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isReadOnly] semantic to the
/// given value.
bool? get readOnly => _readOnly;
bool? _readOnly;
set readOnly(bool? value) {
if (readOnly == value)
return;
_readOnly = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isFocusable] semantic to the
/// given value.
bool? get focusable => _focusable;
bool? _focusable;
set focusable(bool? value) {
if (focusable == value)
return;
_focusable = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isFocused] semantic to the
/// given value.
bool? get focused => _focused;
bool? _focused;
set focused(bool? value) {
if (focused == value)
return;
_focused = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isInMutuallyExclusiveGroup]
/// semantic to the given value.
bool? get inMutuallyExclusiveGroup => _inMutuallyExclusiveGroup;
bool? _inMutuallyExclusiveGroup;
set inMutuallyExclusiveGroup(bool? value) {
if (inMutuallyExclusiveGroup == value)
return;
_inMutuallyExclusiveGroup = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isObscured] semantic to the
/// given value.
bool? get obscured => _obscured;
bool? _obscured;
set obscured(bool? value) {
if (obscured == value)
return;
_obscured = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.isMultiline] semantic to the given
/// value.
bool? get multiline => _multiline;
bool? _multiline;
set multiline(bool? value) {
if (multiline == value)
return;
_multiline = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.scopesRoute] semantic to the
/// give value.
bool? get scopesRoute => _scopesRoute;
bool? _scopesRoute;
set scopesRoute(bool? value) {
if (scopesRoute == value)
return;
_scopesRoute = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsConfiguration.namesRoute] semantic to the AttributedString? _effectiveAttributedLabel(SemanticsProperties value) {
/// give value. return value.attributedLabel ??
bool? get namesRoute => _namesRoute; (value.label == null ? null : AttributedString(value.label!));
bool? _namesRoute;
set namesRoute(bool? value) {
if (_namesRoute == value)
return;
_namesRoute = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsConfiguration.isHidden] semantic to the AttributedString? _effectiveAttributedValue(SemanticsProperties value) {
/// given value. return value.attributedValue ??
bool? get hidden => _hidden; (value.value == null ? null : AttributedString(value.value!));
bool? _hidden;
set hidden(bool? value) {
if (hidden == value)
return;
_hidden = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.isImage] semantic to the
/// given value.
bool? get image => _image;
bool? _image;
set image(bool? value) {
if (_image == value)
return;
_image = value;
}
/// If non-null, sets the [SemanticsConfiguration.liveRegion] semantic to
/// the given value.
bool? get liveRegion => _liveRegion;
bool? _liveRegion;
set liveRegion(bool? value) {
if (_liveRegion == value)
return;
_liveRegion = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsNode.maxValueLength] semantic to the given AttributedString? _effectiveAttributedIncreasedValue(
/// value. SemanticsProperties value) {
int? get maxValueLength => _maxValueLength; return value.attributedIncreasedValue ??
int? _maxValueLength; (value.increasedValue == null
set maxValueLength(int? value) { ? null
if (_maxValueLength == value) : AttributedString(value.increasedValue!));
return;
_maxValueLength = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsNode.currentValueLength] semantic to the AttributedString? _effectiveAttributedDecreasedValue(
/// given value. SemanticsProperties value) {
int? get currentValueLength => _currentValueLength; return properties.attributedDecreasedValue ??
int? _currentValueLength; (value.decreasedValue == null
set currentValueLength(int? value) { ? null
if (_currentValueLength == value) : AttributedString(value.decreasedValue!));
return;
_currentValueLength = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsConfiguration.isToggled] semantic to the given AttributedString? _effectiveAttributedHint(SemanticsProperties value) {
/// value. return value.attributedHint ??
bool? get toggled => _toggled; (value.hint == null ? null : AttributedString(value.hint!));
bool? _toggled;
set toggled(bool? value) {
if (_toggled == value)
return;
_toggled = value;
markNeedsSemanticsUpdate();
} }
/// If non-null, sets the [SemanticsNode.attributedLabel] semantic to the given value.
///
/// The reading direction is given by [textDirection].
AttributedString? get attributedLabel => _attributedLabel;
AttributedString? _attributedLabel; AttributedString? _attributedLabel;
set attributedLabel(AttributedString? value) {
if (_attributedLabel == value)
return;
_attributedLabel = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.attributedValue] semantic to the given value.
///
/// The reading direction is given by [textDirection].
AttributedString? get attributedValue => _attributedValue;
AttributedString? _attributedValue; AttributedString? _attributedValue;
set attributedValue(AttributedString? value) {
if (_attributedValue == value)
return;
_attributedValue = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.attributedIncreasedValue] semantic to the given value.
///
/// The reading direction is given by [textDirection].
AttributedString? get attributedIncreasedValue => _attributedIncreasedValue;
AttributedString? _attributedIncreasedValue; AttributedString? _attributedIncreasedValue;
set attributedIncreasedValue(AttributedString? value) {
if (_attributedIncreasedValue == value)
return;
_attributedIncreasedValue = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.attributedDecreasedValue] semantic to the given value.
///
/// The reading direction is given by [textDirection].
AttributedString? get attributedDecreasedValue => _attributedDecreasedValue;
AttributedString? _attributedDecreasedValue; AttributedString? _attributedDecreasedValue;
set attributedDecreasedValue(AttributedString? value) {
if (_attributedDecreasedValue == value)
return;
_attributedDecreasedValue = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.attributedHint] semantic to the given value.
///
/// The reading direction is given by [textDirection].
AttributedString? get attributedHint => _attributedHint;
AttributedString? _attributedHint; AttributedString? _attributedHint;
set attributedHint(AttributedString? value) {
if (_attributedHint == value)
return;
_attributedHint = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.tooltip] semantic to the given value.
///
/// The reading direction is given by [textDirection].
String? get tooltip => _tooltip;
String? _tooltip;
set tooltip(String? value) {
if (_tooltip == value)
return;
_tooltip = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsConfiguration.hintOverrides] to the given value.
SemanticsHintOverrides? get hintOverrides => _hintOverrides;
SemanticsHintOverrides? _hintOverrides;
set hintOverrides(SemanticsHintOverrides? value) {
if (_hintOverrides == value)
return;
_hintOverrides = value;
markNeedsSemanticsUpdate();
}
/// If non-null, sets the [SemanticsNode.textDirection] semantic to the given /// If non-null, sets the [SemanticsNode.textDirection] semantic to the given
/// value. /// value.
/// ///
/// This must not be null if [attributedLabel], [attributedHint], /// This must not be null if [SemanticsProperties.attributedLabel],
/// [attributedValue], [attributedIncreasedValue], or /// [SemanticsProperties.attributedHint],
/// [attributedDecreasedValue] are not null. /// [SemanticsProperties.attributedValue],
/// [SemanticsProperties.attributedIncreasedValue], or
/// [SemanticsProperties.attributedDecreasedValue] are not null.
TextDirection? get textDirection => _textDirection; TextDirection? get textDirection => _textDirection;
TextDirection? _textDirection; TextDirection? _textDirection;
set textDirection(TextDirection? value) { set textDirection(TextDirection? value) {
...@@ -4472,446 +4095,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox { ...@@ -4472,446 +4095,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
/// Sets the [SemanticsNode.sortKey] to the given value.
///
/// This defines how this node is sorted among the sibling semantics nodes
/// to determine the order in which they are traversed by the accessibility
/// services on the platform (e.g. VoiceOver on iOS and TalkBack on Android).
SemanticsSortKey? get sortKey => _sortKey;
SemanticsSortKey? _sortKey;
set sortKey(SemanticsSortKey? value) {
if (sortKey == value)
return;
_sortKey = value;
markNeedsSemanticsUpdate();
}
/// Adds a semantics tag to the semantics subtree.
SemanticsTag? get tagForChildren => _tagForChildren;
SemanticsTag? _tagForChildren;
set tagForChildren(SemanticsTag? value) {
if (_tagForChildren == value)
return;
markNeedsSemanticsUpdate();
_tagForChildren = value;
}
/// 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 can trigger this
/// action by double-tapping the screen while an element is focused.
VoidCallback? get onTap => _onTap;
VoidCallback? _onTap;
set onTap(VoidCallback? handler) {
if (_onTap == handler)
return;
final bool hadValue = _onTap != null;
_onTap = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onDismiss => _onDismiss;
VoidCallback? _onDismiss;
set onDismiss(VoidCallback? handler) {
if (_onDismiss == handler)
return;
final bool hadValue = _onDismiss != null;
_onDismiss = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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 can trigger this
/// action by double-tapping the screen without lifting the finger after the
/// second tap.
VoidCallback? get onLongPress => _onLongPress;
VoidCallback? _onLongPress;
set onLongPress(VoidCallback? handler) {
if (_onLongPress == handler)
return;
final bool hadValue = _onLongPress != null;
_onLongPress = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onScrollLeft => _onScrollLeft;
VoidCallback? _onScrollLeft;
set onScrollLeft(VoidCallback? handler) {
if (_onScrollLeft == handler)
return;
final bool hadValue = _onScrollLeft != null;
_onScrollLeft = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onScrollRight => _onScrollRight;
VoidCallback? _onScrollRight;
set onScrollRight(VoidCallback? handler) {
if (_onScrollRight == handler)
return;
final bool hadValue = _onScrollRight != null;
_onScrollRight = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onScrollUp => _onScrollUp;
VoidCallback? _onScrollUp;
set onScrollUp(VoidCallback? handler) {
if (_onScrollUp == handler)
return;
final bool hadValue = _onScrollUp != null;
_onScrollUp = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onScrollDown => _onScrollDown;
VoidCallback? _onScrollDown;
set onScrollDown(VoidCallback? handler) {
if (_onScrollDown == handler)
return;
final bool hadValue = _onScrollDown != null;
_onScrollDown = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
///
/// 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.
VoidCallback? get onIncrease => _onIncrease;
VoidCallback? _onIncrease;
set onIncrease(VoidCallback? handler) {
if (_onIncrease == handler)
return;
final bool hadValue = _onIncrease != null;
_onIncrease = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
///
/// 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.
VoidCallback? get onDecrease => _onDecrease;
VoidCallback? _onDecrease;
set onDecrease(VoidCallback? handler) {
if (_onDecrease == handler)
return;
final bool hadValue = _onDecrease != null;
_onDecrease = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onCopy => _onCopy;
VoidCallback? _onCopy;
set onCopy(VoidCallback? handler) {
if (_onCopy == handler)
return;
final bool hadValue = _onCopy != null;
_onCopy = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onCut => _onCut;
VoidCallback? _onCut;
set onCut(VoidCallback? handler) {
if (_onCut == handler)
return;
final bool hadValue = _onCut != null;
_onCut = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
VoidCallback? get onPaste => _onPaste;
VoidCallback? _onPaste;
set onPaste(VoidCallback? handler) {
if (_onPaste == handler)
return;
final bool hadValue = _onPaste != null;
_onPaste = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
MoveCursorHandler? get onMoveCursorForwardByCharacter => _onMoveCursorForwardByCharacter;
MoveCursorHandler? _onMoveCursorForwardByCharacter;
set onMoveCursorForwardByCharacter(MoveCursorHandler? handler) {
if (_onMoveCursorForwardByCharacter == handler)
return;
final bool hadValue = _onMoveCursorForwardByCharacter != null;
_onMoveCursorForwardByCharacter = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
MoveCursorHandler? get onMoveCursorBackwardByCharacter => _onMoveCursorBackwardByCharacter;
MoveCursorHandler? _onMoveCursorBackwardByCharacter;
set onMoveCursorBackwardByCharacter(MoveCursorHandler? handler) {
if (_onMoveCursorBackwardByCharacter == handler)
return;
final bool hadValue = _onMoveCursorBackwardByCharacter != null;
_onMoveCursorBackwardByCharacter = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// The handler for [SemanticsAction.moveCursorForwardByWord].
///
/// 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.
MoveCursorHandler? get onMoveCursorForwardByWord => _onMoveCursorForwardByWord;
MoveCursorHandler? _onMoveCursorForwardByWord;
set onMoveCursorForwardByWord(MoveCursorHandler? handler) {
if (_onMoveCursorForwardByWord == handler)
return;
final bool hadValue = _onMoveCursorForwardByWord != null;
_onMoveCursorForwardByWord = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// The handler for [SemanticsAction.moveCursorBackwardByWord].
///
/// 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.
MoveCursorHandler? get onMoveCursorBackwardByWord => _onMoveCursorBackwardByWord;
MoveCursorHandler? _onMoveCursorBackwardByWord;
set onMoveCursorBackwardByWord(MoveCursorHandler? handler) {
if (_onMoveCursorBackwardByWord == handler)
return;
final bool hadValue = _onMoveCursorBackwardByWord != null;
_onMoveCursorBackwardByWord = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
SetSelectionHandler? get onSetSelection => _onSetSelection;
SetSelectionHandler? _onSetSelection;
set onSetSelection(SetSelectionHandler? handler) {
if (_onSetSelection == handler)
return;
final bool hadValue = _onSetSelection != null;
_onSetSelection = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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.
SetTextHandler? get onSetText => _onSetText;
SetTextHandler? _onSetText;
set onSetText(SetTextHandler? handler) {
if (_onSetText == handler)
return;
final bool hadValue = _onSetText != null;
_onSetText = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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!
///
/// See also:
///
/// * [onDidLoseAccessibilityFocus], which is invoked when the accessibility
/// focus is removed from the node.
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus.
VoidCallback? get onDidGainAccessibilityFocus => _onDidGainAccessibilityFocus;
VoidCallback? _onDidGainAccessibilityFocus;
set onDidGainAccessibilityFocus(VoidCallback? handler) {
if (_onDidGainAccessibilityFocus == handler)
return;
final bool hadValue = _onDidGainAccessibilityFocus != null;
_onDidGainAccessibilityFocus = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// 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!
///
/// See also:
///
/// * [onDidGainAccessibilityFocus], which is invoked when the node gains
/// accessibility focus.
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus.
VoidCallback? get onDidLoseAccessibilityFocus => _onDidLoseAccessibilityFocus;
VoidCallback? _onDidLoseAccessibilityFocus;
set onDidLoseAccessibilityFocus(VoidCallback? handler) {
if (_onDidLoseAccessibilityFocus == handler)
return;
final bool hadValue = _onDidLoseAccessibilityFocus != null;
_onDidLoseAccessibilityFocus = handler;
if ((handler != null) != hadValue)
markNeedsSemanticsUpdate();
}
/// The handlers and supported [CustomSemanticsAction]s for this node.
///
/// These handlers are called whenever the user performs the associated
/// custom accessibility action from a special platform menu. Providing any
/// custom actions here also adds [SemanticsAction.customAction] to the node.
///
/// See also:
///
/// * [CustomSemanticsAction], for an explanation of custom actions.
Map<CustomSemanticsAction, VoidCallback>? get customSemanticsActions => _customSemanticsActions;
Map<CustomSemanticsAction, VoidCallback>? _customSemanticsActions;
set customSemanticsActions(Map<CustomSemanticsAction, VoidCallback>? value) {
if (_customSemanticsActions == value)
return;
_customSemanticsActions = value;
markNeedsSemanticsUpdate();
}
@override @override
void visitChildrenForSemantics(RenderObjectVisitor visitor) { void visitChildrenForSemantics(RenderObjectVisitor visitor) {
if (excludeSemantics) if (excludeSemantics)
...@@ -4925,207 +4108,207 @@ class RenderSemanticsAnnotations extends RenderProxyBox { ...@@ -4925,207 +4108,207 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
config.isSemanticBoundary = container; config.isSemanticBoundary = container;
config.explicitChildNodes = explicitChildNodes; config.explicitChildNodes = explicitChildNodes;
assert( assert(
((scopesRoute ?? false) && explicitChildNodes) || !(scopesRoute ?? false), ((_properties.scopesRoute ?? false) && explicitChildNodes) || !(_properties.scopesRoute ?? false),
'explicitChildNodes must be set to true if scopes route is true', 'explicitChildNodes must be set to true if scopes route is true',
); );
assert( assert(
!((toggled ?? false) && (checked ?? false)), !((_properties.toggled ?? false) && (_properties.checked ?? false)),
'A semantics node cannot be toggled and checked at the same time', 'A semantics node cannot be toggled and checked at the same time',
); );
if (enabled != null) if (_properties.enabled != null)
config.isEnabled = enabled; config.isEnabled = _properties.enabled;
if (checked != null) if (_properties.checked != null)
config.isChecked = checked; config.isChecked = _properties.checked;
if (toggled != null) if (_properties.toggled != null)
config.isToggled = toggled; config.isToggled = _properties.toggled;
if (selected != null) if (_properties.selected != null)
config.isSelected = selected!; config.isSelected = _properties.selected!;
if (button != null) if (_properties.button != null)
config.isButton = button!; config.isButton = _properties.button!;
if (link != null) if (_properties.link != null)
config.isLink = link!; config.isLink = _properties.link!;
if (slider != null) if (_properties.slider != null)
config.isSlider = slider!; config.isSlider = _properties.slider!;
if (keyboardKey != null) if (_properties.keyboardKey != null)
config.isKeyboardKey = keyboardKey!; config.isKeyboardKey = _properties.keyboardKey!;
if (header != null) if (_properties.header != null)
config.isHeader = header!; config.isHeader = _properties.header!;
if (textField != null) if (_properties.textField != null)
config.isTextField = textField!; config.isTextField = _properties.textField!;
if (readOnly != null) if (_properties.readOnly != null)
config.isReadOnly = readOnly!; config.isReadOnly = _properties.readOnly!;
if (focusable != null) if (_properties.focusable != null)
config.isFocusable = focusable!; config.isFocusable = _properties.focusable!;
if (focused != null) if (_properties.focused != null)
config.isFocused = focused!; config.isFocused = _properties.focused!;
if (inMutuallyExclusiveGroup != null) if (_properties.inMutuallyExclusiveGroup != null)
config.isInMutuallyExclusiveGroup = inMutuallyExclusiveGroup!; config.isInMutuallyExclusiveGroup = _properties.inMutuallyExclusiveGroup!;
if (obscured != null) if (_properties.obscured != null)
config.isObscured = obscured!; config.isObscured = _properties.obscured!;
if (multiline != null) if (_properties.multiline != null)
config.isMultiline = multiline!; config.isMultiline = _properties.multiline!;
if (hidden != null) if (_properties.hidden != null)
config.isHidden = hidden!; config.isHidden = _properties.hidden!;
if (image != null) if (_properties.image != null)
config.isImage = image!; config.isImage = _properties.image!;
if (attributedLabel != null) if (_attributedLabel != null)
config.attributedLabel = attributedLabel!; config.attributedLabel = _attributedLabel!;
if (attributedValue != null) if (_attributedValue != null)
config.attributedValue = attributedValue!; config.attributedValue = _attributedValue!;
if (attributedIncreasedValue != null) if (_attributedIncreasedValue != null)
config.attributedIncreasedValue = attributedIncreasedValue!; config.attributedIncreasedValue = _attributedIncreasedValue!;
if (attributedDecreasedValue != null) if (_attributedDecreasedValue != null)
config.attributedDecreasedValue = attributedDecreasedValue!; config.attributedDecreasedValue = _attributedDecreasedValue!;
if (attributedHint != null) if (_attributedHint != null)
config.attributedHint = attributedHint!; config.attributedHint = _attributedHint!;
if (tooltip != null) if (_properties.tooltip != null)
config.tooltip = tooltip!; config.tooltip = _properties.tooltip!;
if (hintOverrides != null && hintOverrides!.isNotEmpty) if (_properties.hintOverrides != null && _properties.hintOverrides!.isNotEmpty)
config.hintOverrides = hintOverrides; config.hintOverrides = _properties.hintOverrides;
if (scopesRoute != null) if (_properties.scopesRoute != null)
config.scopesRoute = scopesRoute!; config.scopesRoute = _properties.scopesRoute!;
if (namesRoute != null) if (_properties.namesRoute != null)
config.namesRoute = namesRoute!; config.namesRoute = _properties.namesRoute!;
if (liveRegion != null) if (_properties.liveRegion != null)
config.liveRegion = liveRegion!; config.liveRegion = _properties.liveRegion!;
if (maxValueLength != null) { if (_properties.maxValueLength != null) {
config.maxValueLength = maxValueLength; config.maxValueLength = _properties.maxValueLength;
} }
if (currentValueLength != null) { if (_properties.currentValueLength != null) {
config.currentValueLength = currentValueLength; config.currentValueLength = _properties.currentValueLength;
} }
if (textDirection != null) if (textDirection != null)
config.textDirection = textDirection; config.textDirection = textDirection;
if (sortKey != null) if (_properties.sortKey != null)
config.sortKey = sortKey; config.sortKey = _properties.sortKey;
if (tagForChildren != null) if (_properties.tagForChildren != null)
config.addTagForChildren(tagForChildren!); config.addTagForChildren(_properties.tagForChildren!);
// Registering _perform* as action handlers instead of the user provided // Registering _perform* as action handlers instead of the user provided
// ones to ensure that changing a user provided handler from a non-null to // ones to ensure that changing a user provided handler from a non-null to
// another non-null value doesn't require a semantics update. // another non-null value doesn't require a semantics update.
if (onTap != null) if (_properties.onTap != null)
config.onTap = _performTap; config.onTap = _performTap;
if (onLongPress != null) if (_properties.onLongPress != null)
config.onLongPress = _performLongPress; config.onLongPress = _performLongPress;
if (onDismiss != null) if (_properties.onDismiss != null)
config.onDismiss = _performDismiss; config.onDismiss = _performDismiss;
if (onScrollLeft != null) if (_properties.onScrollLeft != null)
config.onScrollLeft = _performScrollLeft; config.onScrollLeft = _performScrollLeft;
if (onScrollRight != null) if (_properties.onScrollRight != null)
config.onScrollRight = _performScrollRight; config.onScrollRight = _performScrollRight;
if (onScrollUp != null) if (_properties.onScrollUp != null)
config.onScrollUp = _performScrollUp; config.onScrollUp = _performScrollUp;
if (onScrollDown != null) if (_properties.onScrollDown != null)
config.onScrollDown = _performScrollDown; config.onScrollDown = _performScrollDown;
if (onIncrease != null) if (_properties.onIncrease != null)
config.onIncrease = _performIncrease; config.onIncrease = _performIncrease;
if (onDecrease != null) if (_properties.onDecrease != null)
config.onDecrease = _performDecrease; config.onDecrease = _performDecrease;
if (onCopy != null) if (_properties.onCopy != null)
config.onCopy = _performCopy; config.onCopy = _performCopy;
if (onCut != null) if (_properties.onCut != null)
config.onCut = _performCut; config.onCut = _performCut;
if (onPaste != null) if (_properties.onPaste != null)
config.onPaste = _performPaste; config.onPaste = _performPaste;
if (onMoveCursorForwardByCharacter != null) if (_properties.onMoveCursorForwardByCharacter != null)
config.onMoveCursorForwardByCharacter = _performMoveCursorForwardByCharacter; config.onMoveCursorForwardByCharacter = _performMoveCursorForwardByCharacter;
if (onMoveCursorBackwardByCharacter != null) if (_properties.onMoveCursorBackwardByCharacter != null)
config.onMoveCursorBackwardByCharacter = _performMoveCursorBackwardByCharacter; config.onMoveCursorBackwardByCharacter = _performMoveCursorBackwardByCharacter;
if (onMoveCursorForwardByWord != null) if (_properties.onMoveCursorForwardByWord != null)
config.onMoveCursorForwardByWord = _performMoveCursorForwardByWord; config.onMoveCursorForwardByWord = _performMoveCursorForwardByWord;
if (onMoveCursorBackwardByWord != null) if (_properties.onMoveCursorBackwardByWord != null)
config.onMoveCursorBackwardByWord = _performMoveCursorBackwardByWord; config.onMoveCursorBackwardByWord = _performMoveCursorBackwardByWord;
if (onSetSelection != null) if (_properties.onSetSelection != null)
config.onSetSelection = _performSetSelection; config.onSetSelection = _performSetSelection;
if (onSetText != null) if (_properties.onSetText != null)
config.onSetText = _performSetText; config.onSetText = _performSetText;
if (onDidGainAccessibilityFocus != null) if (_properties.onDidGainAccessibilityFocus != null)
config.onDidGainAccessibilityFocus = _performDidGainAccessibilityFocus; config.onDidGainAccessibilityFocus = _performDidGainAccessibilityFocus;
if (onDidLoseAccessibilityFocus != null) if (_properties.onDidLoseAccessibilityFocus != null)
config.onDidLoseAccessibilityFocus = _performDidLoseAccessibilityFocus; config.onDidLoseAccessibilityFocus = _performDidLoseAccessibilityFocus;
if (customSemanticsActions != null) if (_properties.customSemanticsActions != null)
config.customSemanticsActions = _customSemanticsActions!; config.customSemanticsActions = _properties.customSemanticsActions!;
} }
void _performTap() { void _performTap() {
onTap?.call(); _properties.onTap?.call();
} }
void _performLongPress() { void _performLongPress() {
onLongPress?.call(); _properties.onLongPress?.call();
} }
void _performDismiss() { void _performDismiss() {
onDismiss?.call(); _properties.onDismiss?.call();
} }
void _performScrollLeft() { void _performScrollLeft() {
onScrollLeft?.call(); _properties.onScrollLeft?.call();
} }
void _performScrollRight() { void _performScrollRight() {
onScrollRight?.call(); _properties.onScrollRight?.call();
} }
void _performScrollUp() { void _performScrollUp() {
onScrollUp?.call(); _properties.onScrollUp?.call();
} }
void _performScrollDown() { void _performScrollDown() {
onScrollDown?.call(); _properties.onScrollDown?.call();
} }
void _performIncrease() { void _performIncrease() {
onIncrease?.call(); _properties.onIncrease?.call();
} }
void _performDecrease() { void _performDecrease() {
onDecrease?.call(); _properties.onDecrease?.call();
} }
void _performCopy() { void _performCopy() {
onCopy?.call(); _properties.onCopy?.call();
} }
void _performCut() { void _performCut() {
onCut?.call(); _properties.onCut?.call();
} }
void _performPaste() { void _performPaste() {
onPaste?.call(); _properties.onPaste?.call();
} }
void _performMoveCursorForwardByCharacter(bool extendSelection) { void _performMoveCursorForwardByCharacter(bool extendSelection) {
onMoveCursorForwardByCharacter?.call(extendSelection); _properties.onMoveCursorForwardByCharacter?.call(extendSelection);
} }
void _performMoveCursorBackwardByCharacter(bool extendSelection) { void _performMoveCursorBackwardByCharacter(bool extendSelection) {
onMoveCursorBackwardByCharacter?.call(extendSelection); _properties.onMoveCursorBackwardByCharacter?.call(extendSelection);
} }
void _performMoveCursorForwardByWord(bool extendSelection) { void _performMoveCursorForwardByWord(bool extendSelection) {
onMoveCursorForwardByWord?.call(extendSelection); _properties.onMoveCursorForwardByWord?.call(extendSelection);
} }
void _performMoveCursorBackwardByWord(bool extendSelection) { void _performMoveCursorBackwardByWord(bool extendSelection) {
onMoveCursorBackwardByWord?.call(extendSelection); _properties.onMoveCursorBackwardByWord?.call(extendSelection);
} }
void _performSetSelection(TextSelection selection) { void _performSetSelection(TextSelection selection) {
onSetSelection?.call(selection); _properties.onSetSelection?.call(selection);
} }
void _performSetText(String text) { void _performSetText(String text) {
onSetText?.call(text); _properties.onSetText?.call(text);
} }
void _performDidGainAccessibilityFocus() { void _performDidGainAccessibilityFocus() {
onDidGainAccessibilityFocus?.call(); _properties.onDidGainAccessibilityFocus?.call();
} }
void _performDidLoseAccessibilityFocus() { void _performDidLoseAccessibilityFocus() {
onDidLoseAccessibilityFocus?.call(); _properties.onDidLoseAccessibilityFocus?.call();
} }
} }
......
...@@ -6902,91 +6902,14 @@ class Semantics extends SingleChildRenderObjectWidget { ...@@ -6902,91 +6902,14 @@ class Semantics extends SingleChildRenderObjectWidget {
/// an [ExcludeSemantics] widget and then another [Semantics] widget. /// an [ExcludeSemantics] widget and then another [Semantics] widget.
final bool excludeSemantics; final bool excludeSemantics;
AttributedString? get _effectiveAttributedLabel {
return properties.attributedLabel ??
(properties.label == null ? null : AttributedString(properties.label!));
}
AttributedString? get _effectiveAttributedValue {
return properties.attributedValue ??
(properties.value == null ? null : AttributedString(properties.value!));
}
AttributedString? get _effectiveAttributedIncreasedValue {
return properties.attributedIncreasedValue ??
(properties.increasedValue == null ? null : AttributedString(properties.increasedValue!));
}
AttributedString? get _effectiveAttributedDecreasedValue {
return properties.attributedDecreasedValue ??
(properties.decreasedValue == null ? null : AttributedString(properties.decreasedValue!));
}
AttributedString? get _effectiveAttributedHint {
return properties.attributedHint ??
(properties.hint == null ? null : AttributedString(properties.hint!));
}
@override @override
RenderSemanticsAnnotations createRenderObject(BuildContext context) { RenderSemanticsAnnotations createRenderObject(BuildContext context) {
return RenderSemanticsAnnotations( return RenderSemanticsAnnotations(
container: container, container: container,
explicitChildNodes: explicitChildNodes, explicitChildNodes: explicitChildNodes,
excludeSemantics: excludeSemantics, excludeSemantics: excludeSemantics,
enabled: properties.enabled, properties: properties,
checked: properties.checked,
toggled: properties.toggled,
selected: properties.selected,
button: properties.button,
slider: properties.slider,
keyboardKey: properties.keyboardKey,
link: properties.link,
header: properties.header,
textField: properties.textField,
readOnly: properties.readOnly,
focusable: properties.focusable,
focused: properties.focused,
liveRegion: properties.liveRegion,
maxValueLength: properties.maxValueLength,
currentValueLength: properties.currentValueLength,
inMutuallyExclusiveGroup: properties.inMutuallyExclusiveGroup,
obscured: properties.obscured,
multiline: properties.multiline,
scopesRoute: properties.scopesRoute,
namesRoute: properties.namesRoute,
hidden: properties.hidden,
image: properties.image,
attributedLabel: _effectiveAttributedLabel,
attributedValue: _effectiveAttributedValue,
attributedIncreasedValue: _effectiveAttributedIncreasedValue,
attributedDecreasedValue: _effectiveAttributedDecreasedValue,
attributedHint: _effectiveAttributedHint,
tooltip: properties.tooltip,
hintOverrides: properties.hintOverrides,
textDirection: _getTextDirection(context), textDirection: _getTextDirection(context),
sortKey: properties.sortKey,
tagForChildren: properties.tagForChildren,
onTap: properties.onTap,
onLongPress: properties.onLongPress,
onScrollLeft: properties.onScrollLeft,
onScrollRight: properties.onScrollRight,
onScrollUp: properties.onScrollUp,
onScrollDown: properties.onScrollDown,
onIncrease: properties.onIncrease,
onDecrease: properties.onDecrease,
onCopy: properties.onCopy,
onDismiss: properties.onDismiss,
onCut: properties.onCut,
onPaste: properties.onPaste,
onMoveCursorForwardByCharacter: properties.onMoveCursorForwardByCharacter,
onMoveCursorBackwardByCharacter: properties.onMoveCursorBackwardByCharacter,
onMoveCursorForwardByWord: properties.onMoveCursorForwardByWord,
onMoveCursorBackwardByWord: properties.onMoveCursorBackwardByWord,
onSetSelection: properties.onSetSelection,
onSetText: properties.onSetText,
onDidGainAccessibilityFocus: properties.onDidGainAccessibilityFocus,
onDidLoseAccessibilityFocus: properties.onDidLoseAccessibilityFocus,
customSemanticsActions: properties.customSemanticsActions,
); );
} }
...@@ -7012,60 +6935,8 @@ class Semantics extends SingleChildRenderObjectWidget { ...@@ -7012,60 +6935,8 @@ class Semantics extends SingleChildRenderObjectWidget {
..container = container ..container = container
..explicitChildNodes = explicitChildNodes ..explicitChildNodes = explicitChildNodes
..excludeSemantics = excludeSemantics ..excludeSemantics = excludeSemantics
..scopesRoute = properties.scopesRoute ..properties = properties
..enabled = properties.enabled ..textDirection = _getTextDirection(context);
..checked = properties.checked
..toggled = properties.toggled
..selected = properties.selected
..button = properties.button
..slider = properties.slider
..keyboardKey = properties.keyboardKey
..link = properties.link
..header = properties.header
..textField = properties.textField
..readOnly = properties.readOnly
..focusable = properties.focusable
..focused = properties.focused
..inMutuallyExclusiveGroup = properties.inMutuallyExclusiveGroup
..obscured = properties.obscured
..multiline = properties.multiline
..hidden = properties.hidden
..image = properties.image
..liveRegion = properties.liveRegion
..maxValueLength = properties.maxValueLength
..currentValueLength = properties.currentValueLength
..attributedLabel = _effectiveAttributedLabel
..attributedValue = _effectiveAttributedValue
..attributedIncreasedValue = _effectiveAttributedIncreasedValue
..attributedDecreasedValue = _effectiveAttributedDecreasedValue
..attributedHint = _effectiveAttributedHint
..tooltip = properties.tooltip
..hintOverrides = properties.hintOverrides
..namesRoute = properties.namesRoute
..textDirection = _getTextDirection(context)
..sortKey = properties.sortKey
..tagForChildren = properties.tagForChildren
..onTap = properties.onTap
..onLongPress = properties.onLongPress
..onScrollLeft = properties.onScrollLeft
..onScrollRight = properties.onScrollRight
..onScrollUp = properties.onScrollUp
..onScrollDown = properties.onScrollDown
..onIncrease = properties.onIncrease
..onDismiss = properties.onDismiss
..onDecrease = properties.onDecrease
..onCopy = properties.onCopy
..onCut = properties.onCut
..onPaste = properties.onPaste
..onMoveCursorForwardByCharacter = properties.onMoveCursorForwardByCharacter
..onMoveCursorBackwardByCharacter = properties.onMoveCursorForwardByCharacter
..onMoveCursorForwardByWord = properties.onMoveCursorForwardByWord
..onMoveCursorBackwardByWord = properties.onMoveCursorBackwardByWord
..onSetSelection = properties.onSetSelection
..onSetText = properties.onSetText
..onDidGainAccessibilityFocus = properties.onDidGainAccessibilityFocus
..onDidLoseAccessibilityFocus = properties.onDidLoseAccessibilityFocus
..customSemanticsActions = properties.customSemanticsActions;
} }
@override @override
......
...@@ -28,7 +28,10 @@ class TestTree { ...@@ -28,7 +28,10 @@ class TestTree {
child: RenderPositionedBox( child: RenderPositionedBox(
child: child = RenderConstrainedBox( child: child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0), additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0),
child: RenderSemanticsAnnotations(attributedLabel: AttributedString('Hello there foo'), textDirection: TextDirection.ltr), child: RenderSemanticsAnnotations(
textDirection: TextDirection.ltr,
properties: const SemanticsProperties(label: 'Hello there foo'),
),
), ),
), ),
), ),
......
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
test('only send semantics update if semantics have changed', () { test('only send semantics update if semantics have changed', () {
final TestRender testRender = TestRender() final TestRender testRender = TestRender()
..attributedLabel = AttributedString('hello') ..properties = const SemanticsProperties(label: 'hello')
..textDirection = TextDirection.ltr; ..textDirection = TextDirection.ltr;
final RenderConstrainedBox tree = RenderConstrainedBox( final RenderConstrainedBox tree = RenderConstrainedBox(
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
semanticsUpdateCount = 0; semanticsUpdateCount = 0;
// Change semantics and request update. // Change semantics and request update.
testRender.attributedLabel = AttributedString('bye'); testRender.properties = const SemanticsProperties(label: 'bye');
testRender.markNeedsSemanticsUpdate(); testRender.markNeedsSemanticsUpdate();
pumpFrame(phase: EnginePhase.flushSemantics); pumpFrame(phase: EnginePhase.flushSemantics);
...@@ -61,6 +61,8 @@ void main() { ...@@ -61,6 +61,8 @@ void main() {
} }
class TestRender extends RenderSemanticsAnnotations { class TestRender extends RenderSemanticsAnnotations {
TestRender() : super(properties: const SemanticsProperties());
int describeSemanticsConfigurationCallCount = 0; int describeSemanticsConfigurationCallCount = 0;
@override @override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment