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
cee6d46b
Unverified
Commit
cee6d46b
authored
Nov 04, 2020
by
Michael Goderbauer
Committed by
GitHub
Nov 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not crash if RichText has recognizers without handlers (#69793)
parent
cb5263e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
5 deletions
+61
-5
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+11
-5
rich_text_test.dart
packages/flutter/test/widgets/rich_text_test.dart
+50
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
cee6d46b
...
...
@@ -935,13 +935,19 @@ class RenderParagraph extends RenderBox
final
GestureRecognizer
?
recognizer
=
info
.
recognizer
;
if
(
recognizer
!=
null
)
{
if
(
recognizer
is
TapGestureRecognizer
)
{
configuration
.
onTap
=
recognizer
.
onTap
;
configuration
.
isLink
=
true
;
if
(
recognizer
.
onTap
!=
null
)
{
configuration
.
onTap
=
recognizer
.
onTap
;
configuration
.
isLink
=
true
;
}
}
else
if
(
recognizer
is
DoubleTapGestureRecognizer
)
{
configuration
.
onTap
=
recognizer
.
onDoubleTap
;
configuration
.
isLink
=
true
;
if
(
recognizer
.
onDoubleTap
!=
null
)
{
configuration
.
onTap
=
recognizer
.
onDoubleTap
;
configuration
.
isLink
=
true
;
}
}
else
if
(
recognizer
is
LongPressGestureRecognizer
)
{
configuration
.
onLongPress
=
recognizer
.
onLongPress
;
if
(
recognizer
.
onLongPress
!=
null
)
{
configuration
.
onLongPress
=
recognizer
.
onLongPress
;
}
}
else
{
assert
(
false
,
'
${recognizer.runtimeType}
is not supported.'
);
}
...
...
packages/flutter/test/widgets/rich_text_test.dart
0 → 100644
View file @
cee6d46b
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'RichText with recognizers without handlers does not throw'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
RichText
(
text:
TextSpan
(
text:
'root'
,
children:
<
InlineSpan
>[
TextSpan
(
text:
'one'
,
recognizer:
TapGestureRecognizer
()),
TextSpan
(
text:
'two'
,
recognizer:
LongPressGestureRecognizer
()),
TextSpan
(
text:
'three'
,
recognizer:
DoubleTapGestureRecognizer
()),
]),
),
),
);
expect
(
tester
.
getSemantics
(
find
.
byType
(
RichText
)),
matchesSemantics
(
children:
<
Matcher
>[
matchesSemantics
(
label:
'root'
,
hasTapAction:
false
,
hasLongPressAction:
false
,
),
matchesSemantics
(
label:
'one'
,
hasTapAction:
false
,
hasLongPressAction:
false
,
),
matchesSemantics
(
label:
'two'
,
hasTapAction:
false
,
hasLongPressAction:
false
,
),
matchesSemantics
(
label:
'three'
,
hasTapAction:
false
,
hasLongPressAction:
false
,
),
],
));
});
}
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