Just use SemanticAnnotator instead of Iterable<SemanticAnnotator> (#4813)
This commit is contained in:
parent
839def55ba
commit
3cbb20d176
@ -423,14 +423,14 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticActionHandle
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get hasSemantics => isInteractive;
|
bool get isSemanticBoundary => isInteractive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => _annotate;
|
||||||
yield (SemanticsNode semantics) {
|
|
||||||
|
void _annotate(SemanticsNode semantics) {
|
||||||
if (isInteractive)
|
if (isInteractive)
|
||||||
semantics.addAdjustmentActions();
|
semantics.addAdjustmentActions();
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -263,17 +263,17 @@ abstract class RenderToggleable extends RenderConstrainedBox implements Semantic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get hasSemantics => isInteractive;
|
bool get isSemanticBoundary => isInteractive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => _annotate;
|
||||||
yield (SemanticsNode semantics) {
|
|
||||||
|
void _annotate(SemanticsNode semantics) {
|
||||||
semantics
|
semantics
|
||||||
..hasCheckedState = true
|
..hasCheckedState = true
|
||||||
..isChecked = _value;
|
..isChecked = _value;
|
||||||
if (isInteractive)
|
if (isInteractive)
|
||||||
semantics.addAction(SemanticAction.tap);
|
semantics.addAction(SemanticAction.tap);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -508,13 +508,11 @@ class _SemanticsGeometry {
|
|||||||
abstract class _SemanticsFragment {
|
abstract class _SemanticsFragment {
|
||||||
_SemanticsFragment({
|
_SemanticsFragment({
|
||||||
RenderObject renderObjectOwner,
|
RenderObject renderObjectOwner,
|
||||||
Iterable<SemanticAnnotator> annotators,
|
this.annotator,
|
||||||
List<_SemanticsFragment> children
|
List<_SemanticsFragment> children
|
||||||
}) {
|
}) {
|
||||||
assert(renderObjectOwner != null);
|
assert(renderObjectOwner != null);
|
||||||
_ancestorChain = <RenderObject>[renderObjectOwner];
|
_ancestorChain = <RenderObject>[renderObjectOwner];
|
||||||
if (annotators != null)
|
|
||||||
addAnnotators(annotators);
|
|
||||||
assert(() {
|
assert(() {
|
||||||
if (children == null)
|
if (children == null)
|
||||||
return true;
|
return true;
|
||||||
@ -526,6 +524,8 @@ abstract class _SemanticsFragment {
|
|||||||
_children = children ?? const <_SemanticsFragment>[];
|
_children = children ?? const <_SemanticsFragment>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final SemanticAnnotator annotator;
|
||||||
|
|
||||||
List<RenderObject> _ancestorChain;
|
List<RenderObject> _ancestorChain;
|
||||||
void addAncestor(RenderObject ancestor) {
|
void addAncestor(RenderObject ancestor) {
|
||||||
_ancestorChain.add(ancestor);
|
_ancestorChain.add(ancestor);
|
||||||
@ -533,14 +533,6 @@ abstract class _SemanticsFragment {
|
|||||||
|
|
||||||
RenderObject get renderObjectOwner => _ancestorChain.first;
|
RenderObject get renderObjectOwner => _ancestorChain.first;
|
||||||
|
|
||||||
List<SemanticAnnotator> _annotators;
|
|
||||||
void addAnnotators(Iterable<SemanticAnnotator> moreAnnotators) {
|
|
||||||
if (_annotators == null)
|
|
||||||
_annotators = moreAnnotators is List<SemanticAnnotator> ? moreAnnotators : moreAnnotators.toList();
|
|
||||||
else
|
|
||||||
_annotators.addAll(moreAnnotators);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<_SemanticsFragment> _children;
|
List<_SemanticsFragment> _children;
|
||||||
|
|
||||||
bool _debugCompiled = false;
|
bool _debugCompiled = false;
|
||||||
@ -579,9 +571,9 @@ class _CleanSemanticsFragment extends _SemanticsFragment {
|
|||||||
abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
|
abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
|
||||||
_InterestingSemanticsFragment({
|
_InterestingSemanticsFragment({
|
||||||
RenderObject renderObjectOwner,
|
RenderObject renderObjectOwner,
|
||||||
Iterable<SemanticAnnotator> annotators,
|
SemanticAnnotator annotator,
|
||||||
Iterable<_SemanticsFragment> children
|
Iterable<_SemanticsFragment> children
|
||||||
}) : super(renderObjectOwner: renderObjectOwner, annotators: annotators, children: children);
|
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
|
||||||
|
|
||||||
bool get haveConcreteNode => true;
|
bool get haveConcreteNode => true;
|
||||||
|
|
||||||
@ -590,7 +582,7 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
|
|||||||
assert(!_debugCompiled);
|
assert(!_debugCompiled);
|
||||||
assert(() { _debugCompiled = true; return true; });
|
assert(() { _debugCompiled = true; return true; });
|
||||||
SemanticsNode node = establishSemanticsNode(geometry, currentSemantics, parentSemantics);
|
SemanticsNode node = establishSemanticsNode(geometry, currentSemantics, parentSemantics);
|
||||||
for (SemanticAnnotator annotator in _annotators)
|
if (annotator != null)
|
||||||
annotator(node);
|
annotator(node);
|
||||||
for (_SemanticsFragment child in _children) {
|
for (_SemanticsFragment child in _children) {
|
||||||
assert(child._ancestorChain.last == renderObjectOwner);
|
assert(child._ancestorChain.last == renderObjectOwner);
|
||||||
@ -613,9 +605,9 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
|
|||||||
class _RootSemanticsFragment extends _InterestingSemanticsFragment {
|
class _RootSemanticsFragment extends _InterestingSemanticsFragment {
|
||||||
_RootSemanticsFragment({
|
_RootSemanticsFragment({
|
||||||
RenderObject renderObjectOwner,
|
RenderObject renderObjectOwner,
|
||||||
Iterable<SemanticAnnotator> annotators,
|
SemanticAnnotator annotator,
|
||||||
Iterable<_SemanticsFragment> children
|
Iterable<_SemanticsFragment> children
|
||||||
}) : super(renderObjectOwner: renderObjectOwner, annotators: annotators, children: children);
|
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
||||||
@ -643,9 +635,9 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment {
|
|||||||
class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
|
class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
|
||||||
_ConcreteSemanticsFragment({
|
_ConcreteSemanticsFragment({
|
||||||
RenderObject renderObjectOwner,
|
RenderObject renderObjectOwner,
|
||||||
Iterable<SemanticAnnotator> annotators,
|
SemanticAnnotator annotator,
|
||||||
Iterable<_SemanticsFragment> children
|
Iterable<_SemanticsFragment> children
|
||||||
}) : super(renderObjectOwner: renderObjectOwner, annotators: annotators, children: children);
|
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
||||||
@ -671,9 +663,9 @@ class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
|
|||||||
class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
|
class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
|
||||||
_ImplicitSemanticsFragment({
|
_ImplicitSemanticsFragment({
|
||||||
RenderObject renderObjectOwner,
|
RenderObject renderObjectOwner,
|
||||||
Iterable<SemanticAnnotator> annotators,
|
SemanticAnnotator annotator,
|
||||||
Iterable<_SemanticsFragment> children
|
Iterable<_SemanticsFragment> children
|
||||||
}) : super(renderObjectOwner: renderObjectOwner, annotators: annotators, children: children);
|
}) : super(renderObjectOwner: renderObjectOwner, annotator: annotator, children: children);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get haveConcreteNode => _haveConcreteNode;
|
bool get haveConcreteNode => _haveConcreteNode;
|
||||||
@ -683,7 +675,7 @@ class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
|
|||||||
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
SemanticsNode establishSemanticsNode(_SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics) {
|
||||||
SemanticsNode node;
|
SemanticsNode node;
|
||||||
assert(_haveConcreteNode == null);
|
assert(_haveConcreteNode == null);
|
||||||
_haveConcreteNode = currentSemantics == null && _annotators.isNotEmpty;
|
_haveConcreteNode = currentSemantics == null && annotator != null;
|
||||||
if (haveConcreteNode) {
|
if (haveConcreteNode) {
|
||||||
renderObjectOwner._semantics ??= new SemanticsNode(
|
renderObjectOwner._semantics ??= new SemanticsNode(
|
||||||
handler: renderObjectOwner is SemanticActionHandler ? renderObjectOwner as dynamic : null
|
handler: renderObjectOwner is SemanticActionHandler ? renderObjectOwner as dynamic : null
|
||||||
@ -758,10 +750,9 @@ class _ForkingSemanticsFragment extends _SemanticsFragment {
|
|||||||
/// 3. [flushPaint] visites any render objects that need to paint. During this
|
/// 3. [flushPaint] visites any render objects that need to paint. During this
|
||||||
/// phase, render objects get a chance to record painting commands into
|
/// phase, render objects get a chance to record painting commands into
|
||||||
/// [PictureLayer]s and construct other composited [Layer]s.
|
/// [PictureLayer]s and construct other composited [Layer]s.
|
||||||
/// 4. Finally, if [SemanticsNode.hasListeners] is true, [flushSemantics] will
|
/// 4. Finally, if semantics are enabled, [flushSemantics] will compile the
|
||||||
/// compile the semantics for the render objects. This semantic information
|
/// semantics for the render objects. This semantic information is used by
|
||||||
/// is used by assistive technology to improve the accessibility of the
|
/// assistive technology to improve the accessibility of the render tree.
|
||||||
/// render tree.
|
|
||||||
///
|
///
|
||||||
/// The [RendererBinding] holds the pipeline owner for the render objects that
|
/// The [RendererBinding] holds the pipeline owner for the render objects that
|
||||||
/// are visible on screen. You can create other pipeline owners to manage
|
/// are visible on screen. You can create other pipeline owners to manage
|
||||||
@ -1197,7 +1188,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
_needsPaint = false;
|
_needsPaint = false;
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
}
|
}
|
||||||
if (_needsSemanticsUpdate && hasSemantics) {
|
if (_needsSemanticsUpdate && isSemanticBoundary) {
|
||||||
// Don't enter this block if we've never updated semantics at all;
|
// Don't enter this block if we've never updated semantics at all;
|
||||||
// scheduleInitialSemantics() will handle it
|
// scheduleInitialSemantics() will handle it
|
||||||
_needsSemanticsUpdate = false;
|
_needsSemanticsUpdate = false;
|
||||||
@ -1900,7 +1891,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Whether this RenderObject introduces a new box for accessibility purposes.
|
/// Whether this RenderObject introduces a new box for accessibility purposes.
|
||||||
bool get hasSemantics => false;
|
bool get isSemanticBoundary => false;
|
||||||
|
|
||||||
/// The bounding box, in the local coordinate system, of this
|
/// The bounding box, in the local coordinate system, of this
|
||||||
/// object, for accessibility purposes.
|
/// object, for accessibility purposes.
|
||||||
@ -2024,7 +2015,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
|
|
||||||
_SemanticsFragment _getSemanticsFragment() {
|
_SemanticsFragment _getSemanticsFragment() {
|
||||||
// early-exit if we're not dirty and have our own semantics
|
// early-exit if we're not dirty and have our own semantics
|
||||||
if (!_needsSemanticsUpdate && hasSemantics) {
|
if (!_needsSemanticsUpdate && isSemanticBoundary) {
|
||||||
assert(_semantics != null);
|
assert(_semantics != null);
|
||||||
return new _CleanSemanticsFragment(renderObjectOwner: this);
|
return new _CleanSemanticsFragment(renderObjectOwner: this);
|
||||||
}
|
}
|
||||||
@ -2047,13 +2038,13 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
});
|
});
|
||||||
_needsSemanticsUpdate = false;
|
_needsSemanticsUpdate = false;
|
||||||
_needsSemanticsGeometryUpdate = false;
|
_needsSemanticsGeometryUpdate = false;
|
||||||
Iterable<SemanticAnnotator> annotators = getSemanticAnnotators();
|
SemanticAnnotator annotator = semanticAnnotator;
|
||||||
if (parent is! RenderObject)
|
if (parent is! RenderObject)
|
||||||
return new _RootSemanticsFragment(renderObjectOwner: this, annotators: annotators, children: children);
|
return new _RootSemanticsFragment(renderObjectOwner: this, annotator: annotator, children: children);
|
||||||
if (hasSemantics)
|
if (isSemanticBoundary)
|
||||||
return new _ConcreteSemanticsFragment(renderObjectOwner: this, annotators: annotators, children: children);
|
return new _ConcreteSemanticsFragment(renderObjectOwner: this, annotator: annotator, children: children);
|
||||||
if (annotators.isNotEmpty)
|
if (annotator != null)
|
||||||
return new _ImplicitSemanticsFragment(renderObjectOwner: this, annotators: annotators, children: children);
|
return new _ImplicitSemanticsFragment(renderObjectOwner: this, annotator: annotator, children: children);
|
||||||
_semantics = null;
|
_semantics = null;
|
||||||
if (children == null)
|
if (children == null)
|
||||||
return null;
|
return null;
|
||||||
@ -2098,7 +2089,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
/// non-zero, and hasSemantics isn't true, then the associated call
|
/// non-zero, and hasSemantics isn't true, then the associated call
|
||||||
/// to markNeedsSemanticsUpdate() must not have 'onlyChanges' set, as
|
/// to markNeedsSemanticsUpdate() must not have 'onlyChanges' set, as
|
||||||
/// it is possible that the node should be entirely removed.
|
/// it is possible that the node should be entirely removed.
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* { }
|
SemanticAnnotator get semanticAnnotator => null;
|
||||||
|
|
||||||
|
|
||||||
// EVENTS
|
// EVENTS
|
||||||
|
@ -231,10 +231,10 @@ class RenderParagraph extends RenderBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => _annotate;
|
||||||
yield (SemanticsNode node) {
|
|
||||||
|
void _annotate(SemanticsNode node) {
|
||||||
node.label = text.toPlainText();
|
node.label = text.toPlainText();
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2054,11 +2054,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
set onTap(GestureTapCallback value) {
|
set onTap(GestureTapCallback value) {
|
||||||
if (_onTap == value)
|
if (_onTap == value)
|
||||||
return;
|
return;
|
||||||
bool didHaveSemantics = hasSemantics;
|
bool wasSemanticBoundary = isSemanticBoundary;
|
||||||
bool hadHandler = _onTap != null;
|
bool hadHandler = _onTap != null;
|
||||||
_onTap = value;
|
_onTap = value;
|
||||||
if ((value != null) != hadHandler)
|
if ((value != null) != hadHandler)
|
||||||
markNeedsSemanticsUpdate(onlyChanges: hasSemantics == didHaveSemantics);
|
markNeedsSemanticsUpdate(onlyChanges: isSemanticBoundary == wasSemanticBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the user presses on the render object for a long period of time.
|
/// Called when the user presses on the render object for a long period of time.
|
||||||
@ -2067,11 +2067,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
set onLongPress(GestureLongPressCallback value) {
|
set onLongPress(GestureLongPressCallback value) {
|
||||||
if (_onLongPress == value)
|
if (_onLongPress == value)
|
||||||
return;
|
return;
|
||||||
bool didHaveSemantics = hasSemantics;
|
bool wasSemanticBoundary = isSemanticBoundary;
|
||||||
bool hadHandler = _onLongPress != null;
|
bool hadHandler = _onLongPress != null;
|
||||||
_onLongPress = value;
|
_onLongPress = value;
|
||||||
if ((value != null) != hadHandler)
|
if ((value != null) != hadHandler)
|
||||||
markNeedsSemanticsUpdate(onlyChanges: hasSemantics == didHaveSemantics);
|
markNeedsSemanticsUpdate(onlyChanges: isSemanticBoundary == wasSemanticBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the user scrolls to the left or to the right.
|
/// Called when the user scrolls to the left or to the right.
|
||||||
@ -2080,11 +2080,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
set onHorizontalDragUpdate(GestureDragUpdateCallback value) {
|
set onHorizontalDragUpdate(GestureDragUpdateCallback value) {
|
||||||
if (_onHorizontalDragUpdate == value)
|
if (_onHorizontalDragUpdate == value)
|
||||||
return;
|
return;
|
||||||
bool didHaveSemantics = hasSemantics;
|
bool wasSemanticBoundary = isSemanticBoundary;
|
||||||
bool hadHandler = _onHorizontalDragUpdate != null;
|
bool hadHandler = _onHorizontalDragUpdate != null;
|
||||||
_onHorizontalDragUpdate = value;
|
_onHorizontalDragUpdate = value;
|
||||||
if ((value != null) != hadHandler)
|
if ((value != null) != hadHandler)
|
||||||
markNeedsSemanticsUpdate(onlyChanges: hasSemantics == didHaveSemantics);
|
markNeedsSemanticsUpdate(onlyChanges: isSemanticBoundary == wasSemanticBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the user scrolls up or down.
|
/// Called when the user scrolls up or down.
|
||||||
@ -2093,11 +2093,11 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
set onVerticalDragUpdate(GestureDragUpdateCallback value) {
|
set onVerticalDragUpdate(GestureDragUpdateCallback value) {
|
||||||
if (_onVerticalDragUpdate == value)
|
if (_onVerticalDragUpdate == value)
|
||||||
return;
|
return;
|
||||||
bool didHaveSemantics = hasSemantics;
|
bool wasSemanticBoundary = isSemanticBoundary;
|
||||||
bool hadHandler = _onVerticalDragUpdate != null;
|
bool hadHandler = _onVerticalDragUpdate != null;
|
||||||
_onVerticalDragUpdate = value;
|
_onVerticalDragUpdate = value;
|
||||||
if ((value != null) != hadHandler)
|
if ((value != null) != hadHandler)
|
||||||
markNeedsSemanticsUpdate(onlyChanges: hasSemantics == didHaveSemantics);
|
markNeedsSemanticsUpdate(onlyChanges: isSemanticBoundary == wasSemanticBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The fraction of the dimension of this render box to use when
|
/// The fraction of the dimension of this render box to use when
|
||||||
@ -2108,7 +2108,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
double scrollFactor;
|
double scrollFactor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get hasSemantics {
|
bool get isSemanticBoundary {
|
||||||
return onTap != null
|
return onTap != null
|
||||||
|| onLongPress != null
|
|| onLongPress != null
|
||||||
|| onHorizontalDragUpdate != null
|
|| onHorizontalDragUpdate != null
|
||||||
@ -2116,19 +2116,17 @@ class RenderSemanticsGestureHandler extends RenderProxyBox implements SemanticAc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => isSemanticBoundary ? _annotate : null;
|
||||||
if (hasSemantics) {
|
|
||||||
yield (SemanticsNode semantics) {
|
void _annotate(SemanticsNode node) {
|
||||||
if (onTap != null)
|
if (onTap != null)
|
||||||
semantics.addAction(SemanticAction.tap);
|
node.addAction(SemanticAction.tap);
|
||||||
if (onLongPress != null)
|
if (onLongPress != null)
|
||||||
semantics.addAction(SemanticAction.longPress);
|
node.addAction(SemanticAction.longPress);
|
||||||
if (onHorizontalDragUpdate != null)
|
if (onHorizontalDragUpdate != null)
|
||||||
semantics.addHorizontalScrollingActions();
|
node.addHorizontalScrollingActions();
|
||||||
if (onVerticalDragUpdate != null)
|
if (onVerticalDragUpdate != null)
|
||||||
semantics.addVerticalScrollingActions();
|
node.addVerticalScrollingActions();
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -2243,21 +2241,19 @@ class RenderSemanticAnnotations extends RenderProxyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get hasSemantics => container;
|
bool get isSemanticBoundary => container;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => checked != null || label != null ? _annotate : null;
|
||||||
|
|
||||||
|
void _annotate(SemanticsNode node) {
|
||||||
if (checked != null) {
|
if (checked != null) {
|
||||||
yield (SemanticsNode semantics) {
|
node
|
||||||
semantics.hasCheckedState = true;
|
..hasCheckedState = true
|
||||||
semantics.isChecked = checked;
|
..isChecked = checked;
|
||||||
};
|
|
||||||
}
|
|
||||||
if (label != null) {
|
|
||||||
yield (SemanticsNode semantics) {
|
|
||||||
semantics.label = label;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
if (label != null)
|
||||||
|
node.label = label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2273,8 +2269,10 @@ class RenderMergeSemantics extends RenderProxyBox {
|
|||||||
RenderMergeSemantics({ RenderBox child }) : super(child);
|
RenderMergeSemantics({ RenderBox child }) : super(child);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Iterable<SemanticAnnotator> getSemanticAnnotators() sync* {
|
SemanticAnnotator get semanticAnnotator => _annotate;
|
||||||
yield (SemanticsNode node) { node.mergeAllDescendantsIntoThisNode = true; };
|
|
||||||
|
void _annotate(SemanticsNode node) {
|
||||||
|
node.mergeAllDescendantsIntoThisNode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user