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
878fe20a
Unverified
Commit
878fe20a
authored
Aug 20, 2019
by
chunhtai
Committed by
GitHub
Aug 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix widgetspan does not work with ellipsis in text widget (#38699)
parent
109893c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+6
-3
text_test.dart
packages/flutter/test/widgets/text_test.dart
+31
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
878fe20a
...
...
@@ -513,7 +513,7 @@ class RenderParagraph extends RenderBox
void
_setParentData
()
{
RenderBox
child
=
firstChild
;
int
childIndex
=
0
;
while
(
child
!=
null
)
{
while
(
child
!=
null
&&
childIndex
<
_textPainter
.
inlinePlaceholderBoxes
.
length
)
{
final
TextParentData
textParentData
=
child
.
parentData
;
textParentData
.
offset
=
Offset
(
_textPainter
.
inlinePlaceholderBoxes
[
childIndex
].
left
,
...
...
@@ -640,8 +640,11 @@ class RenderParagraph extends RenderBox
RenderBox
child
=
firstChild
;
int
childIndex
=
0
;
while
(
child
!=
null
)
{
assert
(
childIndex
<
_textPainter
.
inlinePlaceholderBoxes
.
length
);
// childIndex might be out of index of placeholder boxes. This can happen
// if engine truncates children due to ellipsis. Sadly, we would not know
// it until we finish layout, and RenderObject is in immutable state at
// this point.
while
(
child
!=
null
&&
childIndex
<
_textPainter
.
inlinePlaceholderBoxes
.
length
)
{
final
TextParentData
textParentData
=
child
.
parentData
;
final
double
scale
=
textParentData
.
scale
;
...
...
packages/flutter/test/widgets/text_test.dart
View file @
878fe20a
...
...
@@ -116,6 +116,37 @@ void main() {
expect
(
text
.
text
.
style
.
fontSize
,
20.0
);
});
testWidgets
(
'inline widgets works with ellipsis'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/35869
const
TextStyle
textStyle
=
TextStyle
(
fontFamily:
'Ahem'
);
await
tester
.
pumpWidget
(
Text
.
rich
(
TextSpan
(
children:
<
InlineSpan
>[
const
TextSpan
(
text:
'a very very very very very very very very very very long line'
),
WidgetSpan
(
child:
SizedBox
(
width:
20
,
height:
40
,
child:
Card
(
child:
RichText
(
text:
const
TextSpan
(
text:
'widget should be truncated'
),
textDirection:
TextDirection
.
rtl
,
),
),
),
),
],
style:
textStyle
,
),
textDirection:
TextDirection
.
ltr
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
),
);
expect
(
tester
.
takeException
(),
null
);
});
testWidgets
(
'semanticsLabel can override text label'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
...
...
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