Skip to content
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2c3e5b8
init
LouiseHsu Dec 10, 2025
2a7035e
Apply suggestion from @gemini-code-assist[bot]
sfshaza2 Dec 12, 2025
644b41f
Apply suggestion from @gemini-code-assist[bot]
sfshaza2 Dec 12, 2025
5f9ba4d
Apply suggestion from @gemini-code-assist[bot]
sfshaza2 Dec 12, 2025
7731fa3
Update src/content/add-to-app/ios/add-flutter-screen.md
LouiseHsu Dec 12, 2025
774ac1d
line break, sp
LouiseHsu Dec 12, 2025
a3c3218
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
e79f784
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
2219b4f
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
90c5612
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
1ad101d
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
9eb6861
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
32b6d3d
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
fe23e20
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
12a618b
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Dec 15, 2025
df7e4b7
Merge branch 'main' into content-resizing
parlough Jan 12, 2026
2776c6b
Update src/content/add-to-app/ios/add-flutter-screen.md
LouiseHsu Jan 28, 2026
f2fbece
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Feb 4, 2026
d5fdf2b
Update src/content/add-to-app/ios/add-flutter-screen.md
sfshaza2 Feb 4, 2026
1788c42
Merge branch 'main' into content-resizing
sfshaza2 Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 64 additions & 3 deletions src/content/add-to-app/ios/add-flutter-screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,66 @@ you're free to push data or prepare your Flutter environment
in any way you'd like, before presenting the Flutter UI using a
`FlutterViewController`.

## Content-sized views

On iOS, you can also set your embedded `FlutterView` to size itself based off its content.

<Tabs key="darwin-language">
<Tab name="Swift">

```swift
let flutterViewController = FlutterViewController(engine: engine, nibName: nil, bundle: nil)
flutterViewController.isAutoResizable = true
```

</Tab>
<Tab name="Objective-C">

```objc
_flutterViewController = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil];
_flutterViewController.autoResizable = YES;
```

</Tab>
</Tabs>

### Restrictions

To use this, your root widget must support unbounded constraints. Avoid using widgets that require bounded constraints (like `ListView` or `LayoutBuilder`) at the top of your tree, as they can conflict with the dynamic sizing logic.

In practice, this means that quite a few common widgets are not supported,
such as `ScaffoldBuilder`, `CupertinoTimerPicker`,
or any widget that internally relies on a `LayoutBuilder`.
When in doubt, you can use an `UnconstrainedBox` to test the usability of
a widget for a content-sized view, as in the following example:

```dart
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context)
=> MaterialApp(home: MyPage());
}

class MyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: UnconstrainedBox(
// TODO: Edit this line to check if a widget
// can cause problems with content-sized views.
child: Text('This works!'),
// child: Column(children: [Column(children: [Expanded(child: Text('This blows up!'))])]),
// child: ListView(children: [Text('This blows up!')]),
)
);
}
}
```
For a working example, refer to this [sample project][].

[`FlutterEngine`]: {{site.api}}/ios-embedder/interface_flutter_engine.html
[`FlutterViewController`]: {{site.api}}/ios-embedder/interface_flutter_view_controller.html
Expand All @@ -785,6 +845,7 @@ in any way you'd like, before presenting the Flutter UI using a
[`WidgetsApp`]: {{site.api}}/flutter/widgets/WidgetsApp-class.html
[`PlatformDispatcher.defaultRouteName`]: {{site.api}}/flutter/dart-ui/PlatformDispatcher/defaultRouteName.html
[Start a FlutterEngine and FlutterViewController section]:/add-to-app/ios/add-flutter-screen/#start-a-flutterengine-and-flutterviewcontroller
[`Observable`]: https://developer.apple.com/documentation/observation/observable
[`NavigationLink`]: https://developer.apple.com/documentation/swiftui/navigationlink
[`Observable()`]: https://developer.apple.com/documentation/observation/observable()
[`Observable`]: {{site.apple-dev}}/documentation/observation/observable
[`NavigationLink`]: {{site.apple-dev}}/documentation/swiftui/navigationlink
[`Observable()`]: {{site.apple-dev}}/documentation/observation/observable()
[sample project]: {{site.repo.samples}}/tree/main/add_to_app/ios_content_resizing
Loading