Visitar URL original
[animations] adds alignment parameter to FadeScaleTransition by grinder15 · Pull Request #187 · flutter/packages · GitHub
Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[animations] adds alignment parameter to FadeScaleTransition
  • Loading branch information
grinder15 authored and Jerome Arenas committed Aug 3, 2020
commit 51b4441a6cef35968738f0f7ca1d862b12ab497d
15 changes: 15 additions & 0 deletions packages/animations/lib/src/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class FadeScaleTransition extends StatelessWidget {
const FadeScaleTransition({
Key key,
@required this.animation,
this.alignment = Alignment.center,
Comment thread
grinder15 marked this conversation as resolved.
Resolved
this.child,
}) : assert(animation != null),
super(key: key);
Expand All @@ -135,6 +136,19 @@ class FadeScaleTransition extends StatelessWidget {
/// when it is used as a page transition.
final Animation<double> animation;

/// The alignment of scale anchor point, relative to it's child.
///
/// By default, the child scales from it's center when fading in. In a
/// variation on the default behavior, the scale anchor point can be
/// repositioned from the center of a child to another location within
/// the child.
///
/// For example, when an overflow icon (the parent component) triggers a menu
/// (the child component), the menu's anchor point can be positioned at the
/// top right corner of the menu so that it appears to scale from the overflow
/// icon during a transition.
Comment thread
grinder15 marked this conversation as resolved.
Resolved
final Alignment alignment;

/// The widget below this widget in the tree.
///
/// This widget will transition in and out as driven by [animation] and
Expand Down Expand Up @@ -166,6 +180,7 @@ class FadeScaleTransition extends StatelessWidget {
opacity: _fadeInTransition.animate(animation),
child: ScaleTransition(
scale: _scaleInTransition.animate(animation),
alignment: alignment,
child: child,
),
);
Expand Down