-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Copied from internal bug b/298531093
I'm integrating an embedded Flutter Web into a Google product. One of its limitations is that the Flutter view can only size itself to fill its viewport contents and not vice-versa.
For example, if I attach a Flutter view to this div:
Then the Flutter view will be (correctly) constrained to 100x100, but if I don't specify the div's dimensions: The Flutter will assume that the viewport size is 0x0.The expected behavior, at least for me, would be for the viewport to take the size reported by the Flutter view.
Right now I can sort of get away with having a fixed height and variable width, but I run into problems when the browser window is resized (see b/298531093 for details). For certain kinds of embedded views, especially small views with dynamic content, it is difficult and a poor user experience to give the content a fixed size before rendering. Ideally, it would be possible for Flutter to render and resize it's DOM element depending on the outcome. I'm not sure how this feature request interacts with the actual rendering mechanics or if that makes the layout much more expensive... Maybe the process could be something like:
- Perform build/layout based within a large container that has some reasonable maximum size
- Check the actual size of the content and resize the DOM element to match
- Paint into the DOM element (ideally no more expensive than if we had known this size up front?)