[flutter_adaptive_scaffold] use MediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuilds#6544
Merged
auto-submit[bot] merged 11 commits intoflutter:mainfrom Apr 30, 2024
Conversation
MediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuildsMediaQuery.sizeOf instead of MediaQuery.of to prevent unnecessary rebuilds
Contributor
|
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) |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
May 1, 2024
…f `MediaQuery.of` to prevent unnecessary rebuilds (flutter/packages#6544)
auto-submit bot
pushed a commit
to flutter/flutter
that referenced
this pull request
May 1, 2024
flutter/packages@cc47b06...aea93d2 2024-04-30 15619084+vashworth@users.noreply.github.com Skip podspec Swift Search Path validation if only swift file is Package.swift (flutter/packages#6627) 2024-04-30 ditman@gmail.com [go_router_builder] Tweaks for latest analyzer-6.5.0 (flutter/packages#6632) 2024-04-30 engine-flutter-autoroll@skia.org Roll Flutter from db8c475 to b597dd2 (23 revisions) (flutter/packages#6631) 2024-04-30 44902066+waleedf112@users.noreply.github.com [flutter_adaptive_scaffold] use `MediaQuery.sizeOf` instead of `MediaQuery.of` to prevent unnecessary rebuilds (flutter/packages#6544) 2024-04-30 34871572+gmackall@users.noreply.github.com [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 flutter-ecosystem@google.com,rmistry@google.com 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
TecHaxter
pushed a commit
to TecHaxter/flutter_packages
that referenced
this pull request
May 22, 2024
…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
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.