Merge pull request #2720 from collinjackson/axis_alignment
Change SizeTransition API to take a double instead of FractionalOffset for alignment
This commit is contained in:
commit
98636d5ba5
@ -186,7 +186,7 @@ class SizeTransition extends AnimatedWidget {
|
|||||||
Key key,
|
Key key,
|
||||||
this.axis: Axis.vertical,
|
this.axis: Axis.vertical,
|
||||||
Animation<double> sizeFactor,
|
Animation<double> sizeFactor,
|
||||||
this.alignment: const FractionalOffset(0.5, 0.5),
|
this.axisAlignment: 0.5,
|
||||||
this.child
|
this.child
|
||||||
}) : sizeFactor = sizeFactor, super(key: key, animation: sizeFactor) {
|
}) : sizeFactor = sizeFactor, super(key: key, animation: sizeFactor) {
|
||||||
assert(axis != null);
|
assert(axis != null);
|
||||||
@ -200,13 +200,18 @@ class SizeTransition extends AnimatedWidget {
|
|||||||
/// width or height multiplied by v.
|
/// width or height multiplied by v.
|
||||||
final Animation<double> sizeFactor;
|
final Animation<double> sizeFactor;
|
||||||
|
|
||||||
/// How to align the child. See the [Align] widget.
|
/// How to align the child along the axis that sizeFactor is modifying.
|
||||||
final FractionalOffset alignment;
|
final double axisAlignment;
|
||||||
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
FractionalOffset alignment;
|
||||||
|
if (axis == Axis.vertical)
|
||||||
|
alignment = new FractionalOffset(0.0, axisAlignment);
|
||||||
|
else
|
||||||
|
alignment = new FractionalOffset(axisAlignment, 0.0);
|
||||||
return new ClipRect(
|
return new ClipRect(
|
||||||
child: new Align(
|
child: new Align(
|
||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user