Unverified Commit d9014655 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Deprecate AnimatedSize.vsync (#81067)

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