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
3ece170c
Unverified
Commit
3ece170c
authored
Oct 15, 2021
by
Justin McCandless
Committed by
GitHub
Oct 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_CastError on Semantics copy in release mode (#91827)
parent
76f17185
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+2
-2
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+45
-0
No files found.
packages/flutter/lib/src/widgets/editable_text.dart
View file @
3ece170c
...
...
@@ -2712,7 +2712,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
if
(
hideHandles
)
{
// Hide the handles and the toolbar.
_selectionOverlay
?.
hide
();
}
else
{
}
else
if
(
_selectionOverlay
?.
toolbarIsVisible
??
false
)
{
// Hide only the toolbar but not the handles.
_selectionOverlay
?.
hideToolbar
();
}
...
...
packages/flutter/lib/src/widgets/text_selection.dart
View file @
3ece170c
...
...
@@ -357,7 +357,7 @@ class TextSelectionOverlay {
/// Controls the fade-in and fade-out animations for the toolbar and handles.
static
const
Duration
fadeDuration
=
Duration
(
milliseconds:
150
);
late
AnimationController
_toolbarController
;
late
final
AnimationController
_toolbarController
;
Animation
<
double
>
get
_toolbarOpacity
=>
_toolbarController
.
view
;
/// Retrieve current value.
...
...
@@ -496,7 +496,7 @@ class TextSelectionOverlay {
void
hideToolbar
()
{
assert
(
_toolbar
!=
null
);
_toolbarController
.
stop
();
_toolbar
!
.
remove
();
_toolbar
?
.
remove
();
_toolbar
=
null
;
}
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
3ece170c
...
...
@@ -3323,6 +3323,51 @@ void main() {
semantics
.
dispose
();
});
// Regression test for b/201218542.
testWidgets
(
'copying with a11y works even when toolbar is hidden'
,
(
WidgetTester
tester
)
async
{
Future
<
void
>
testByControls
(
TextSelectionControls
controls
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
TextEditingController
controller
=
TextEditingController
(
text:
'ABCDEFG'
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
EditableText
(
backgroundCursorColor:
Colors
.
grey
,
controller:
controller
,
focusNode:
focusNode
,
style:
textStyle
,
cursorColor:
cursorColor
,
selectionControls:
controls
,
),
));
await
tester
.
tap
(
find
.
byType
(
EditableText
));
await
tester
.
pump
();
final
SemanticsOwner
owner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!;
const
int
expectedNodeId
=
5
;
expect
(
controller
.
value
.
selection
.
isCollapsed
,
isTrue
);
controller
.
selection
=
TextSelection
(
baseOffset:
0
,
extentOffset:
controller
.
value
.
text
.
length
,
);
await
tester
.
pump
();
expect
(
find
.
text
(
'Copy'
),
findsNothing
);
owner
.
performAction
(
expectedNodeId
,
SemanticsAction
.
copy
);
expect
(
tester
.
takeException
(),
isNull
);
expect
(
(
await
Clipboard
.
getData
(
Clipboard
.
kTextPlain
))!.
text
,
equals
(
'ABCDEFG'
),
);
semantics
.
dispose
();
}
await
testByControls
(
materialTextSelectionControls
);
await
testByControls
(
cupertinoTextSelectionControls
);
});
});
testWidgets
(
'can set text with a11y'
,
(
WidgetTester
tester
)
async
{
...
...
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