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
1bd661f4
Unverified
Commit
1bd661f4
authored
Oct 22, 2020
by
xubaolin
Committed by
GitHub
Oct 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a widgetspan hittest bug (#68694)
parent
6a434ab9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+3
-1
text_test.dart
packages/flutter/test/widgets/text_test.dart
+36
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
1bd661f4
...
...
@@ -434,7 +434,8 @@ class RenderParagraph extends RenderBox
@override
bool
hitTestChildren
(
BoxHitTestResult
result
,
{
required
Offset
position
})
{
RenderBox
?
child
=
firstChild
;
while
(
child
!=
null
)
{
int
childIndex
=
0
;
while
(
child
!=
null
&&
childIndex
<
_textPainter
.
inlinePlaceholderBoxes
!.
length
)
{
final
TextParentData
textParentData
=
child
.
parentData
!
as
TextParentData
;
final
Matrix4
transform
=
Matrix4
.
translationValues
(
textParentData
.
offset
.
dx
,
...
...
@@ -461,6 +462,7 @@ class RenderParagraph extends RenderBox
return
true
;
}
child
=
childAfter
(
child
);
childIndex
+=
1
;
}
return
false
;
}
...
...
packages/flutter/test/widgets/text_test.dart
View file @
1bd661f4
...
...
@@ -161,6 +161,42 @@ void main() {
expect
(
tester
.
takeException
(),
null
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/42086
testWidgets
(
'inline widgets hitTest works with ellipsis'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/68559
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
,
),
);
await
tester
.
tap
(
find
.
byType
(
Text
));
expect
(
tester
.
takeException
(),
null
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/42086
testWidgets
(
'inline widgets works with textScaleFactor'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/59316
final
UniqueKey
key
=
UniqueKey
();
...
...
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