Adds tooltip to semantics node (#87684)
This commit is contained in:
@@ -228,7 +228,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline {
|
||||
!data.hasAction(ui.SemanticsAction.tap)) {
|
||||
return result;
|
||||
}
|
||||
if (data.label == null || data.label.isEmpty) {
|
||||
if ((data.label == null || data.label.isEmpty) && (data.tooltip == null || data.tooltip.isEmpty)) {
|
||||
result += Evaluation.fail(
|
||||
'$node: expected tappable node to have semantic label, '
|
||||
'but none was found.\n',
|
||||
|
||||
@@ -494,6 +494,7 @@ Matcher matchesSemantics({
|
||||
String? increasedValue,
|
||||
AttributedString? attributedIncreasedValue,
|
||||
String? decreasedValue,
|
||||
String? tooltip,
|
||||
AttributedString? attributedDecreasedValue,
|
||||
TextDirection? textDirection,
|
||||
Rect? rect,
|
||||
@@ -625,6 +626,7 @@ Matcher matchesSemantics({
|
||||
value: value,
|
||||
attributedValue: attributedValue,
|
||||
increasedValue: increasedValue,
|
||||
tooltip: tooltip,
|
||||
attributedIncreasedValue: attributedIncreasedValue,
|
||||
decreasedValue: decreasedValue,
|
||||
attributedDecreasedValue: attributedDecreasedValue,
|
||||
@@ -1783,6 +1785,7 @@ class _MatchesSemanticsData extends Matcher {
|
||||
this.attributedIncreasedValue,
|
||||
this.decreasedValue,
|
||||
this.attributedDecreasedValue,
|
||||
this.tooltip,
|
||||
this.flags,
|
||||
this.actions,
|
||||
this.textDirection,
|
||||
@@ -1808,6 +1811,7 @@ class _MatchesSemanticsData extends Matcher {
|
||||
final AttributedString? attributedIncreasedValue;
|
||||
final String? decreasedValue;
|
||||
final AttributedString? attributedDecreasedValue;
|
||||
final String? tooltip;
|
||||
final SemanticsHintOverrides? hintOverrides;
|
||||
final List<SemanticsAction>? actions;
|
||||
final List<CustomSemanticsAction>? customActions;
|
||||
@@ -1845,6 +1849,8 @@ class _MatchesSemanticsData extends Matcher {
|
||||
description.add(' with decreasedValue: $decreasedValue ');
|
||||
if (attributedDecreasedValue != null)
|
||||
description.add(' with attributedDecreasedValue: $attributedDecreasedValue');
|
||||
if (tooltip != null)
|
||||
description.add(' with tooltip: $tooltip');
|
||||
if (actions != null)
|
||||
description.add(' with actions: ').addDescriptionOf(actions);
|
||||
if (flags != null)
|
||||
@@ -1942,6 +1948,8 @@ class _MatchesSemanticsData extends Matcher {
|
||||
return failWithDescription(
|
||||
matchState, 'attributedDecreasedValue was: ${data.attributedDecreasedValue}');
|
||||
}
|
||||
if (tooltip != null && tooltip != data.tooltip)
|
||||
return failWithDescription(matchState, 'tooltip was: ${data.tooltip}');
|
||||
if (textDirection != null && textDirection != data.textDirection)
|
||||
return failWithDescription(matchState, 'textDirection was: $textDirection');
|
||||
if (rect != null && rect != data.rect)
|
||||
|
||||
@@ -566,6 +566,7 @@ void main() {
|
||||
attributedValue: AttributedString('c'),
|
||||
attributedDecreasedValue: AttributedString('d'),
|
||||
attributedHint: AttributedString('e'),
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
|
||||
Reference in New Issue
Block a user