-
Notifications
You must be signed in to change notification settings - Fork 70
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: Consider directionality for pagination animation #272
Conversation
Animation<Offset> mainContentSlidePosition( | ||
AnimationController controller, | ||
WoltModalSheetPaginationAnimationStyle style, { | ||
required double sheetWidth, | ||
required double screenWidth, | ||
required bool isForwardMove, | ||
required bool isLTR, // New parameter to determine the text direction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required bool isLTR, // New parameter to determine the text direction | |
required bool isLTR, // New parameter to determine the text direction |
Instead of this, we could use a textDirection
parameter and pass Directionality.of(context)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this parameter optional? That way we can always default to LTR when this parameter is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the parameter type: d5fab23
I would avoid making it optional. First of all, this is not public API. Second, the maintainers should always consider the directionality when calling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second, the maintainers should always consider the directionality when calling this.
I agree, it should be textDirection
which is the value of Directionality.of(context)
instead a bool
parameter for "isLTR'
lib/src/content/components/paginating_group/wolt_modal_sheet_page_transition_state.dart
Outdated
Show resolved
Hide resolved
Animation<Offset> mainContentSlidePosition( | ||
AnimationController controller, | ||
WoltModalSheetPaginationAnimationStyle style, { | ||
required double sheetWidth, | ||
required double screenWidth, | ||
required bool isForwardMove, | ||
required bool isLTR, // New parameter to determine the text direction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this parameter optional? That way we can always default to LTR when this parameter is null.
157a0bc
to
d5fab23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary
ThisPR introduces support for both Left-to-Right (LTR) and Right-to-Left (RTL) text directions in the slide animation logic for modal sheet page transitions. The mainContentSlidePosition method is updated to handle different slide directions based on a new
isLTR
parameter.Changes
Calculated directionMultiplier based on
isLTR
andisForwardMove
to correctly adjust the animation direction.For LTR (isLTR = true), the multiplier is 1 for forward moves and -1 for backward moves.
For RTL (isLTR = false), the multiplier is -1 for forward moves and 1 for backward moves.
before_ltr.mov
after_ltr.mov
before_rtl.mov
after_rtl.mov
Related Issues
Fixes #266
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.
///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
after_rtl.mov