Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Wolt dialog type position animation updated #246

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
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
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
Loading