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

Custom Animation Styles for WoltModalSheet by using #165

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

ulusoyca
Copy link
Collaborator

@ulusoyca ulusoyca commented Mar 16, 2024

Description

This PR allows developers to customize the animation styles for both scrolling and pagination within the WoltModalSheet by using the new WoltModalSheetAnimationStyle class.

The core of this feature is the introduction of the WoltModalSheetAnimationStyle class, which encompasses two key aspects:

  • Pagination Animations: Customize how the modal sheet animates during page transitions. This includes settings for main content opacity, modal sheet height transition, and the sticky action bar (SAB) opacity, among others.
  • Scrolling Animations: Defines animations related to scrolling within the modal sheet. If the the top visibility is set to change as the user scrolls, the WoltModalSheetScrollAnimationStyle covers hero image scaling, top bar translation, and more.

These animations are applied through the WoltModalSheetThemeData.

Example Configuration

WoltModalSheetThemeData(
  animationStyle: WoltModalSheetAnimationStyle(
    paginationAnimationStyle: WoltModalSheetPaginationAnimationStyle(
      mainContentIncomingOpacityCurve: const Interval(
        150 / 350,
        350 / 350,
        curve: Curves.linear,
      ),
      modalSheetHeightTransitionCurve: const Interval(
        0 / 350,
        300 / 350,
        curve: Curves.fastOutSlowIn,
      ),
      incomingSabOpacityCurve: const Interval(
        100 / 350,
        300 / 350,
        curve: Curves.linear,
      ),
      // Define additional pagination animation styles as needed.
    ),
    scrollAnimationStyle: WoltModalSheetScrollAnimationStyle(
      heroImageScaleStart: 1.0,
      heroImageScaleEnd: 0.9,
      topBarTitleTranslationYInPixels: 8.0,
      topBarTranslationYInPixels: 4.0,
      // Define additional scroll animation styles as needed.
    ),
  ),
),
Pagination Scrolling
pagination_animation.mp4
scrolling_anim.mp4

Related Issues

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes tests for all changed/updated/fixed behaviors.
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • The package compiles with the minimum Flutter version stated in the pubspec.yaml

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Copy link

github-actions bot commented Mar 16, 2024

Visit the preview URL for this PR (updated for commit 5def56e):

(expires Mon, 25 Mar 2024 04:35:27 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 906758393beb0353b979d020649d6a1efc40fb5b

@ulusoyca ulusoyca marked this pull request as ready for review March 16, 2024 11:27
Copy link
Collaborator

@TahaTesser TahaTesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some nits!

Comment on lines 76 to 79

final WoltModalSheetScrollAnimationStyle scrollAnimationStyle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 5def56e

Comment on lines 35 to 37

final WoltModalSheetScrollAnimationStyle scrollAnimationStyle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 5def56e

@ulusoyca ulusoyca force-pushed the implement-animation-style-support branch from ee4e85f to 5def56e Compare March 18, 2024 04:32
@ulusoyca ulusoyca enabled auto-merge March 18, 2024 04:32
@ulusoyca ulusoyca merged commit 9f0b8b5 into main Mar 18, 2024
3 checks passed
@ulusoyca ulusoyca deleted the implement-animation-style-support branch March 18, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants