Unverified Commit 74e51821 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Remove span deprecations (#73747)

parent 5af0429f
...@@ -156,32 +156,6 @@ abstract class InlineSpan extends DiagnosticableTree { ...@@ -156,32 +156,6 @@ abstract class InlineSpan extends DiagnosticableTree {
/// of [TextSpan]. /// of [TextSpan].
final TextStyle? style; 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 /// Apply the properties of this object to the given [ParagraphBuilder], from
/// which a [Paragraph] can be obtained. /// which a [Paragraph] can be obtained.
/// ///
...@@ -196,18 +170,6 @@ abstract class InlineSpan extends DiagnosticableTree { ...@@ -196,18 +170,6 @@ abstract class InlineSpan extends DiagnosticableTree {
/// [Paragraph] objects can be drawn on [Canvas] objects. /// [Paragraph] objects can be drawn on [Canvas] objects.
void build(ui.ParagraphBuilder builder, { double textScaleFactor = 1.0, List<PlaceholderDimensions>? dimensions }); 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` /// Walks this [InlineSpan] and any descendants in pre-order and calls `visitor`
/// for each span that has content. /// for each span that has content.
/// ///
...@@ -319,21 +281,6 @@ abstract class InlineSpan extends DiagnosticableTree { ...@@ -319,21 +281,6 @@ abstract class InlineSpan extends DiagnosticableTree {
@protected @protected
int? codeUnitAtVisitor(int index, Accumulator offset); 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 /// In checked mode, throws an exception if the object is not in a
/// valid configuration. Otherwise, returns true. /// valid configuration. Otherwise, returns true.
/// ///
......
...@@ -66,18 +66,6 @@ abstract class PlaceholderSpan extends InlineSpan { ...@@ -66,18 +66,6 @@ abstract class PlaceholderSpan extends InlineSpan {
collector.add(InlineSpanSemanticsInformation.placeholder); 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 /// Populates the `semanticsOffsets` and `semanticsElements` with the appropriate data
/// to be able to construct a [SemanticsNode]. /// to be able to construct a [SemanticsNode].
/// ///
...@@ -85,7 +73,6 @@ abstract class PlaceholderSpan extends InlineSpan { ...@@ -85,7 +73,6 @@ abstract class PlaceholderSpan extends InlineSpan {
/// replacement character (0xFFFC) that is inserted to represent it. /// replacement character (0xFFFC) that is inserted to represent it.
/// ///
/// Null is added to `semanticsElements` for [PlaceholderSpan]s. /// Null is added to `semanticsElements` for [PlaceholderSpan]s.
@override
void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) { void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
semanticsOffsets.add(offset.value); semanticsOffsets.add(offset.value);
semanticsOffsets.add(offset.value + 1); semanticsOffsets.add(offset.value + 1);
......
...@@ -79,7 +79,6 @@ class TextSpan extends InlineSpan { ...@@ -79,7 +79,6 @@ class TextSpan extends InlineSpan {
/// children. /// children.
/// ///
/// This getter does not include the contents of its children. /// This getter does not include the contents of its children.
@override
final String? text; final String? text;
...@@ -92,7 +91,6 @@ class TextSpan extends InlineSpan { ...@@ -92,7 +91,6 @@ class TextSpan extends InlineSpan {
/// and may have unexpected results. /// and may have unexpected results.
/// ///
/// The list must not contain any nulls. /// The list must not contain any nulls.
@override
final List<InlineSpan>? children; final List<InlineSpan>? children;
/// A gesture recognizer that will receive events that hit this span. /// A gesture recognizer that will receive events that hit this span.
...@@ -170,7 +168,6 @@ class TextSpan extends InlineSpan { ...@@ -170,7 +168,6 @@ class TextSpan extends InlineSpan {
/// } /// }
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
@override
final GestureRecognizer? recognizer; final GestureRecognizer? recognizer;
/// An alternative semantics label for this [TextSpan]. /// An alternative semantics label for this [TextSpan].
...@@ -239,36 +236,6 @@ class TextSpan extends InlineSpan { ...@@ -239,36 +236,6 @@ class TextSpan extends InlineSpan {
return true; 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. /// Returns the text span that contains the given position in the text.
@override @override
InlineSpan? getSpanForPositionVisitor(TextPosition position, Accumulator offset) { InlineSpan? getSpanForPositionVisitor(TextPosition position, Accumulator offset) {
...@@ -338,7 +305,15 @@ class TextSpan extends InlineSpan { ...@@ -338,7 +305,15 @@ class TextSpan extends InlineSpan {
return null; 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) { void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
if ( if (
recognizer != null && recognizer != null &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment