Revert "Expose height and width factor in AnimatedAlign (#60836)" (#61109)
This reverts commit e8e1eb51a41d53eada80f508d5c69c908c67ea30.
diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart
index 35be6ad..b8a01fb 100644
--- a/packages/flutter/lib/src/widgets/implicit_animations.dart
+++ b/packages/flutter/lib/src/widgets/implicit_animations.dart
@@ -882,14 +882,10 @@
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 @@
/// {@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 _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
AlignmentGeometryTween _alignment;
- Tween<double> _heightFactorTween;
- Tween<double> _widthFactorTween;
@override
void forEachTween(TweenVisitor<dynamic> visitor) {
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween;
- _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
- _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>;
-
}
@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 @@
void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description);
description.add(DiagnosticsProperty<AlignmentGeometryTween>('alignment', _alignment, defaultValue: null));
- description.add(DiagnosticsProperty<Tween<double>>('widthFactor', _widthFactorTween, defaultValue: null));
- description.add(DiagnosticsProperty<Tween<double>>('heightFactor', _heightFactorTween, defaultValue: null));
}
}
diff --git a/packages/flutter/test/widgets/align_test.dart b/packages/flutter/test/widgets/align_test.dart
index 6e37d2f..b6d4e5c 100644
--- a/packages/flutter/test/widgets/align_test.dart
+++ b/packages/flutter/test/widgets/align_test.dart
@@ -112,70 +112,4 @@
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: <Widget>[
- 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: <Widget>[
- 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 f40f3f9..9f99d80 100644
--- a/packages/flutter/test/widgets/animated_align_test.dart
+++ b/packages/flutter/test/widgets/animated_align_test.dart
@@ -59,78 +59,4 @@
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: <Widget>[
- 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: <Widget>[
- 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)));
- });
}