Skip to content

Commit

Permalink
Merge pull request #74 from fluttercommunity/feature/reverseAnimation…
Browse files Browse the repository at this point in the history
…Curve

Added reverseAnimationCurve property to BackdropScaffold
  • Loading branch information
WieFel committed Feb 2, 2021
2 parents 01f118e + f769c20 commit 2783653
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,17 @@ class BackdropScaffold extends StatefulWidget {
/// Defaults to `false`.
final bool stickyFrontLayer;

/// The animation curve passed to [Tween.animate]() when triggering
/// The animation curve passed to [Tween.animate] when triggering
/// the backdrop animation.
///
/// Defaults to [Curves.easeInOut].
/// Defaults to [Curves.ease].
final Curve animationCurve;

/// The reverse animation curve passed to [Tween.animate].
///
/// If not set, [animationCurve.flipped] is used.
final Curve reverseAnimationCurve;

/// Background [Color] for the back layer.
///
/// Defaults to `Theme.of(context).primaryColor`.
Expand Down Expand Up @@ -269,7 +274,8 @@ class BackdropScaffold extends StatefulWidget {
"This feature was deprecated after v0.2.17.")
this.iconPosition = BackdropIconPosition.leading,
this.stickyFrontLayer = false,
this.animationCurve = Curves.easeInOut,
this.animationCurve = Curves.ease,
this.reverseAnimationCurve,
this.frontLayerBackgroundColor,
this.backLayerBackgroundColor,
this.inactiveOverlayColor = const Color(0xFFEEEEEE),
Expand Down Expand Up @@ -457,9 +463,10 @@ class BackdropScaffoldState extends State<BackdropScaffold>
begin: RelativeRect.fromLTRB(0.0, backPanelHeight, 0.0, frontPanelHeight),
end: RelativeRect.fromLTRB(0.0, 0.0, 0.0, 0.0),
).animate(CurvedAnimation(
parent: controller,
curve: widget.animationCurve,
));
parent: controller,
curve: widget.animationCurve,
reverseCurve:
widget.reverseAnimationCurve ?? widget.animationCurve.flipped));
}

Widget _buildInactiveLayer(BuildContext context) {
Expand Down

0 comments on commit 2783653

Please sign in to comment.