Instrument CurvedAnimation. (#143007)
This commit is contained in:
parent
10f1e63579
commit
ac5c3dec87
@ -379,6 +379,15 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
|
|||||||
required this.curve,
|
required this.curve,
|
||||||
this.reverseCurve,
|
this.reverseCurve,
|
||||||
}) {
|
}) {
|
||||||
|
// 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: '$CurvedAnimation',
|
||||||
|
object: this,
|
||||||
|
);
|
||||||
|
}
|
||||||
_updateCurveDirection(parent.status);
|
_updateCurveDirection(parent.status);
|
||||||
parent.addStatusListener(_updateCurveDirection);
|
parent.addStatusListener(_updateCurveDirection);
|
||||||
}
|
}
|
||||||
@ -433,6 +442,11 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
|
|||||||
|
|
||||||
/// Cleans up any listeners added by this CurvedAnimation.
|
/// Cleans up any listeners added by this CurvedAnimation.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
// TODO(polina-c): stop duplicating code across disposables
|
||||||
|
// https://github.com/flutter/flutter/issues/137435
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) {
|
||||||
|
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||||
|
}
|
||||||
isDisposed = true;
|
isDisposed = true;
|
||||||
parent.removeStatusListener(_updateCurveDirection);
|
parent.removeStatusListener(_updateCurveDirection);
|
||||||
}
|
}
|
||||||
|
@ -512,4 +512,19 @@ FlutterError
|
|||||||
expect(animation.value, 10.0);
|
expect(animation.value, 10.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('$CurvedAnimation dispatches memory events', () async {
|
||||||
|
await expectLater(
|
||||||
|
await memoryEvents(
|
||||||
|
() => CurvedAnimation(
|
||||||
|
parent: AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
vsync: const TestVSync(),
|
||||||
|
),
|
||||||
|
curve: Curves.linear,
|
||||||
|
).dispose(),
|
||||||
|
CurvedAnimation,
|
||||||
|
),
|
||||||
|
areCreateAndDispose,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user