mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
### Changes
* Introduces a new `viewConstraints` JS configuration parameter to configure max/min width/height constraints for a view. Those can have the following values:
* An integer `>= 0`: max/min size in pixels
* `Infinity` (or `Number.POSITIVE_INFINITY`): (only for max values) -> **unconstrained**.
* When any value is not set, it defaults to "tight to the current size".
* See [Understanding constraints](https://docs.flutter.dev/ui/layout/constraints).
* Computes the correct `physicalConstraints` of a view off of its `physicalSize` and its `viewConstraints` for the framework to use during layout.
* When no constraints are passed, the current behavior is preserved: the default constraints are "tight" to the `physicalSize`.
* Resizes the current view DOM when requested by the framework and updates its internal physicalSize, then continues with the render procedure.
### Example
This is how we can configure a view to "take as much vertical space as needed":
```js
flutterApp.addView({
viewConstraints: {
minHeight: 0,
maxHeight: Infinity,
},
hostElement: ...,
});
```
### TODO
* Needs actual unit tests
### Issues
* Fixes https://github.com/flutter/flutter/issues/137444
* Closes https://github.com/flutter/engine/pull/48541
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Description
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
androidapp-frameworkcross-platformdartdart-platformdesktopflutterflutter-packagefuchsiaioslinux-desktopmacosmaterial-designmobilemobile-developmentskiawebweb-frameworkwindows
2.5 GiB
Languages
Dart
75%
C++
16.5%
Objective-C++
2.9%
Java
2.8%
Objective-C
0.7%
Other
1.9%