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
e36a868b
Unverified
Commit
e36a868b
authored
Jan 17, 2024
by
Kostia Sokolovskyi
Committed by
GitHub
Jan 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TrainHoppingAnimation should dispatch creation and disposal events. (#141635)
parent
0503c447
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
animations.dart
packages/flutter/lib/src/animation/animations.dart
+14
-0
animations_test.dart
packages/flutter/test/animation/animations_test.dart
+14
-0
No files found.
packages/flutter/lib/src/animation/animations.dart
View file @
e36a868b
...
...
@@ -509,6 +509,15 @@ class TrainHoppingAnimation extends Animation<double>
this
.
_nextTrain
,
{
this
.
onSwitchedTrain
,
})
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
FlutterMemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/animation.dart'
,
className:
'
$TrainHoppingAnimation
'
,
object:
this
,
);
}
if
(
_nextTrain
!=
null
)
{
if
(
_currentTrain
!.
value
==
_nextTrain
!.
value
)
{
_currentTrain
=
_nextTrain
;
...
...
@@ -595,6 +604,11 @@ class TrainHoppingAnimation extends Animation<double>
/// After this is called, this object is no longer usable.
@override
void
dispose
()
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
FlutterMemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
assert
(
_currentTrain
!=
null
);
_currentTrain
!.
removeStatusListener
(
_statusChangeHandler
);
_currentTrain
!.
removeListener
(
_valueChangeHandler
);
...
...
packages/flutter/test/animation/animations_test.dart
View file @
e36a868b
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
import
'../scheduler/scheduler_tester.dart'
;
...
...
@@ -127,6 +128,19 @@ void main() {
expect
(
animation
.
toString
(),
contains
(
'no next'
));
});
test
(
'TrainHoppingAnimation dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(
()
=>
TrainHoppingAnimation
(
const
AlwaysStoppedAnimation
<
double
>(
1
),
const
AlwaysStoppedAnimation
<
double
>(
1
),
).
dispose
(),
TrainHoppingAnimation
,
),
areCreateAndDispose
,
);
});
test
(
'AnimationMean control test'
,
()
{
final
AnimationController
left
=
AnimationController
(
value:
0.5
,
...
...
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