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
Scale MediaQuery view insets to account for scaled height and width #25
Conversation
Amazing! Thank you so much for the help. Let me review and merge this week and then I can add you as a contributor |
In my test with a large SafeArea inset, the inset does not look like it is scaled. |
Oh I forgot about the SafeArea. SafeArea uses |
Can you test with the latest commit and see if it fixes it? |
No, setting the ViewPadding did not solve the issue. MediaQueryData calculateMediaQueryData() {
// Update passed in MediaQueryData.
if (widget.mediaQueryData != null) {
return widget.mediaQueryData.copyWith(
size: Size(scaledWidth, scaledHeight),
devicePixelRatio: devicePixelRatio * activeScaleFactor,
viewInsets: scaledViewInsets,
padding: scaledViewPadding);
}
return MediaQuery.of(context).copyWith(
size: Size(scaledWidth, scaledHeight),
devicePixelRatio: devicePixelRatio * activeScaleFactor,
viewInsets: scaledViewInsets,
padding: scaledViewPadding);
} Also, are you able to explain the difference between the viewPadding and Padding? So the correct implementation is to always set the viewPadding to the window viewPadding while inheriting the Would you be able to update your PR again? (thanks!) |
Ok I think I have it right this time! It passed the test I did. When I read the documentation the first time I read that the |
Perfect @SpencerLindemuth , tested and LGTM. |
Thank you so much for creating this PR as I did not have the time. This allows me to close so many issues. I've added you as contributor to the ReadMe with the v0.0.10 release. |
MediaQuery view insets return the values from the unscaled screen resolution so when you scale the screen size, the size of the media query becomes disproportionate. As scaledSize increases MediaQuery view insets move elements a smaller and smaller amount.