Skip to content

Conversation

@goderbauer
Copy link
Member

@goderbauer goderbauer commented Nov 17, 2023

Towards #134501.

This change is based on flutter/engine#48090. It changes the RenderView to be dynamically sized based on its content if the FlutterView it is configured with allows it (i.e. the FlutterView has loose FlutterView.physicalConstraints). For that, it uses those physicalConstraints as input to the layout algorithm by passing them on to its child (after translating them to logical constraints via the device pixel ratio). The resulting Size that the RenderView would like to be is then communicated back to the engine by passing it to the FlutterView.render call.

Tests will fail until flutter/engine#48090 has rolled into the framework.

@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. a: animation Animation APIs labels Nov 17, 2023
@goderbauer goderbauer changed the title Dynamically sized views Dynamic view sizing Nov 20, 2023
@goderbauer goderbauer force-pushed the dynamically-sized-views branch from 9dcfe19 to 84c5798 Compare November 20, 2023 22:38
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @jacob314 @kenzieschmoll Is this change going to have any impact on DevTools or other widget inspector use cases?

Background: Prior to this change, the root RenderView would claim that its constraints are null. With this change, we are actually giving the RenderView proper constraints. This enables the use case to size the RenderView based on its actual content, which is something people are asking for on the web: When Flutter is embedded into an existing web page, the Flutter HTML element should only take up as much space as the Flutter-rendered content needs. The embedder can communicate legal sizes for the element by providing constraints, which the framework then uses as the input to its layout algorithm (instead of just using a fixes size as before).

Since there's a specific test in here to ensure that the constraints of the RenderView are null I wanted to check with you whether you anticipate this breaking anything on your end when that is no longer true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out your branch and connected to gallery with the Flutter inspector. I didn't see any issues with this change. @jacob314 feel free to add anything if something stands out to you as problematic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No concerns at all. Potentially that test could be documented to make it clearer that it is more of a golden test than enforcing invariants required by the widget inspector.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for confirming!

@goderbauer goderbauer force-pushed the dynamically-sized-views branch from 69143d4 to 74c3404 Compare November 21, 2023 20:48
@goderbauer goderbauer marked this pull request as ready for review November 21, 2023 20:51
Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(RS)LGTM!

(There's some areas that I've never touched, like rendering/box or the binding, but everything seems to make sense, and this works on my apps, so...)

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like ViewConstraints.tight could be const, allowing this to be const.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto-submit bot pushed a commit that referenced this pull request Nov 27, 2023
Towards #134501.

Required to roll flutter/engine#48090 into the framework.

**DO NOT SUBMIT until #138648 and flutter/engine#48090 are ready.**
auto-submit bot pushed a commit to flutter/engine that referenced this pull request Nov 27, 2023
Towards flutter/flutter#134501.

This PR makes the following changes to the public dart:ui API:

* It adds the `FlutterView.pysicalConstraints` property that describes max and min width and height for a view. The framework is allowed to size the `FlutterView` to any `Size` that meets these constraints.
* It adds an optional `size` argument to `FlutterView.render`. The framework provides the chosen `Size` that meets the aforementioned constraints to the `render` method. If the `FlutterView.pysicalConstraints` are tight (minHeight == maxHeight and minWidth == maxWidth) the argument is optional to remain backwards compatible. In all other cases, a `Size` must be provided.
* It adds a `ViewConstraints` class, which is basically the `dart:ui` version of `BoxConstraints` (This is similar to how we have `ViewPadding` in dart:ui to mirror `EdgeInsets` from the framework). It describes the constraints of a `FlutterView`, i.e. it powers the `FlutterView.pysicalConstraints` property.

This change does not wire anything up to the embedders. For now, `FlutterView.pysicalConstraints` just returns tight constraints for the embedder-provided size of the view (`FlutterView.physicalSize`) and the size provided to `FlutterView.render` is ignored (after it is checked that it meets the constrains). 

This PR enables the framework to implement the new dynamic view sizing and embedders to separately expose the new functionality to their clients.

Presubmits will fail until flutter/flutter#138565 is submitted to the framework.

**DO NOT SUBMIT until flutter/flutter#138648 is ready.**
@goderbauer goderbauer force-pushed the dynamically-sized-views branch 2 times, most recently from 63fbd5d to 4ab8bd6 Compare November 29, 2023 17:28
cbracken added a commit to cbracken/flutter that referenced this pull request May 21, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support for dynamic view resizing in non-web
embedders, it does not *implement* support in any embedder.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 27, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support for dynamic view resizing in non-web
embedders, it does not *implement* support in any embedder.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 27, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support for dynamic view resizing in non-web
embedders, it does not *implement* support in any embedder.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 27, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 29, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request May 29, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
cbracken added a commit to cbracken/flutter that referenced this pull request Jun 12, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 28, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 30, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 31, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Aug 4, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
mboetger pushed a commit to mboetger/flutter that referenced this pull request Aug 8, 2025
This enables support for dynamic view resizing in non-web embedders.
While this patch enables support and exposes API for dynamic view
resizing in non-web embedders and in the embedder API, it does not
*implement* support in any embedder.

