@@ -63,37 +63,46 @@ class ExtendedRenderParagraph extends _RenderParagraph
6363 }
6464
6565 static PlaceholderDimensions _layoutChild (
66- RenderBox child,
67- BoxConstraints childConstraints,
68- ChildLayouter layoutChild,
69- ChildBaselineGetter getBaseline) {
66+ RenderBox child,
67+ BoxConstraints childConstraints,
68+ ChildLayouter layoutChild,
69+ ChildBaselineGetter getBaseline,
70+ ) {
7071 final TextParentData parentData = child.parentData! as TextParentData ;
7172 final PlaceholderSpan ? span = parentData.span;
7273 assert (span != null );
7374 return span == null
7475 ? PlaceholderDimensions .empty
7576 : PlaceholderDimensions (
76- size: layoutChild (child, childConstraints),
77- alignment: span.alignment,
78- baseline: span.baseline,
79- baselineOffset: switch (span.alignment) {
80- ui.PlaceholderAlignment .aboveBaseline ||
81- ui.PlaceholderAlignment .belowBaseline ||
82- ui.PlaceholderAlignment .bottom ||
83- ui.PlaceholderAlignment .middle ||
84- ui.PlaceholderAlignment .top =>
85- null ,
86- ui.PlaceholderAlignment .baseline =>
87- getBaseline (child, childConstraints, span.baseline! ),
88- },
89- );
77+ size: layoutChild (child, childConstraints),
78+ alignment: span.alignment,
79+ baseline: span.baseline,
80+ baselineOffset: switch (span.alignment) {
81+ ui.PlaceholderAlignment .aboveBaseline ||
82+ ui.PlaceholderAlignment .belowBaseline ||
83+ ui.PlaceholderAlignment .bottom ||
84+ ui.PlaceholderAlignment .middle ||
85+ ui.PlaceholderAlignment .top => null ,
86+ ui.PlaceholderAlignment .baseline => getBaseline (
87+ child,
88+ childConstraints,
89+ span.baseline! ,
90+ ),
91+ },
92+ );
9093 }
9194
9295 @override
9396 void performLayout () {
97+ _lastSelectableFragments? .forEach (
98+ (_SelectableFragment element) => element.didChangeParagraphLayout (),
99+ );
94100 final BoxConstraints constraints = this .constraints;
95- _placeholderDimensions = layoutInlineChildren (constraints.maxWidth,
96- ChildLayoutHelper .layoutChild, ChildLayoutHelper .getBaseline);
101+ _placeholderDimensions = layoutInlineChildren (
102+ constraints.maxWidth,
103+ ChildLayoutHelper .layoutChild,
104+ ChildLayoutHelper .getBaseline,
105+ );
97106 _layoutTextWithConstraints (constraints);
98107 positionInlineChildren (_textPainter.inlinePlaceholderBoxes! );
99108
@@ -132,9 +141,9 @@ class ExtendedRenderParagraph extends _RenderParagraph
132141 final (double fadeStart, double fadeEnd) = switch (textDirection) {
133142 TextDirection .rtl => (fadeSizePainter.width, 0.0 ),
134143 TextDirection .ltr => (
135- size.width - fadeSizePainter.width,
136- size.width
137- ),
144+ size.width - fadeSizePainter.width,
145+ size.width,
146+ ),
138147 };
139148 _overflowShader = ui.Gradient .linear (
140149 Offset (fadeStart, 0.0 ),
@@ -263,13 +272,17 @@ class ExtendedRenderParagraph extends _RenderParagraph
263272 if (_overflowClipTextRects != null ) {
264273 for (final Rect rect in _overflowClipTextRects! ) {
265274 context.canvas.drawRect (
266- rect.shift (offset), Paint ()..blendMode = BlendMode .clear);
275+ rect.shift (offset),
276+ Paint ()..blendMode = BlendMode .clear,
277+ );
267278 }
268279 }
269280 if (_overflowRects != null ) {
270281 for (final Rect rect in _overflowRects! ) {
271282 context.canvas.drawRect (
272- rect.shift (offset), Paint ()..blendMode = BlendMode .clear);
283+ rect.shift (offset),
284+ Paint ()..blendMode = BlendMode .clear,
285+ );
273286 }
274287 }
275288 }
@@ -280,8 +293,10 @@ class ExtendedRenderParagraph extends _RenderParagraph
280293 overflowWidget != null &&
281294 overflowWidget! .debugOverflowRectColor != null ) {
282295 for (final ui.Rect rect in _overflowRects! ) {
283- context.canvas.drawRect (rect.shift (offset),
284- Paint ()..color = overflowWidget! .debugOverflowRectColor! );
296+ context.canvas.drawRect (
297+ rect.shift (offset),
298+ Paint ()..color = overflowWidget! .debugOverflowRectColor! ,
299+ );
285300 }
286301 }
287302 }
@@ -291,9 +306,10 @@ class ExtendedRenderParagraph extends _RenderParagraph
291306 if (_needsClipping) {
292307 if (_overflowShader != null ) {
293308 context.canvas.translate (offset.dx, offset.dy);
294- final Paint paint = Paint ()
295- ..blendMode = BlendMode .modulate
296- ..shader = _overflowShader;
309+ final Paint paint =
310+ Paint ()
311+ ..blendMode = BlendMode .modulate
312+ ..shader = _overflowShader;
297313 context.canvas.drawRect (Offset .zero & size, paint);
298314 }
299315 context.canvas.restore ();
@@ -317,8 +333,11 @@ class ExtendedRenderParagraph extends _RenderParagraph
317333 }
318334
319335 void _paintSpecialTextChildren (
320- List <InlineSpan > textSpans, Canvas canvas, Rect rect,
321- {int textOffset = 0 }) {
336+ List <InlineSpan > textSpans,
337+ Canvas canvas,
338+ Rect rect, {
339+ int textOffset = 0 ,
340+ }) {
322341 for (final InlineSpan ts in textSpans) {
323342 final Offset topLeftOffset = getOffsetForCaret (
324343 TextPosition (offset: textOffset),
@@ -338,11 +357,20 @@ class ExtendedRenderParagraph extends _RenderParagraph
338357 endOffset = _findEndOffset (rect, endTextOffset);
339358 }
340359
341- ts.paint (canvas, topLeftOffset, rect,
342- endOffset: endOffset, wholeTextPainter: _textPainter);
360+ ts.paint (
361+ canvas,
362+ topLeftOffset,
363+ rect,
364+ endOffset: endOffset,
365+ wholeTextPainter: _textPainter,
366+ );
343367 } else if (ts is TextSpan && ts.children != null ) {
344- _paintSpecialTextChildren (ts.children! , canvas, rect,
345- textOffset: textOffset);
368+ _paintSpecialTextChildren (
369+ ts.children! ,
370+ canvas,
371+ rect,
372+ textOffset: textOffset,
373+ );
346374 }
347375
348376 textOffset += ts.toPlainText ().length;
0 commit comments