diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index 35be6ad1be..b8a01fb688 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -882,14 +882,10 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget { Key key, @required this.alignment, this.child, - this.heightFactor = 1.0, - this.widthFactor = 1.0, Curve curve = Curves.linear, @required Duration duration, VoidCallback onEnd, }) : assert(alignment != null), - assert(widthFactor == null || widthFactor >= 0.0), - assert(heightFactor == null || heightFactor >= 0.0), super(key: key, curve: curve, duration: duration, onEnd: onEnd); /// How to align the child. @@ -915,16 +911,6 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget { /// {@macro flutter.widgets.child} final Widget child; - /// If non-null, sets its height to the child's height multiplied by this factor. - /// - /// Can be both greater and less than 1.0 but must be positive. Defaults to 1.0. - final double heightFactor; - - /// If non-null, sets its width to the child's width multiplied by this factor. - /// - /// Can be both greater and less than 1.0 but must be positive. Defaults to 1.0. - final double widthFactor; - @override _AnimatedAlignState createState() => _AnimatedAlignState(); @@ -937,23 +923,16 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget { class _AnimatedAlignState extends AnimatedWidgetBaseState { AlignmentGeometryTween _alignment; - Tween _heightFactorTween; - Tween _widthFactorTween; @override void forEachTween(TweenVisitor visitor) { _alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween; - _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween(begin: value as double)) as Tween; - _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween(begin: value as double)) as Tween; - } @override Widget build(BuildContext context) { return Align( alignment: _alignment.evaluate(animation), - heightFactor: _heightFactorTween.evaluate(animation), - widthFactor: _widthFactorTween.evaluate(animation), child: widget.child, ); } @@ -962,8 +941,6 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState { void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); description.add(DiagnosticsProperty('alignment', _alignment, defaultValue: null)); - description.add(DiagnosticsProperty>('widthFactor', _widthFactorTween, defaultValue: null)); - description.add(DiagnosticsProperty>('heightFactor', _heightFactorTween, defaultValue: null)); } } diff --git a/packages/flutter/test/widgets/align_test.dart b/packages/flutter/test/widgets/align_test.dart index 6e37d2fb45..b6d4e5c13a 100644 --- a/packages/flutter/test/widgets/align_test.dart +++ b/packages/flutter/test/widgets/align_test.dart @@ -112,70 +112,4 @@ void main() { expect(size.width, equals(800.0)); expect(size.height, equals(10.0)); }); - - testWidgets('Align widthFactor', (WidgetTester tester) async { - final GlobalKey inner = GlobalKey(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Align( - widthFactor: 0.5, - child: Container( - height: 100.0, - width: 100.0, - ), - ), - Align( - key: inner, - widthFactor: 0.5, - child: Container( - height: 100.0, - width: 100.0, - ), - ), - ], - ), - ), - ); - final RenderBox box = inner.currentContext.findRenderObject() as RenderBox; - expect(box.size.width, equals(50.0)); - }); - - testWidgets('Align heightFactor', (WidgetTester tester) async { - final GlobalKey inner = GlobalKey(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.center, - heightFactor: 0.5, - child: Container( - height: 100.0, - width: 100.0, - ), - ), - Align( - key: inner, - alignment: Alignment.center, - heightFactor: 0.5, - child: Container( - height: 100.0, - width: 100.0, - ), - ), - ], - ), - ), - ); - final RenderBox box = inner.currentContext.findRenderObject() as RenderBox; - expect(box.size.height, equals(50.0)); - }); } diff --git a/packages/flutter/test/widgets/animated_align_test.dart b/packages/flutter/test/widgets/animated_align_test.dart index f40f3f9dc3..9f99d8035d 100644 --- a/packages/flutter/test/widgets/animated_align_test.dart +++ b/packages/flutter/test/widgets/animated_align_test.dart @@ -59,78 +59,4 @@ void main() { expect(tester.getSize(find.byKey(target)), const Size(100.0, 200.0)); expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 400.0)); }); - - testWidgets('AnimatedAlign widthFactor', (WidgetTester tester) async { - final GlobalKey inner = GlobalKey(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AnimatedAlign( - alignment: Alignment.center, - curve: Curves.ease, - widthFactor: 0.5, - duration: const Duration(milliseconds: 200), - child: Container( - height: 100.0, - width: 100.0, - ), - ), - AnimatedAlign( - key: inner, - alignment: Alignment.center, - curve: Curves.ease, - widthFactor: 0.5, - duration: const Duration(milliseconds: 200), - child: Container( - height: 100.0, - width: 100.0, - ), - ), - ], - ), - ), - ); - final RenderBox box = inner.currentContext.findRenderObject() as RenderBox; - expect(box.size, equals(const Size(50.0, 100))); - }); - - testWidgets('AnimatedAlign heightFactor', (WidgetTester tester) async { - final GlobalKey inner = GlobalKey(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AnimatedAlign( - alignment: Alignment.center, - curve: Curves.ease, - heightFactor: 0.5, - duration: const Duration(milliseconds: 200), - child: Container( - height: 100.0, - width: 100.0, - ), - ), - AnimatedAlign( - key: inner, - alignment: Alignment.center, - curve: Curves.ease, - heightFactor: 0.5, - duration: const Duration(milliseconds: 200), - child: Container( - height: 100.0, - width: 100.0, - ), - ), - ], - ), - ), - ); - final RenderBox box = inner.currentContext.findRenderObject() as RenderBox; - expect(box.size, equals(const Size(100.0, 50))); - }); }