Comments (2)
I am confused about what this is asking for. Some questions/comments inline:
The wrong way is easy to use and hard to catch in code review because of the similarity.
This could be resolved with a lint, for which there's already a request: dart-lang/linter#4448
In contrast if you want a widget to branch on the space available then LayoutBuilder's api works well.
If you want to branch on "space available" LayoutBuilder is the right choice. MediaQuery will always give you the size of the screen, which is often NOT the available space.
This proposal suggest adding a sibling object to the existing builder of LayoutBuilder
How does adding something new that nobody know about solve the discoverability problem mentioned in the first paragraph?
that under the hood uses MediaQuery.sizeof and then converts that data into a boxConstraints
Why would you want to do that? What is the use case here? If you want to build a UI based on the available space you should NOT use MediaQuery.sizeOf. Instead, the existing LayoutBuilder (or some custom RenderObject) is the way to go.
It took me a long time to discover Dialog.fullscreen
How does Dialog.fullscreen
relate to this discussion? That seems to be a different API for something different?
from flutter.
I am confused about what this is asking for. Some questions/comments inline:
The wrong way is easy to use and hard to catch in code review because of the similarity.
This could be resolved with a lint, for which there's already a request: dart-lang/linter#4448
Yes lint might be the easiest way to catch this class of error.
In contrast if you want a widget to branch on the space available then LayoutBuilder's api works well.
If you want to branch on "space available" LayoutBuilder is the right choice. MediaQuery will always give you the size of the screen, which is often NOT the available space.
kind of, but the spirit of this proposal is to have layout builder give you either the size of the app (what media query does) or the size of the available space. Media query does not give the size of the screen as I understand screen it gives the size of the app's drawing window which is a subset of the Display. Display maps more closely to screen in my mind.
This proposal suggest adding a sibling object to the existing builder of LayoutBuilder
How does adding something new that nobody know about solve the discoverability problem mentioned in the first paragraph?
If we had LayoutBuilder.localBuilder and LayoutBuilder.appBuilder then when you used (or searched for how to fork widgets based on space) one you could find the other more easily than having to know (or search) about different classes.
that under the hood uses MediaQuery.sizeof and then converts that data into a boxConstraints
Why would you want to do that? What is the use case here? If you want to build a UI based on the available space you should NOT use MediaQuery.sizeOf. Instead, the existing LayoutBuilder (or some custom RenderObject) is the way to go.
This question makes me think I did a poor job of explaining the proposal. I know when to use MediaQuery.sizeOf and when to use LayoutBuilder. The proposal is to use layout builder to do both jobs.
It took me a long time to discover Dialog.fullscreen
How does
Dialog.fullscreen
relate to this discussion? That seems to be a different API for something different?
This is an example of the issue of default constructors mixed with named constructors making natural discoverability more difficult. Natural in this case means finding functionality while writing code.
from flutter.
Related Issues (20)
- [Impeller] Add native Android tracing from the engine.
- et: can't authenticate HOT 5
- [tool_crash] HttpException HOT 1
- [tool_crash] ShaderCompilerException HOT 1
- iOS app using Firebase crashes when "Sign-in with Google" is clicked HOT 1
- [Web] Custom Google maps markers are not rendered in mobile web browser HOT 3
- [tool_crash] HttpException HOT 1
- et: `context deadline exceeded` HOT 3
- et: debug symbols have incorrect paths HOT 8
- [Impeller] TextureSourceVK::SetLayout API is hard to use correctly.
- Flutter seemingly not pushing new dev builds without first running `flutter clean` HOT 10
- directory "/usr/lib/flutter/bin/cache/artifacts/gradle_wrapper" does not exist, nothing to copy HOT 2
- linux-30 has temperature issue with battery. HOT 1
- [et] No build profile for `ios_debug_unopt`
- [Impeller] Ensure a wait on the previous buffers fence/semaphore is performed when recycling AHB textures. HOT 2
- Infinite logs containing references to PVRSRVBridgeCall & BridgeDevmemIntUnreserveRange2 HOT 1
- [rbe] `clangd` emits parsing errors when RBE is enabled. HOT 1
- Main page isn't updated as expected without error HOT 1
- [material/menu_anchor.dart] Menu Anchor focus traversal inconsistent on web and desktop. HOT 2
- InkSparkle.constantTurbulenceSeedSplashFactory causes a runtime error in web HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.