|
|
|
|
@@ -446,6 +446,7 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
required this.platformViewId,
|
|
|
|
|
required this.maxValueLength,
|
|
|
|
|
required this.currentValueLength,
|
|
|
|
|
required this.headingLevel,
|
|
|
|
|
this.tags,
|
|
|
|
|
this.transform,
|
|
|
|
|
this.customSemanticsActionIds,
|
|
|
|
|
@@ -454,7 +455,8 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
assert(attributedValue.string == '' || textDirection != null, 'A SemanticsData object with value "${attributedValue.string}" had a null textDirection.'),
|
|
|
|
|
assert(attributedDecreasedValue.string == '' || textDirection != null, 'A SemanticsData object with decreasedValue "${attributedDecreasedValue.string}" had a null textDirection.'),
|
|
|
|
|
assert(attributedIncreasedValue.string == '' || textDirection != null, 'A SemanticsData object with increasedValue "${attributedIncreasedValue.string}" had a null textDirection.'),
|
|
|
|
|
assert(attributedHint.string == '' || textDirection != null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.');
|
|
|
|
|
assert(attributedHint.string == '' || textDirection != null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.'),
|
|
|
|
|
assert(headingLevel >= 0 && headingLevel <= 6, 'Heading level must be between 0 and 6');
|
|
|
|
|
|
|
|
|
|
/// A bit field of [SemanticsFlag]s that apply to this node.
|
|
|
|
|
final int flags;
|
|
|
|
|
@@ -547,6 +549,12 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
/// The reading direction is given by [textDirection].
|
|
|
|
|
final String tooltip;
|
|
|
|
|
|
|
|
|
|
/// Indicates that this subtree represents a heading.
|
|
|
|
|
///
|
|
|
|
|
/// A value of 0 indicates that it is not a heading. The value should be a
|
|
|
|
|
/// number between 1 and 6, indicating the hierarchical level as a heading.
|
|
|
|
|
final int headingLevel;
|
|
|
|
|
|
|
|
|
|
/// The reading direction for the text in [label], [value],
|
|
|
|
|
/// [increasedValue], [decreasedValue], and [hint].
|
|
|
|
|
final TextDirection? textDirection;
|
|
|
|
|
@@ -719,6 +727,7 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
properties.add(DoubleProperty('scrollExtentMin', scrollExtentMin, defaultValue: null));
|
|
|
|
|
properties.add(DoubleProperty('scrollPosition', scrollPosition, defaultValue: null));
|
|
|
|
|
properties.add(DoubleProperty('scrollExtentMax', scrollExtentMax, defaultValue: null));
|
|
|
|
|
properties.add(IntProperty('headingLevel', headingLevel, defaultValue: 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@@ -748,6 +757,7 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
&& other.transform == transform
|
|
|
|
|
&& other.elevation == elevation
|
|
|
|
|
&& other.thickness == thickness
|
|
|
|
|
&& other.headingLevel == headingLevel
|
|
|
|
|
&& _sortedListsEqual(other.customSemanticsActionIds, customSemanticsActionIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -778,6 +788,7 @@ class SemanticsData with Diagnosticable {
|
|
|
|
|
transform,
|
|
|
|
|
elevation,
|
|
|
|
|
thickness,
|
|
|
|
|
headingLevel,
|
|
|
|
|
customSemanticsActionIds == null ? null : Object.hashAll(customSemanticsActionIds!),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@@ -892,6 +903,7 @@ class SemanticsProperties extends DiagnosticableTree {
|
|
|
|
|
this.button,
|
|
|
|
|
this.link,
|
|
|
|
|
this.header,
|
|
|
|
|
this.headingLevel,
|
|
|
|
|
this.textField,
|
|
|
|
|
this.slider,
|
|
|
|
|
this.keyboardKey,
|
|
|
|
|
@@ -950,7 +962,8 @@ class SemanticsProperties extends DiagnosticableTree {
|
|
|
|
|
assert(value == null || attributedValue == null, 'Only one of value or attributedValue should be provided'),
|
|
|
|
|
assert(increasedValue == null || attributedIncreasedValue == null, 'Only one of increasedValue or attributedIncreasedValue should be provided'),
|
|
|
|
|
assert(decreasedValue == null || attributedDecreasedValue == null, 'Only one of decreasedValue or attributedDecreasedValue should be provided'),
|
|
|
|
|
assert(hint == null || attributedHint == null, 'Only one of hint or attributedHint should be provided');
|
|
|
|
|
assert(hint == null || attributedHint == null, 'Only one of hint or attributedHint should be provided'),
|
|
|
|
|
assert(headingLevel == null || (headingLevel > 0 && headingLevel <= 6), 'Heading level must be between 1 and 6');
|
|
|
|
|
|
|
|
|
|
/// If non-null, indicates that this subtree represents something that can be
|
|
|
|
|
/// in an enabled or disabled state.
|
|
|
|
|
@@ -1362,6 +1375,17 @@ class SemanticsProperties extends DiagnosticableTree {
|
|
|
|
|
/// [Directionality] or an explicit [textDirection] should be provided.
|
|
|
|
|
final String? tooltip;
|
|
|
|
|
|
|
|
|
|
/// The heading level in the DOM document structure.
|
|
|
|
|
///
|
|
|
|
|
/// This is only applied to web semantics and is ignored on other platforms.
|
|
|
|
|
///
|
|
|
|
|
/// Screen readers will use this value to determine which part of the page
|
|
|
|
|
/// structure this heading represents. A level 1 heading, indicated
|
|
|
|
|
/// with aria-level="1", usually indicates the main heading of a page,
|
|
|
|
|
/// a level 2 heading, defined with aria-level="2" the first subsection,
|
|
|
|
|
/// a level 3 is a subsection of that, and so on.
|
|
|
|
|
final int? headingLevel;
|
|
|
|
|
|
|
|
|
|
/// Provides hint values which override the default hints on supported
|
|
|
|
|
/// platforms.
|
|
|
|
|
///
|
|
|
|
|
@@ -2236,7 +2260,8 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
|| _maxValueLength != config._maxValueLength
|
|
|
|
|
|| _currentValueLength != config._currentValueLength
|
|
|
|
|
|| _mergeAllDescendantsIntoThisNode != config.isMergingSemanticsOfDescendants
|
|
|
|
|
|| _areUserActionsBlocked != config.isBlockingUserActions;
|
|
|
|
|
|| _areUserActionsBlocked != config.isBlockingUserActions
|
|
|
|
|
|| _headingLevel != config._headingLevel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TAGS, LABELS, ACTIONS
|
|
|
|
|
@@ -2540,7 +2565,14 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
int? get currentValueLength => _currentValueLength;
|
|
|
|
|
int? _currentValueLength;
|
|
|
|
|
|
|
|
|
|
bool _canPerformAction(SemanticsAction action) => _actions.containsKey(action);
|
|
|
|
|
/// The level of the widget as a heading within the structural hierarchy
|
|
|
|
|
/// of the screen. A value of 1 indicates the highest level of structural
|
|
|
|
|
/// hierarchy. A value of 2 indicates the next level, and so on.
|
|
|
|
|
int get headingLevel => _headingLevel;
|
|
|
|
|
int _headingLevel = _kEmptyConfig._headingLevel;
|
|
|
|
|
|
|
|
|
|
bool _canPerformAction(SemanticsAction action) =>
|
|
|
|
|
_actions.containsKey(action);
|
|
|
|
|
|
|
|
|
|
static final SemanticsConfiguration _kEmptyConfig = SemanticsConfiguration();
|
|
|
|
|
|
|
|
|
|
@@ -2598,6 +2630,7 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
_maxValueLength = config._maxValueLength;
|
|
|
|
|
_currentValueLength = config._currentValueLength;
|
|
|
|
|
_areUserActionsBlocked = config.isBlockingUserActions;
|
|
|
|
|
_headingLevel = config._headingLevel;
|
|
|
|
|
_replaceChildren(childrenInInversePaintOrder ?? const <SemanticsNode>[]);
|
|
|
|
|
|
|
|
|
|
if (mergeAllDescendantsIntoThisNodeValueChanged) {
|
|
|
|
|
@@ -2643,6 +2676,7 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
int? platformViewId = _platformViewId;
|
|
|
|
|
int? maxValueLength = _maxValueLength;
|
|
|
|
|
int? currentValueLength = _currentValueLength;
|
|
|
|
|
int headingLevel = _headingLevel;
|
|
|
|
|
final double elevation = _elevation;
|
|
|
|
|
double thickness = _thickness;
|
|
|
|
|
final Set<int> customSemanticsActionIds = <int>{};
|
|
|
|
|
@@ -2682,6 +2716,8 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
platformViewId ??= node._platformViewId;
|
|
|
|
|
maxValueLength ??= node._maxValueLength;
|
|
|
|
|
currentValueLength ??= node._currentValueLength;
|
|
|
|
|
headingLevel = node._headingLevel;
|
|
|
|
|
|
|
|
|
|
if (identifier == '') {
|
|
|
|
|
identifier = node._identifier;
|
|
|
|
|
}
|
|
|
|
|
@@ -2765,6 +2801,7 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
maxValueLength: maxValueLength,
|
|
|
|
|
currentValueLength: currentValueLength,
|
|
|
|
|
customSemanticsActionIds: customSemanticsActionIds.toList()..sort(),
|
|
|
|
|
headingLevel: headingLevel,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2840,6 +2877,7 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
|
|
|
|
childrenInTraversalOrder: childrenInTraversalOrder,
|
|
|
|
|
childrenInHitTestOrder: childrenInHitTestOrder,
|
|
|
|
|
additionalActions: customSemanticsActionIds ?? _kEmptyCustomSemanticsActionsList,
|
|
|
|
|
headingLevel: data.headingLevel,
|
|
|
|
|
);
|
|
|
|
|
_dirty = false;
|
|
|
|
|
}
|
|
|
|
|
@@ -4711,6 +4749,21 @@ class SemanticsConfiguration {
|
|
|
|
|
_setFlag(SemanticsFlag.isHeader, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Indicates the heading level in the document structure.
|
|
|
|
|
///
|
|
|
|
|
/// This is only used for web semantics, and is ignored on other platforms.
|
|
|
|
|
int get headingLevel => _headingLevel;
|
|
|
|
|
int _headingLevel = 0;
|
|
|
|
|
|
|
|
|
|
set headingLevel(int value) {
|
|
|
|
|
assert(value >= 0 && value <= 6);
|
|
|
|
|
if (value == headingLevel) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_headingLevel = value;
|
|
|
|
|
_hasBeenAnnotated = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Whether the owning [RenderObject] is a slider (true) or not (false).
|
|
|
|
|
bool get isSlider => _hasFlag(SemanticsFlag.isSlider);
|
|
|
|
|
set isSlider(bool value) {
|
|
|
|
|
@@ -5044,7 +5097,8 @@ class SemanticsConfiguration {
|
|
|
|
|
.._currentValueLength = _currentValueLength
|
|
|
|
|
.._actions.addAll(_actions)
|
|
|
|
|
.._customSemanticsActions.addAll(_customSemanticsActions)
|
|
|
|
|
..isBlockingUserActions = isBlockingUserActions;
|
|
|
|
|
..isBlockingUserActions = isBlockingUserActions
|
|
|
|
|
.._headingLevel = _headingLevel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|