[beta] CP request for https://github.com/flutter/flutter/pull/167677#168386
Conversation
…havior (flutter#167677) Fixes flutter#166118 Adds a second button to the on-device inspector that allows a developer to temporarily disable the default "tap triggers widget selection" behavior without fully exiting out of widget selection mode. Fixes an issue where enabling/disabling widget selection is destructive for some app set-ups, causing the developer's app to lose state.  <img width="130" alt="Screenshot 2025-04-23 at 12 22 41 PM" src="proxy.php?url=https://github.com/user-attachments/assets/e643fd26-6bcb-43a2-a718-191e1831345f" /> <img width="113" alt="Screenshot 2025-04-23 at 12 22 48 PM" src="proxy.php?url=https://github.com/user-attachments/assets/5ac81455-64f0-4f07-9b36-b8fd498a9669" /> <img width="105" alt="Screenshot 2025-04-23 at 12 21 46 PM" src="proxy.php?url=https://github.com/user-attachments/assets/49c67f6f-7d90-4758-83e9-ed8bf5505bae" /> <img width="108" alt="Screenshot 2025-04-23 at 12 21 55 PM" src="proxy.php?url=https://github.com/user-attachments/assets/aeca0178-872d-441e-ae5f-e9b469d83d60" /> <img width="399" alt="Screenshot 2025-04-22 at 2 21 46 PM" src="proxy.php?url=https://github.com/user-attachments/assets/0ad45cee-15cf-45af-9fa0-c0955296aa29" /> <img width="134" alt="Screenshot 2025-04-23 at 12 20 19 PM" src="proxy.php?url=https://github.com/user-attachments/assets/9b34a6c2-5308-465e-b842-0fb180d25865" /> <img width="123" alt="Screenshot 2025-04-23 at 12 20 26 PM" src="proxy.php?url=https://github.com/user-attachments/assets/7c601831-91c8-440e-98ae-070444574ff9" /> <img width="106" alt="Screenshot 2025-04-22 at 2 21 38 PM" src="proxy.php?url=https://github.com/user-attachments/assets/517839d5-25d8-42e7-a9b9-f35a77725afc" /> <img width="103" alt="Screenshot 2025-04-22 at 2 21 55 PM" src="proxy.php?url=https://github.com/user-attachments/assets/390f0b0f-1a9b-4880-b686-fabe102fe7b6" />
|
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
|
I think this CP should have a reviewer from the framework team given the changes it contains in the framework, and the original PR didn't have a reviewer from that team. cc @Piinks |
| Widget _exitWidgetSelectionButtonBuilder( | ||
| BuildContext context, { | ||
| required VoidCallback onPressed, | ||
| required String semanticLabel, |
There was a problem hiding this comment.
FYI for future changes, we're desperately trying to align on semantic*s*Label across the framework. This is private so we can fix it pretty easily with the work we're already doing on this later.
There was a problem hiding this comment.
Ah good to know, thanks!
| import 'scaffold.dart' show ScaffoldMessenger, ScaffoldMessengerState; | ||
| import 'scrollbar.dart'; | ||
| import 'theme.dart'; | ||
| import 'theme_data.dart'; |
There was a problem hiding this comment.
theme.dart exports theme_data.dart, I don't think this is necessary.
Nitty, can clean up in a separate change.
| /// Returns [buttonSize] if the variant is [InspectorButtonVariant.iconOnly], | ||
| /// otherwise returns [buttonIconSize]. | ||
| double get iconSizeForVariant => | ||
| variant == InspectorButtonVariant.iconOnly ? buttonSize : buttonIconSize; |
There was a problem hiding this comment.
This should be an exhaustive switch statement in case more variants are added in the future.
Piinks
left a comment
There was a problem hiding this comment.
LGTM - nits below don't appear necessary for this CP, but can you can follow up with them later? 🙏
| foregroundColor: foreground, | ||
| backgroundColor: background, | ||
| side: | ||
| variant == InspectorButtonVariant.toggle && !toggledOn! |
There was a problem hiding this comment.
Same here re: exhaustive switches
Yes, will open up a PR against |
8545480
into
flutter:flutter-3.32-candidate.0
CP request for #167677 into flutter-3.32-candidate.0
Impacted Users: Some subset of widget inspector users with a specific configuration of
package:go_router, see upvotes and comments on #166118.Impact Description: Depending on how users have configured their routes using
package:go_router, enabling / disabling the widget inspector can be destructive to their app's routing state, preventing them from inspecting widgets on secondary screens of their app.Workaround: No workaround available.
Risk: Low
Test Coverage: Yes, tests were added and this has been manually tested as well
Validation Steps: