Fix TextSpan gc regression (#126382)
`for (final InlineSpan child in children ?? const <InlineSpan>[])` bad Fixes https://github.com/flutter/flutter/issues/126337
This commit is contained in:
@@ -289,12 +289,15 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
|
|||||||
builder.addText('\uFFFD');
|
builder.addText('\uFFFD');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final InlineSpan child in children ?? const <InlineSpan>[]) {
|
final List<InlineSpan>? children = this.children;
|
||||||
child.build(
|
if (children != null) {
|
||||||
builder,
|
for (final InlineSpan child in children) {
|
||||||
textScaleFactor: textScaleFactor,
|
child.build(
|
||||||
dimensions: dimensions,
|
builder,
|
||||||
);
|
textScaleFactor: textScaleFactor,
|
||||||
|
dimensions: dimensions,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasStyle) {
|
if (hasStyle) {
|
||||||
builder.pop();
|
builder.pop();
|
||||||
@@ -311,9 +314,12 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
|
|||||||
if (text != null && !visitor(this)) {
|
if (text != null && !visitor(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (final InlineSpan child in children ?? const <InlineSpan>[]) {
|
final List<InlineSpan>? children = this.children;
|
||||||
if (!child.visitChildren(visitor)) {
|
if (children != null) {
|
||||||
return false;
|
for (final InlineSpan child in children) {
|
||||||
|
if (!child.visitChildren(visitor)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -321,9 +327,12 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool visitDirectChildren(InlineSpanVisitor visitor) {
|
bool visitDirectChildren(InlineSpanVisitor visitor) {
|
||||||
for (final InlineSpan child in children ?? const <InlineSpan>[]) {
|
final List<InlineSpan>? children = this.children;
|
||||||
if (!visitor(child)) {
|
if (children != null) {
|
||||||
return false;
|
for (final InlineSpan child in children) {
|
||||||
|
if (!visitor(child)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -393,15 +402,18 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
|
|||||||
recognizer: recognizer,
|
recognizer: recognizer,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
for (final InlineSpan child in children ?? const <InlineSpan>[]) {
|
final List<InlineSpan>? children = this.children;
|
||||||
if (child is TextSpan) {
|
if (children != null) {
|
||||||
child.computeSemanticsInformation(
|
for (final InlineSpan child in children) {
|
||||||
collector,
|
if (child is TextSpan) {
|
||||||
inheritedLocale: effectiveLocale,
|
child.computeSemanticsInformation(
|
||||||
inheritedSpellOut: effectiveSpellOut,
|
collector,
|
||||||
);
|
inheritedLocale: effectiveLocale,
|
||||||
} else {
|
inheritedSpellOut: effectiveSpellOut,
|
||||||
child.computeSemanticsInformation(collector);
|
);
|
||||||
|
} else {
|
||||||
|
child.computeSemanticsInformation(collector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user