This feature is restricted to embedders with merged UI and platform
thread due to the need to inform the embedder of the updated view size
synchronously with presenting the content. With some effort, we could
implement synchronisation logic that supports non-thread-merged
embedders. See ResizeSynchronizer in the macOS embedder for details of
what's involved.

When Flutter applications call `FlutterView.render` with a non-null
`size` parameter, the size will be compared to the existing view size
(if any), and if different, a call to `PlatformView::ResizeView` will be
triggered. Embedders can respond to this call by resizing the underlying
platform-specific FlutterView to the appropriate size.

Extracts a resize_view_callback to the embedder API that custom
embedders can register to receive the updated size from the engine, and
adapt their views accordingly.

Related patches:
* `dart:ui`: flutter/engine#48090
* framework: flutter#138648
* framework reland: flutter#140918
* Web: flutter/engine#50271

Issue: flutter#169147
Issue: flutter#149033
github-merge-queue bot pushed a commit that referenced this pull request Sep 18, 2025
Part of #169147 (iOS) and
#149033 (Android).
Implementation PRs coming up!

This enables support for dynamic view resizing in non-web embedders.
While this PR enables support, it does not _implement_ support.

Specifically, this creates the pipes (in viewport metrics) for min/max
width/height constraints that tell the engine and framework that when
rendering the frame it should adjust the width/height as needed for the
content. The engine should also discard layer trees that do not fit the
constraints.

Since the engine now relies on BoxConstraints, geometry.h has now been
moved out of embedder specific codepath so that both embedder and engine
can depend on it.

Related PRs:
`dart:ui`: flutter/engine#48090
`framework`: #138648
`framework reland`: #140918
`Web`: flutter/engine#50271

## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Matt Boetger <[email protected]>
Co-authored-by: Matt Boetger <[email protected]>
Jaineel-Mamtora pushed a commit to Jaineel-Mamtora/flutter_forked that referenced this pull request Sep 24, 2025
Part of flutter#169147 (iOS) and
flutter#149033 (Android).
Implementation PRs coming up!

This enables support for dynamic view resizing in non-web embedders.
While this PR enables support, it does not _implement_ support.

Specifically, this creates the pipes (in viewport metrics) for min/max
width/height constraints that tell the engine and framework that when
rendering the frame it should adjust the width/height as needed for the
content. The engine should also discard layer trees that do not fit the
constraints.

Since the engine now relies on BoxConstraints, geometry.h has now been
moved out of embedder specific codepath so that both embedder and engine
can depend on it.

Related PRs:
`dart:ui`: flutter/engine#48090
`framework`: flutter#138648
`framework reland`: flutter#140918
`Web`: flutter/engine#50271

## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Matt Boetger <[email protected]>
Co-authored-by: Matt Boetger <[email protected]>
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Part of flutter#169147 (iOS) and
flutter#149033 (Android).
Implementation PRs coming up!

This enables support for dynamic view resizing in non-web embedders.
While this PR enables support, it does not _implement_ support.

Specifically, this creates the pipes (in viewport metrics) for min/max
width/height constraints that tell the engine and framework that when
rendering the frame it should adjust the width/height as needed for the
content. The engine should also discard layer trees that do not fit the
constraints.

Since the engine now relies on BoxConstraints, geometry.h has now been
moved out of embedder specific codepath so that both embedder and engine
can depend on it.

Related PRs:
`dart:ui`: flutter/engine#48090
`framework`: flutter#138648
`framework reland`: flutter#140918
`Web`: flutter/engine#50271

## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Matt Boetger <[email protected]>
Co-authored-by: Matt Boetger <[email protected]>
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
Part of flutter#169147 (iOS) and
flutter#149033 (Android).
Implementation PRs coming up!

This enables support for dynamic view resizing in non-web embedders.
While this PR enables support, it does not _implement_ support.

Specifically, this creates the pipes (in viewport metrics) for min/max
width/height constraints that tell the engine and framework that when
rendering the frame it should adjust the width/height as needed for the
content. The engine should also discard layer trees that do not fit the
constraints.

Since the engine now relies on BoxConstraints, geometry.h has now been
moved out of embedder specific codepath so that both embedder and engine
can depend on it.

Related PRs:
`dart:ui`: flutter/engine#48090
`framework`: flutter#138648
`framework reland`: flutter#140918
`Web`: flutter/engine#50271

## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Matt Boetger <[email protected]>
Co-authored-by: Matt Boetger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: animation Animation APIs a: tests "flutter test", flutter_test, or one of our tests autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants