Skip to content

Allow an embedded Flutter Web view to size itself #134501

@jacobsimionato

Description

@jacobsimionato

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:

  1. Perform build/layout based within a large container that has some reasonable maximum size
  2. Check the actual size of the content and resize the DOM element to match
  3. Paint into the DOM element (ideally no more expensive than if we had known this size up front?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listc: new featureNothing broken; request for a new capabilitycustomer: mulligan (g3)engineflutter/engine related. See also e: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions