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
74ac7c47
Unverified
Commit
74ac7c47
authored
Aug 26, 2021
by
chunhtai
Committed by
GitHub
Aug 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty textspan with spell out crashes (#88738)
parent
577832fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
text_span.dart
packages/flutter/lib/src/painting/text_span.dart
+5
-4
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+12
-0
No files found.
packages/flutter/lib/src/painting/text_span.dart
View file @
74ac7c47
...
@@ -371,13 +371,14 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
...
@@ -371,13 +371,14 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
final
bool
effectiveSpellOut
=
spellOut
??
inheritedSpellOut
;
final
bool
effectiveSpellOut
=
spellOut
??
inheritedSpellOut
;
if
(
text
!=
null
)
{
if
(
text
!=
null
)
{
final
int
textLength
=
semanticsLabel
?.
length
??
text
!.
length
;
collector
.
add
(
InlineSpanSemanticsInformation
(
collector
.
add
(
InlineSpanSemanticsInformation
(
text
!,
text
!,
stringAttributes:
<
ui
.
StringAttribute
>[
stringAttributes:
<
ui
.
StringAttribute
>[
if
(
effectiveSpellOut
)
if
(
effectiveSpellOut
&&
textLength
>
0
)
ui
.
SpellOutStringAttribute
(
range:
TextRange
(
start:
0
,
end:
semanticsLabel
?.
length
??
text
!.
l
ength
)),
ui
.
SpellOutStringAttribute
(
range:
TextRange
(
start:
0
,
end:
textL
ength
)),
if
(
effectiveLocale
!=
null
)
if
(
effectiveLocale
!=
null
&&
textLength
>
0
)
ui
.
LocaleStringAttribute
(
locale:
effectiveLocale
,
range:
TextRange
(
start:
0
,
end:
semanticsLabel
?.
length
??
text
!.
l
ength
)),
ui
.
LocaleStringAttribute
(
locale:
effectiveLocale
,
range:
TextRange
(
start:
0
,
end:
textL
ength
)),
],
],
semanticsLabel:
semanticsLabel
,
semanticsLabel:
semanticsLabel
,
recognizer:
recognizer
,
recognizer:
recognizer
,
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
74ac7c47
...
@@ -749,6 +749,18 @@ void main() {
...
@@ -749,6 +749,18 @@ void main() {
paragraph
.
assembleSemanticsNode
(
SemanticsNode
(),
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
paragraph
.
assembleSemanticsNode
(
SemanticsNode
(),
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
});
});
test
(
'Supports empty text span with spell out'
,
()
{
final
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
text:
''
,
spellOut:
true
),
textDirection:
TextDirection
.
rtl
,
);
layout
(
paragraph
);
final
SemanticsNode
node
=
SemanticsNode
();
paragraph
.
assembleSemanticsNode
(
node
,
SemanticsConfiguration
(),
<
SemanticsNode
>[]);
expect
(
node
.
attributedLabel
.
string
,
''
);
expect
(
node
.
attributedLabel
.
attributes
.
length
,
0
);
});
test
(
'Asserts on unsupported gesture recognizer'
,
()
{
test
(
'Asserts on unsupported gesture recognizer'
,
()
{
final
RenderParagraph
paragraph
=
RenderParagraph
(
final
RenderParagraph
paragraph
=
RenderParagraph
(
TextSpan
(
text:
_kText
,
children:
<
InlineSpan
>[
TextSpan
(
text:
_kText
,
children:
<
InlineSpan
>[
...
...
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