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
bef3512d
Unverified
Commit
bef3512d
authored
May 06, 2020
by
Gary Qian
Committed by
GitHub
May 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DoubleTap recognizer support and improved error message (#56328)
parent
2f04ba91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+4
-1
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+33
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
bef3512d
...
...
@@ -916,10 +916,13 @@ class RenderParagraph extends RenderBox
if
(
recognizer
is
TapGestureRecognizer
)
{
configuration
.
onTap
=
recognizer
.
onTap
;
configuration
.
isLink
=
true
;
}
else
if
(
recognizer
is
DoubleTapGestureRecognizer
)
{
configuration
.
onTap
=
recognizer
.
onDoubleTap
;
configuration
.
isLink
=
true
;
}
else
if
(
recognizer
is
LongPressGestureRecognizer
)
{
configuration
.
onLongPress
=
recognizer
.
onLongPress
;
}
else
{
assert
(
false
);
assert
(
false
,
'
${recognizer.runtimeType}
is not supported.'
);
}
}
final
SemanticsNode
newChild
=
(
_cachedChildNodes
?.
isNotEmpty
==
true
)
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
bef3512d
...
...
@@ -417,4 +417,37 @@ void main() {
expect
(
boxes
[
8
],
const
TextBox
.
fromLTRBD
(
14.0
,
28.0
,
28.0
,
42.0
,
TextDirection
.
ltr
));
// Ahem-based tests don't yet quite work on Windows or some MacOS environments
},
skip:
isWindows
||
isMacOS
||
isBrowser
);
test
(
'Supports gesture recognizer semantics'
,
()
{
final
RenderParagraph
paragraph
=
RenderParagraph
(
TextSpan
(
text:
_kText
,
children:
<
InlineSpan
>[
TextSpan
(
text:
'one'
,
recognizer:
TapGestureRecognizer
()..
onTap
=
()
{}),
TextSpan
(
text:
'two'
,
recognizer:
LongPressGestureRecognizer
()..
onLongPress
=
()
{}),
TextSpan
(
text:
'three'
,
recognizer:
DoubleTapGestureRecognizer
()..
onDoubleTap
=
()
{}),
]),
textDirection:
TextDirection
.
rtl
,
);
layout
(
paragraph
);
paragraph
.
assembleSemanticsNode
(
SemanticsNode
(),
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
});
test
(
'Asserts on unsupported gesture recognizer'
,
()
{
final
RenderParagraph
paragraph
=
RenderParagraph
(
TextSpan
(
text:
_kText
,
children:
<
InlineSpan
>[
TextSpan
(
text:
'three'
,
recognizer:
MultiTapGestureRecognizer
()..
onTap
=
(
int
id
)
{}),
]),
textDirection:
TextDirection
.
rtl
,
);
layout
(
paragraph
);
bool
failed
=
false
;
try
{
paragraph
.
assembleSemanticsNode
(
SemanticsNode
(),
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
}
catch
(
e
)
{
failed
=
true
;
expect
(
e
.
message
,
'MultiTapGestureRecognizer is not supported.'
);
}
expect
(
failed
,
true
);
});
}
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