Deprecate AnimatedSize.vsync (#81067)
This commit is contained in:
parent
133a55ae51
commit
d9014655ab
@ -713,7 +713,6 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
||||
AnimatedSize(
|
||||
curve: Curves.fastOutSlowIn,
|
||||
duration: kThemeAnimationDuration,
|
||||
vsync: this,
|
||||
child: widget.steps[widget.currentStep].content,
|
||||
),
|
||||
_buildVerticalControls(),
|
||||
|
@ -189,7 +189,6 @@ class _TextSelectionToolbarOverflowableState extends State<_TextSelectionToolbar
|
||||
overflowOpen: _overflowOpen,
|
||||
textDirection: Directionality.of(context),
|
||||
child: AnimatedSize(
|
||||
vsync: this,
|
||||
// This duration was eyeballed on a Pixel 2 emulator running Android
|
||||
// API 28.
|
||||
duration: const Duration(milliseconds: 140),
|
||||
|
@ -366,7 +366,6 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
|
||||
duration: widget.duration,
|
||||
reverseDuration: widget.reverseDuration,
|
||||
curve: widget.sizeCurve,
|
||||
vsync: this,
|
||||
child: widget.layoutBuilder(topChild, topKey, bottomChild, bottomKey),
|
||||
),
|
||||
);
|
||||
|
@ -60,8 +60,11 @@ class AnimatedSize extends StatefulWidget {
|
||||
this.curve = Curves.linear,
|
||||
required this.duration,
|
||||
this.reverseDuration,
|
||||
// TODO(jsimmons): deprecate when customers tests are updated.
|
||||
TickerProvider? vsync, // ignore: avoid_unused_constructor_parameters
|
||||
@Deprecated(
|
||||
'This field is now ignored. '
|
||||
'This feature was deprecated after v2.2.0-10.1.pre.'
|
||||
)
|
||||
TickerProvider? vsync,
|
||||
this.clipBehavior = Clip.hardEdge,
|
||||
}) : assert(clipBehavior != null),
|
||||
super(key: key);
|
||||
|
@ -19,11 +19,10 @@ void main() {
|
||||
group('AnimatedSize', () {
|
||||
testWidgets('animates forwards then backwards with stable-sized children', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -36,11 +35,10 @@ void main() {
|
||||
expect(box.size.height, equals(100.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
),
|
||||
@ -63,11 +61,10 @@ void main() {
|
||||
expect(box.size.height, equals(200.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -92,14 +89,13 @@ void main() {
|
||||
|
||||
testWidgets('clamps animated size to constraints', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox (
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -114,14 +110,13 @@ void main() {
|
||||
|
||||
// Attempt to animate beyond the outer SizedBox.
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox (
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
),
|
||||
@ -158,7 +153,6 @@ void main() {
|
||||
Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
width: 100.0,
|
||||
@ -175,7 +169,6 @@ void main() {
|
||||
Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
width: 200.0,
|
||||
@ -204,7 +197,6 @@ void main() {
|
||||
Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 1),
|
||||
width: 100.0,
|
||||
@ -228,7 +220,6 @@ void main() {
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: Duration(milliseconds: 200),
|
||||
vsync: TestVSync(),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
@ -238,11 +229,10 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -258,11 +248,10 @@ void main() {
|
||||
|
||||
testWidgets('does not run animation unnecessarily', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -282,11 +271,10 @@ void main() {
|
||||
|
||||
testWidgets('can set and update clipBehavior', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
child: const SizedBox(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
),
|
||||
@ -303,7 +291,6 @@ void main() {
|
||||
Center(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: tester,
|
||||
clipBehavior: clip,
|
||||
child: const SizedBox(
|
||||
width: 100.0,
|
||||
@ -327,7 +314,6 @@ void main() {
|
||||
AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOutBack,
|
||||
vsync: tester,
|
||||
child: SizedBox(
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
|
Loading…
x
Reference in New Issue
Block a user