absorb method
- SemanticsConfiguration child
Absorb the semantic information from child
into this configuration.
This adds the semantic information of both configurations and saves the result in this configuration.
The RenderObject owning the child
configuration must be a descendant
of the RenderObject that owns this configuration.
Only configurations that have explicitChildNodes set to false can absorb other configurations and it is recommended to only absorb compatible configurations as determined by isCompatibleWith.
Implementation
void absorb(SemanticsConfiguration child) {
assert(!explicitChildNodes);
if (!child.hasBeenAnnotated) {
return;
}
if (child.isBlockingUserActions) {
child._actions.forEach((SemanticsAction key, SemanticsActionHandler value) {
if (_kUnblockedUserActions & key.index > 0) {
_actions[key] = value;
}
});
} else {
_actions.addAll(child._actions);
}
_actionsAsBits |= child._effectiveActionsAsBits;
_customSemanticsActions.addAll(child._customSemanticsActions);
_flags |= child._flags;
_textSelection ??= child._textSelection;
_scrollPosition ??= child._scrollPosition;
_scrollExtentMax ??= child._scrollExtentMax;
_scrollExtentMin ??= child._scrollExtentMin;
_hintOverrides ??= child._hintOverrides;
_indexInParent ??= child.indexInParent;
_scrollIndex ??= child._scrollIndex;
_scrollChildCount ??= child._scrollChildCount;
_platformViewId ??= child._platformViewId;
_maxValueLength ??= child._maxValueLength;
_currentValueLength ??= child._currentValueLength;
textDirection ??= child.textDirection;
_sortKey ??= child._sortKey;
if (_identifier == '') {
_identifier = child._identifier;
}
_attributedLabel = _concatAttributedString(
thisAttributedString: _attributedLabel,
thisTextDirection: textDirection,
otherAttributedString: child._attributedLabel,
otherTextDirection: child.textDirection,
);
if (_attributedValue.string == '') {
_attributedValue = child._attributedValue;
}
if (_attributedIncreasedValue.string == '') {
_attributedIncreasedValue = child._attributedIncreasedValue;
}
if (_attributedDecreasedValue.string == '') {
_attributedDecreasedValue = child._attributedDecreasedValue;
}
_attributedHint = _concatAttributedString(
thisAttributedString: _attributedHint,
thisTextDirection: textDirection,
otherAttributedString: child._attributedHint,
otherTextDirection: child.textDirection,
);
if (_tooltip == '') {
_tooltip = child._tooltip;
}
_thickness = math.max(_thickness, child._thickness + child._elevation);
_hasBeenAnnotated = _hasBeenAnnotated || child._hasBeenAnnotated;
}