Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ab3602b7
Unverified
Commit
ab3602b7
authored
May 31, 2023
by
Tomasz Gucio
Committed by
GitHub
May 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use paragraph getter in TextPainter (#127607)
parent
224667e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
text_painter.dart
packages/flutter/lib/src/painting/text_painter.dart
+5
-4
No files found.
packages/flutter/lib/src/painting/text_painter.dart
View file @
ab3602b7
...
...
@@ -369,6 +369,7 @@ class _TextPainterLayoutCacheWithOffset {
TextWidthBasis
.
parent
=>
clampDouble
(
layout
.
maxIntrinsicLineExtent
,
minWidth
,
maxWidth
),
};
}
// Try to resize the contentWidth to fit the new input constraints, by just
// adjusting the paint offset (so no line-breaking changes needed).
//
...
...
@@ -398,8 +399,8 @@ class _TextPainterLayoutCacheWithOffset {
assert
(
paragraph
.
width
==
double
.
infinity
);
return
false
;
}
final
double
maxIntrinsicWidth
=
layout
.
_
paragraph
.
maxIntrinsicWidth
;
if
((
layout
.
_
paragraph
.
width
-
maxIntrinsicWidth
)
>
-
precisionErrorTolerance
&&
(
maxWidth
-
maxIntrinsicWidth
)
>
-
precisionErrorTolerance
)
{
final
double
maxIntrinsicWidth
=
paragraph
.
maxIntrinsicWidth
;
if
((
paragraph
.
width
-
maxIntrinsicWidth
)
>
-
precisionErrorTolerance
&&
(
maxWidth
-
maxIntrinsicWidth
)
>
-
precisionErrorTolerance
)
{
// Adjust the paintOffset and contentWidth to the new input constraints.
contentWidth
=
newContentWidth
;
return
true
;
...
...
@@ -889,7 +890,7 @@ class TextPainter {
if
(
span
is
PlaceholderSpan
)
{
placeholderCount
+=
1
;
}
return
value
.
length
>=
placeholderCount
;
return
value
.
length
>=
placeholderCount
;
});
return
placeholderCount
==
value
.
length
;
}());
...
...
@@ -1129,7 +1130,7 @@ class TextPainter {
return
true
;
}());
final
ui
.
Paragraph
paragraph
=
layoutCache
.
layout
.
_
paragraph
;
final
ui
.
Paragraph
paragraph
=
layoutCache
.
paragraph
;
// Unfortunately even if we know that there is only paint changes, there's
// no API to only make those updates so the paragraph has to be recreated
// and re-laid out.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment