-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[flutter_adaptive_scaffold] use MediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuilds
#6544
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
[flutter_adaptive_scaffold] use MediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuilds
#6544
Conversation
MediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuildsMediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuilds
|
Thanks for the PR! This is indeed a good idea. Could you please add a test that keeps this from regressing? (tests are required as part of our contribution guidelines) |
gspencergoog
left a comment
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.
justinmc
left a comment
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 👍 Good catch!
…f `MediaQuery.of` to prevent unnecessary rebuilds (flutter/packages#6544)
flutter/packages@cc47b06...aea93d2 2024-04-30 [email protected] Skip podspec Swift Search Path validation if only swift file is Package.swift (flutter/packages#6627) 2024-04-30 [email protected] [go_router_builder] Tweaks for latest analyzer-6.5.0 (flutter/packages#6632) 2024-04-30 [email protected] Roll Flutter from db8c475 to b597dd2 (23 revisions) (flutter/packages#6631) 2024-04-30 [email protected] [flutter_adaptive_scaffold] use `MediaQuery.sizeOf` instead of `MediaQuery.of` to prevent unnecessary rebuilds (flutter/packages#6544) 2024-04-30 [email protected] [image_picker] Update documentation to note that Photo Picker use is non-optional on Android 13+ (flutter/packages#6569) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…Query.of` to prevent unnecessary rebuilds (flutter#6544) the `isActive` method uses `MediaQuery.of(context).size.width`, which triggers widget rebuilds whenever a property of `MediaQuery` changes, even when the size.width doesn't change. instead, we should be using `MediaQuery.sizeOf(context).width`. fixes: flutter/flutter#146801

the
isActivemethod usesMediaQuery.of(context).size.width, which triggers widget rebuilds whenever a property ofMediaQuerychanges, even when the size.width doesn't change.instead, we should be using
MediaQuery.sizeOf(context).width.fixes: flutter/flutter#146801
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.