Unverified Commit cc1af3af authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Revert "Expose height and width factor in AnimatedAlign (#60836)" (#61109)

This reverts commit e8e1eb51.
parent 0cff6542
......@@ -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<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 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
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));
}
}
......
......@@ -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: <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));
});
}
......@@ -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: <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)));
});
}
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