[Proposal] Extend LayoutBuilder to handle full app cases.
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
When talking to an experienced user experience flutter dev about the difficulties in teaching others to build widgets in an adaptive way one of the complaints was that `MediaQuery.of` the using size is very easy to use but inefficient because it triggers a rebuild on lots of changes unrelated to size. The more efficient way to change layout is `MediaQuery.sizeOf`which rebuilds only on size.
The wrong way is easy to use and hard to catch in code review because of the similarity. In addition they mentioned that it is unclear what Media the `MediaQuery` object is referring too.
In contrast if you want a widget to branch on the space available then `LayoutBuilder`'s api works well.
This proposal suggest adding a sibling object to the existing builder of `LayoutBuilder` that is named something like `appBuilder` that under the hood uses MediaQuery.sizeof and then converts that data into a boxConstraints. In addition to help with discoverability we suggest that there is a localBuilder that has the existing behavior of builder.
"It took me a long time to discover Dialog.fullscreen. I had no idea existed because it'd never show up in autocomplete."
With this proposal we could suggest in our adaptive layout docs to only use LayoutBuilder.
Contributor guide
Assessment
This issue has not been assessed yet.