You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new property allows the user to specify a URI for their semantics link node. On the web, it sets the `href` of the anchor element associated with semantics node.
This is going to unlock better semantics support in the Link widget on web ([PR](flutter/packages#6711)).
Engine counterpart: flutter/engine#53507Fixesflutter#150263
Copy file name to clipboardExpand all lines: packages/flutter/lib/src/semantics/semantics.dart
+50-4Lines changed: 50 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -453,6 +453,7 @@ class SemanticsData with Diagnosticable {
453
453
requiredthis.maxValueLength,
454
454
requiredthis.currentValueLength,
455
455
requiredthis.headingLevel,
456
+
requiredthis.linkUrl,
456
457
this.tags,
457
458
this.transform,
458
459
this.customSemanticsActionIds,
@@ -462,7 +463,8 @@ class SemanticsData with Diagnosticable {
462
463
assert(attributedDecreasedValue.string ==''|| textDirection !=null, 'A SemanticsData object with decreasedValue "${attributedDecreasedValue.string}" had a null textDirection.'),
463
464
assert(attributedIncreasedValue.string ==''|| textDirection !=null, 'A SemanticsData object with increasedValue "${attributedIncreasedValue.string}" had a null textDirection.'),
464
465
assert(attributedHint.string ==''|| textDirection !=null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.'),
465
-
assert(headingLevel >=0&& headingLevel <=6, 'Heading level must be between 0 and 6');
466
+
assert(headingLevel >=0&& headingLevel <=6, 'Heading level must be between 0 and 6'),
467
+
assert(linkUrl ==null|| (flags &SemanticsFlag.isLink.index) !=0, 'A SemanticsData object with a linkUrl must have the isLink flag set to true');
466
468
467
469
/// A bit field of [SemanticsFlag]s that apply to this node.
468
470
finalint flags;
@@ -643,6 +645,13 @@ class SemanticsData with Diagnosticable {
643
645
/// be set when [maxValueLength] is set.
644
646
finalint? currentValueLength;
645
647
648
+
/// The URL that this node links to.
649
+
///
650
+
/// See also:
651
+
///
652
+
/// * [SemanticsFlag.isLink], which indicates that this node is a link.
653
+
finalUri? linkUrl;
654
+
646
655
/// The bounding box for this node in its coordinate system.
647
656
finalRect rect;
648
657
@@ -734,6 +743,7 @@ class SemanticsData with Diagnosticable {
0 commit comments