mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
This reverts commit 160a5680ae
.
This commit is contained in:
parent
926bc6231a
commit
3dd87ff78e
@ -8,7 +8,6 @@ import 'package:flutter/foundation.dart';
|
|||||||
|
|
||||||
import 'basic_types.dart';
|
import 'basic_types.dart';
|
||||||
import 'text_painter.dart';
|
import 'text_painter.dart';
|
||||||
import 'text_span.dart';
|
|
||||||
import 'text_style.dart';
|
import 'text_style.dart';
|
||||||
|
|
||||||
/// Mutable wrapper of an integer that can be passed by reference to track a
|
/// Mutable wrapper of an integer that can be passed by reference to track a
|
||||||
@ -104,15 +103,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 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.
|
|
||||||
@Deprecated('Use to visitChildren instead')
|
|
||||||
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.
|
||||||
///
|
///
|
||||||
|
@ -60,15 +60,6 @@ abstract class PlaceholderSpan extends InlineSpan {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(garyq): Remove this after next stable release.
|
|
||||||
/// The [visitTextSpan] method is invalid on [PlaceholderSpan]s
|
|
||||||
@override
|
|
||||||
@Deprecated('Use to visitChildren instead')
|
|
||||||
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].
|
||||||
///
|
///
|
||||||
|
@ -164,13 +164,8 @@ class TextPainter {
|
|||||||
/// The (potentially styled) text to paint.
|
/// The (potentially styled) text to paint.
|
||||||
///
|
///
|
||||||
/// After this is set, you must call [layout] before the next call to [paint].
|
/// After this is set, you must call [layout] before the next call to [paint].
|
||||||
/// This and [textDirection] must be non-null before you call [layout].
|
|
||||||
///
|
///
|
||||||
/// The [InlineSpan] this provides is in the form of a tree that may contain
|
/// This and [textDirection] must be non-null before you call [layout].
|
||||||
/// multiple instances of [TextSpan]s and [WidgetSpan]s. To obtain a plaintext
|
|
||||||
/// representation of the contents of this [TextPainter], use [InlineSpan.toPlainText]
|
|
||||||
/// to get the full contents of all nodes in the tree. [TextSpan.text] will
|
|
||||||
/// only provide the contents of the first node in the tree.
|
|
||||||
InlineSpan get text => _text;
|
InlineSpan get text => _text;
|
||||||
InlineSpan _text;
|
InlineSpan _text;
|
||||||
set text(InlineSpan value) {
|
set text(InlineSpan value) {
|
||||||
|
@ -205,11 +205,8 @@ class TextSpan extends InlineSpan {
|
|||||||
builder.pop();
|
builder.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Walks this [TextSpan] and its descendants in pre-order and calls [visitor]
|
/// Walks this text span and its descendants in pre-order and calls [visitor]
|
||||||
/// for each span that has text.
|
/// for each span that has text.
|
||||||
///
|
|
||||||
/// When `visitor` returns true, the walk will continue. When `visitor` returns
|
|
||||||
/// false, then the walk will end.
|
|
||||||
@override
|
@override
|
||||||
bool visitChildren(InlineSpanVisitor visitor) {
|
bool visitChildren(InlineSpanVisitor visitor) {
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
@ -225,30 +222,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')
|
|
||||||
bool visitTextSpan(bool visitor(TextSpan span)) {
|
|
||||||
if (text != null) {
|
|
||||||
if (!visitor(this))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (children != null) {
|
|
||||||
for (InlineSpan child in children) {
|
|
||||||
assert(child is TextSpan, 'visitTextSpan is deprecated. Use visitChildren to support InlineSpans');
|
|
||||||
final TextSpan textSpanChild = child;
|
|
||||||
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user