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
80e1008c
Unverified
Commit
80e1008c
authored
Dec 16, 2022
by
Lucas.Xu
Committed by
GitHub
Dec 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: #110342 unable to update rich text widget gesture recognizer (#116849)
parent
76bb8ead
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+5
-1
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+48
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
80e1008c
...
...
@@ -136,8 +136,12 @@ class RenderParagraph extends RenderBox
assert
(
value
!=
null
);
switch
(
_textPainter
.
text
!.
compareTo
(
value
))
{
case
RenderComparison
.
identical
:
case
RenderComparison
.
metadata
:
return
;
case
RenderComparison
.
metadata
:
_textPainter
.
text
=
value
;
_cachedCombinedSemanticsInfos
=
null
;
markNeedsSemanticsUpdate
();
break
;
case
RenderComparison
.
paint
:
_textPainter
.
text
=
value
;
_cachedAttributedLabel
=
null
;
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
80e1008c
...
...
@@ -1299,6 +1299,54 @@ void main() {
expect
(
selection
.
end
,
31
);
});
});
test
(
'can just update the gesture recognizer'
,
()
async
{
final
TapGestureRecognizer
recognizerBefore
=
TapGestureRecognizer
()..
onTap
=
()
{};
final
RenderParagraph
paragraph
=
RenderParagraph
(
TextSpan
(
text:
'How are you
\n
'
,
recognizer:
recognizerBefore
),
textDirection:
TextDirection
.
ltr
,
);
int
semanticsUpdateCount
=
0
;
TestRenderingFlutterBinding
.
instance
.
pipelineOwner
.
ensureSemantics
(
listener:
()
{
++
semanticsUpdateCount
;
},
);
layout
(
paragraph
);
expect
((
paragraph
.
text
as
TextSpan
).
recognizer
,
same
(
recognizerBefore
));
final
SemanticsNode
nodeBefore
=
SemanticsNode
();
paragraph
.
assembleSemanticsNode
(
nodeBefore
,
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
expect
(
semanticsUpdateCount
,
0
);
List
<
SemanticsNode
>
children
=
<
SemanticsNode
>[];
nodeBefore
.
visitChildren
((
SemanticsNode
child
)
{
children
.
add
(
child
);
return
true
;
});
SemanticsData
data
=
children
.
single
.
getSemanticsData
();
expect
(
data
.
hasAction
(
SemanticsAction
.
longPress
),
false
);
expect
(
data
.
hasAction
(
SemanticsAction
.
tap
),
true
);
final
LongPressGestureRecognizer
recognizerAfter
=
LongPressGestureRecognizer
()..
onLongPress
=
()
{};
paragraph
.
text
=
TextSpan
(
text:
'How are you
\n
'
,
recognizer:
recognizerAfter
);
pumpFrame
(
phase:
EnginePhase
.
flushSemantics
);
expect
((
paragraph
.
text
as
TextSpan
).
recognizer
,
same
(
recognizerAfter
));
final
SemanticsNode
nodeAfter
=
SemanticsNode
();
paragraph
.
assembleSemanticsNode
(
nodeAfter
,
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
expect
(
semanticsUpdateCount
,
1
);
children
=
<
SemanticsNode
>[];
nodeAfter
.
visitChildren
((
SemanticsNode
child
)
{
children
.
add
(
child
);
return
true
;
});
data
=
children
.
single
.
getSemanticsData
();
expect
(
data
.
hasAction
(
SemanticsAction
.
longPress
),
true
);
expect
(
data
.
hasAction
(
SemanticsAction
.
tap
),
false
);
});
}
class
MockCanvas
extends
Fake
implements
Canvas
{
...
...
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