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 position offset do not work when movingOnWindowChange is false #100

Merged
merged 6 commits into from
Aug 4, 2023

Conversation

lzw-all-in
Copy link
Contributor

@lzw-all-in lzw-all-in commented May 11, 2023

The position parameter is not working when set movingOnWindowChange = false.

Sometimes I want it to be a bit higher than the bottom center. And after I set the offset value just find it not work.

position: ToastPosition.bottom.copyWith(offset: -100)

Resolve #63

Before After

@lzw-all-in
Copy link
Contributor Author

Hi @AlexV525 Could you help me to review this PR ?

Thanks!

Comment on lines 94 to 99
if (movingOnWindowChange != true) {
return Padding(
padding: offsetPadding ?? EdgeInsets.zero,
child: w,
);
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we continue to use the AnimatedPadding below instead of returning a new Padding widget?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlexV525 Sorry for being late. It's reusing AnimatedPadding now.

Thanks for your suggestion!

final EdgeInsets windowInsets;
if (movingOnWindowChange) {
windowInsets = EdgeInsets.only(
bottom: MediaQueryData.fromWindow(ui.window).viewInsets.bottom,
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for being late again (the notification was flushed in my queue). Can we get rid of .fromWindow? It's been deprecated IIRC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @AlexV525, sorry for the late. Replace the deprecated method fromWindow to fromView. Could you help me review it again ? Thanks!

@AlexV525
Copy link
Member

AlexV525 commented Aug 3, 2023

The PR looks good overall. Could you add some tests?

@lzw-all-in
Copy link
Contributor Author

The PR looks good overall. Could you add some tests?

Hi @AlexV525 Test added. Pls help review. Thanks.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@lzw-all-in lzw-all-in requested a review from AlexV525 August 3, 2023 22:39
@lzw-all-in
Copy link
Contributor Author

Hi @AlexV525 , I'm pushed a new change which fix the error in Github action.

@AlexV525 AlexV525 merged commit 9461dbc into OpenFlutter:main Aug 4, 2023
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.

position offset do not work when movingOnWindowChange is false
2 participants