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
f0f0f097
Unverified
Commit
f0f0f097
authored
Feb 03, 2018
by
Hans Muller
Committed by
GitHub
Feb 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix InkRipple.cancel animation race (#14442)
parent
21ee1a25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
4 deletions
+40
-4
ink_ripple.dart
packages/flutter/lib/src/material/ink_ripple.dart
+8
-3
ink_splash.dart
packages/flutter/lib/src/material/ink_splash.dart
+2
-1
ink_paint_test.dart
packages/flutter/test/material/ink_paint_test.dart
+30
-0
No files found.
packages/flutter/lib/src/material/ink_ripple.dart
View file @
f0f0f097
...
...
@@ -199,9 +199,14 @@ class InkRipple extends InteractiveInkFeature {
@override
void
cancel
()
{
_fadeInController
.
stop
();
_fadeOutController
..
value
=
1.0
-
_fadeInController
.
value
..
animateTo
(
1.0
,
duration:
_kCancelDuration
);
// Watch out: setting _fadeOutController's value to 1.0 would
// trigger a call to _handleAlphaStatusChanged() which would
// dispose _fadeOutController.
if
(
_fadeInController
.
value
>
0.0
)
{
_fadeOutController
..
value
=
1.0
-
_fadeInController
.
value
..
animateTo
(
1.0
,
duration:
_kCancelDuration
);
}
}
void
_handleAlphaStatusChanged
(
AnimationStatus
status
)
{
...
...
packages/flutter/lib/src/material/ink_splash.dart
View file @
f0f0f097
...
...
@@ -170,7 +170,7 @@ class InkSplash extends InteractiveInkFeature {
@override
void
cancel
()
{
_alphaController
.
forward
();
_alphaController
?
.
forward
();
}
void
_handleAlphaStatusChanged
(
AnimationStatus
status
)
{
...
...
@@ -182,6 +182,7 @@ class InkSplash extends InteractiveInkFeature {
void
dispose
()
{
_radiusController
.
dispose
();
_alphaController
.
dispose
();
_alphaController
=
null
;
super
.
dispose
();
}
...
...
packages/flutter/test/material/ink_paint_test.dart
View file @
f0f0f097
...
...
@@ -248,4 +248,34 @@ void main() {
await
gesture
.
up
();
});
testWidgets
(
'Cancel an InkRipple that was disposed when its animation ended'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/14391
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Center
(
child:
new
Container
(
width:
100.0
,
height:
100.0
,
child:
new
InkWell
(
onTap:
()
{
},
radius:
100.0
,
splashFactory:
InkRipple
.
splashFactory
,
),
),
),
),
);
final
Offset
tapDownOffset
=
tester
.
getTopLeft
(
find
.
byType
(
InkWell
));
await
tester
.
tapAt
(
tapDownOffset
);
await
tester
.
pump
();
// start splash
await
tester
.
pump
(
const
Duration
(
milliseconds:
375
));
// _kFadeOutDuration, in_ripple.dart
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tapDownOffset
);
await
tester
.
pump
();
// start gesture
await
gesture
.
moveTo
(
const
Offset
(
0.0
,
0.0
));
await
gesture
.
up
();
// generates a tap cancel
await
tester
.
pumpAndSettle
();
});
}
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