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
7f65c6a8
Unverified
Commit
7f65c6a8
authored
Jun 03, 2020
by
MariaMelnik
Committed by
GitHub
Jun 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stopped all animation controllers after toggleable has been detached. (#57809)
parent
2054f37a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
AUTHORS
AUTHORS
+1
-0
toggleable.dart
packages/flutter/lib/src/material/toggleable.dart
+2
-0
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+54
-0
No files found.
AUTHORS
View file @
7f65c6a8
...
...
@@ -56,4 +56,5 @@ Michael Lee <ckmichael8@gmail.com>
Katarina Sheremet <katarina@sheremet.ch>
Nicolas Schneider <nioncode+git@gmail.com>
Mikhail Zotyev <mbixjkee1392@gmail.com>
Maria Melnik <melnikmk@gmail.com>
Ayush Bherwani <ayush.bherwani1998@gmail.com>
packages/flutter/lib/src/material/toggleable.dart
View file @
7f65c6a8
...
...
@@ -391,6 +391,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
void
detach
()
{
_positionController
.
stop
();
_reactionController
.
stop
();
_reactionHoverFadeController
.
stop
();
_reactionFocusFadeController
.
stop
();
super
.
detach
();
}
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
7f65c6a8
...
...
@@ -603,6 +603,60 @@ void main() {
expect
(
box
.
size
,
equals
(
const
Size
(
60
,
36
)));
});
testWidgets
(
'Checkbox stops hover animation when removed from the tree.'
,
(
WidgetTester
tester
)
async
{
const
Key
checkboxKey
=
Key
(
'checkbox'
);
bool
checkboxVal
=
true
;
await
tester
.
pumpWidget
(
Theme
(
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
StatefulBuilder
(
builder:
(
_
,
StateSetter
setState
)
=>
Checkbox
(
key:
checkboxKey
,
value:
checkboxVal
,
onChanged:
(
bool
newValue
)
=>
setState
(()
{
checkboxVal
=
newValue
;}),
),
),
),
),
),
),
);
expect
(
find
.
byKey
(
checkboxKey
),
findsOneWidget
);
final
Offset
checkboxCenter
=
tester
.
getCenter
(
find
.
byKey
(
checkboxKey
));
final
TestGesture
testGesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
testGesture
.
moveTo
(
checkboxCenter
);
await
tester
.
pump
();
// start animation
await
tester
.
pump
(
const
Duration
(
milliseconds:
25
));
// hover animation duration is 50 ms. It is half-way.
await
tester
.
pumpWidget
(
Theme
(
data:
ThemeData
(
materialTapTargetSize:
MaterialTapTargetSize
.
padded
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
Container
(),
),
),
),
),
);
// Hover animation should not trigger an exception when the checkbox is removed
// before the hover animation should complete.
expect
(
tester
.
takeException
(),
isNull
);
await
testGesture
.
removePointer
();
});
testWidgets
(
'Checkbox changes mouse cursor when hovered'
,
(
WidgetTester
tester
)
async
{
// Test Checkbox() constructor
await
tester
.
pumpWidget
(
...
...
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