Remove span deprecations (#73747)
This commit is contained in:
@@ -156,32 +156,6 @@ abstract class InlineSpan extends DiagnosticableTree {
|
||||
/// of [TextSpan].
|
||||
final TextStyle? style;
|
||||
|
||||
// TODO(garyq): Remove the deprecated visitTextSpan, text, and children.
|
||||
/// Returns the text associated with this span if this is an instance of [TextSpan],
|
||||
/// otherwise returns null.
|
||||
@Deprecated(
|
||||
'InlineSpan does not innately have text. Use TextSpan.text instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
String? get text => null;
|
||||
|
||||
// TODO(garyq): Remove the deprecated visitTextSpan, text, and children.
|
||||
/// Returns the [InlineSpan] children list associated with this span if this is an
|
||||
/// instance of [TextSpan], otherwise returns null.
|
||||
@Deprecated(
|
||||
'InlineSpan does not innately have children. Use TextSpan.children instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
List<InlineSpan>? get children => null;
|
||||
|
||||
/// Returns the [GestureRecognizer] associated with this span if this is an
|
||||
/// instance of [TextSpan], otherwise returns null.
|
||||
@Deprecated(
|
||||
'InlineSpan does not innately have a recognizer. Use TextSpan.recognizer instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
GestureRecognizer? get recognizer => null;
|
||||
|
||||
/// Apply the properties of this object to the given [ParagraphBuilder], from
|
||||
/// which a [Paragraph] can be obtained.
|
||||
///
|
||||
@@ -196,18 +170,6 @@ abstract class InlineSpan extends DiagnosticableTree {
|
||||
/// [Paragraph] objects can be drawn on [Canvas] objects.
|
||||
void build(ui.ParagraphBuilder builder, { double textScaleFactor = 1.0, List<PlaceholderDimensions>? dimensions });
|
||||
|
||||
// TODO(garyq): Remove the deprecated visitTextSpan, text, and children.
|
||||
/// Walks this [TextSpan] and any descendants in pre-order and calls `visitor`
|
||||
/// for each span that has content.
|
||||
///
|
||||
/// When `visitor` returns true, the walk will continue. When `visitor` returns
|
||||
/// false, then the walk will end.
|
||||
@Deprecated(
|
||||
'Use visitChildren instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
bool visitTextSpan(bool visitor(TextSpan span));
|
||||
|
||||
/// Walks this [InlineSpan] and any descendants in pre-order and calls `visitor`
|
||||
/// for each span that has content.
|
||||
///
|
||||
@@ -319,21 +281,6 @@ abstract class InlineSpan extends DiagnosticableTree {
|
||||
@protected
|
||||
int? codeUnitAtVisitor(int index, Accumulator offset);
|
||||
|
||||
/// Populates the `semanticsOffsets` and `semanticsElements` with the appropriate data
|
||||
/// to be able to construct a [SemanticsNode].
|
||||
///
|
||||
/// If applicable, the beginning and end text offset are added to [semanticsOffsets].
|
||||
/// [PlaceholderSpan]s have a text length of 1, which corresponds to the object
|
||||
/// replacement character (0xFFFC) that is inserted to represent it.
|
||||
///
|
||||
/// Any [GestureRecognizer]s are added to `semanticsElements`. Null is added to
|
||||
/// `semanticsElements` for [PlaceholderSpan]s.
|
||||
@Deprecated(
|
||||
'Implement computeSemanticsInformation instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements);
|
||||
|
||||
/// In checked mode, throws an exception if the object is not in a
|
||||
/// valid configuration. Otherwise, returns true.
|
||||
///
|
||||
|
||||
@@ -66,18 +66,6 @@ abstract class PlaceholderSpan extends InlineSpan {
|
||||
collector.add(InlineSpanSemanticsInformation.placeholder);
|
||||
}
|
||||
|
||||
// TODO(garyq): Remove this after next stable release.
|
||||
/// The [visitTextSpan] method is invalid on [PlaceholderSpan]s.
|
||||
@override
|
||||
@Deprecated(
|
||||
'Use to visitChildren instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
bool visitTextSpan(bool visitor(TextSpan span)) {
|
||||
assert(false, 'visitTextSpan is deprecated. Use visitChildren to support InlineSpans');
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Populates the `semanticsOffsets` and `semanticsElements` with the appropriate data
|
||||
/// to be able to construct a [SemanticsNode].
|
||||
///
|
||||
@@ -85,7 +73,6 @@ abstract class PlaceholderSpan extends InlineSpan {
|
||||
/// replacement character (0xFFFC) that is inserted to represent it.
|
||||
///
|
||||
/// Null is added to `semanticsElements` for [PlaceholderSpan]s.
|
||||
@override
|
||||
void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
|
||||
semanticsOffsets.add(offset.value);
|
||||
semanticsOffsets.add(offset.value + 1);
|
||||
|
||||
@@ -79,7 +79,6 @@ class TextSpan extends InlineSpan {
|
||||
/// children.
|
||||
///
|
||||
/// This getter does not include the contents of its children.
|
||||
@override
|
||||
final String? text;
|
||||
|
||||
|
||||
@@ -92,7 +91,6 @@ class TextSpan extends InlineSpan {
|
||||
/// and may have unexpected results.
|
||||
///
|
||||
/// The list must not contain any nulls.
|
||||
@override
|
||||
final List<InlineSpan>? children;
|
||||
|
||||
/// A gesture recognizer that will receive events that hit this span.
|
||||
@@ -170,7 +168,6 @@ class TextSpan extends InlineSpan {
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
@override
|
||||
final GestureRecognizer? recognizer;
|
||||
|
||||
/// An alternative semantics label for this [TextSpan].
|
||||
@@ -239,36 +236,6 @@ class TextSpan extends InlineSpan {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(garyq): Remove this after next stable release.
|
||||
/// Walks this [TextSpan] and any descendants in pre-order and calls `visitor`
|
||||
/// for each span that has content.
|
||||
///
|
||||
/// When `visitor` returns true, the walk will continue. When `visitor`
|
||||
/// returns false, then the walk will end.
|
||||
@override
|
||||
@Deprecated(
|
||||
'Use to visitChildren instead. '
|
||||
'This feature was deprecated after v1.7.3.'
|
||||
)
|
||||
bool visitTextSpan(bool visitor(TextSpan span)) {
|
||||
if (text != null) {
|
||||
if (!visitor(this))
|
||||
return false;
|
||||
}
|
||||
if (children != null) {
|
||||
for (final InlineSpan child in children!) {
|
||||
assert(
|
||||
child is TextSpan,
|
||||
'visitTextSpan is deprecated. Use visitChildren to support InlineSpans',
|
||||
);
|
||||
final TextSpan textSpanChild = child as TextSpan;
|
||||
if (!textSpanChild.visitTextSpan(visitor))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns the text span that contains the given position in the text.
|
||||
@override
|
||||
InlineSpan? getSpanForPositionVisitor(TextPosition position, Accumulator offset) {
|
||||
@@ -338,7 +305,15 @@ class TextSpan extends InlineSpan {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
/// Populates the `semanticsOffsets` and `semanticsElements` with the appropriate data
|
||||
/// to be able to construct a [SemanticsNode].
|
||||
///
|
||||
/// If applicable, the beginning and end text offset are added to [semanticsOffsets].
|
||||
/// [PlaceholderSpan]s have a text length of 1, which corresponds to the object
|
||||
/// replacement character (0xFFFC) that is inserted to represent it.
|
||||
///
|
||||
/// Any [GestureRecognizer]s are added to `semanticsElements`. Null is added to
|
||||
/// `semanticsElements` for [PlaceholderSpan]s.
|
||||
void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
|
||||
if (
|
||||
recognizer != null &&
|
||||
|
||||
Reference in New Issue
Block a user