Skip to content

Commit

Permalink
updated wolt dialog type position animation
Browse files Browse the repository at this point in the history
  • Loading branch information
durannumit committed Jul 1, 2024
1 parent 755b1e0 commit d7361c6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/src/modal_type/wolt_dialog_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,15 @@ class WoltDialogType extends WoltModalType {
const enteringInterval = Interval(0.0, 100.0 / 300.0, curve: Curves.linear);
const exitingInterval = Interval(100.0 / 250.0, 1.0, curve: Curves.linear);

const enteringCubic = Cubic(0.2, 0.6, 0.4, 1.0);
const exitingCubic = Cubic(0.5, 0, 0.7, 0.2);

final interval = isClosing ? exitingInterval : enteringInterval;
final reverseInterval = isClosing ? enteringInterval : exitingInterval;

final cubic = isClosing ? exitingCubic : enteringCubic;
final reverseCubic = isClosing ? enteringCubic : exitingCubic;

final alphaAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
Expand All @@ -132,9 +138,24 @@ class WoltDialogType extends WoltModalType {
reverseCurve: reverseInterval,
));

// Position animation for entering (96px upwards) and exiting (96px downwards)
final positionAnimation = Tween<Offset>(
end: const Offset(0.0, 0.0),
begin: const Offset(0.0, 0.05),
).animate(
CurvedAnimation(
parent: animation,
curve: cubic,
reverseCurve: reverseCubic,
),
);

return FadeTransition(
opacity: alphaAnimation,
child: child,
child: SlideTransition(
position: positionAnimation,
child: child,
),
);
}

Expand Down

0 comments on commit d7361c6

Please sign in to comment.