Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: material designframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to reproduce
- Place an Overlay in a box with an unbounded constraint, with canSizeOverlay:true on its OverlayEntry so that it shrink-wraps
- Put a widget that uses OverlayPortal, such as DropdownMenu, inside the entry
- Open the OverlayPortal child, e.g., by tapping the DropdownMenu
Expected results
No assertion is thrown.
Actual results
An assertion is thrown:
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performLayout():
RenderBox.size accessed beyond the scope of resize, layout, or permitted parent access. RenderBox can always access its own size, otherwise, the only object that is allowed to read RenderBox.size is its parent, if they have said they will. If you hit this assert trying to access a child's size, pass "parentUsesSize: true" to that child's layout() in _RenderTheater.performLayout.
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2268 pos 11: 'sizeAccessAllowed'
See the Logs below for the full output.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: UnconstrainedBox(
child: Overlay(
initialEntries: [
OverlayEntry(
canSizeOverlay: true,
builder: (_) => const _Content(),
),
],
),
),
),
),
),
);
}
class _Content extends StatelessWidget {
const _Content();
@override
Widget build(BuildContext context) {
return Container(
width: 300,
height: 300,
color: Colors.lightBlue.shade100,
alignment: Alignment.bottomCenter,
child: DropdownMenu<int>(
label: const Text('Tap to reproduce'),
dropdownMenuEntries: [
for (var i = 1; i <= 3; i++)
DropdownMenuEntry(value: i, label: 'Item $i'),
],
),
);
}
}Screenshots or Video
Logs
Logs
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performLayout():
RenderBox.size accessed beyond the scope of resize, layout, or permitted parent access. RenderBox can always access its own size, otherwise, the only object that is allowed to read RenderBox.size is its parent, if they have said they will. If you hit this assert trying to access a child's size, pass "parentUsesSize: true" to that child's layout() in _RenderTheater.performLayout.
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2268 pos 11: 'sizeAccessAllowed'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=02_bug.yml
The relevant error-causing widget was:
DropdownMenu<int> DropdownMenu:file:///Users/fujidaiti/Dev/navigator_resizable-overlay-compat/example/lib/repro.dart:34:14
When the exception was thrown, this was the stack:
#2 RenderBox.size.<anonymous closure> (package:flutter/src/rendering/box.dart:2268:11)
#3 RenderBox.size (package:flutter/src/rendering/box.dart:2302:6)
#4 _RenderLayoutSurrogateProxyBox.performLayout (package:flutter/src/widgets/overlay.dart:2795:21)
#5 RenderObject.layout (package:flutter/src/rendering/object.dart:2923:7)
#6 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:484:14)
#7 RenderObject.layout (package:flutter/src/rendering/object.dart:2923:7)
#8 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:62:11)
#9 RenderStack._computeSize (package:flutter/src/rendering/stack.dart:647:43)
#10 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:682:12)
#11 RenderObject.layout (package:flutter/src/rendering/object.dart:2923:7)
#12 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:484:14)
#13 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2771:7)
#14 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1174:18)
#15 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1187:15)
#16 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:692:23)
#17 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1573:13)
#18 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:558:5)
#19 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1430:15)
#20 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1345:9)
#21 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1198:5)
#22 _invoke (dart:ui/hooks.dart:441:13)
#23 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:450:5)
#24 _drawFrame (dart:ui/hooks.dart:413:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: _RenderLayoutSurrogateProxyBox#cb077 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT
needs compositing
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
child: RenderSemanticsAnnotations#788db relayoutBoundary=up4 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
semantics node: SemanticsNode#5
Rect.fromLTRB(92.7, 531.0, 309.3, 587.0)
actions: expand, focus
flags: isButton, isTextField, hasEnabledState, isEnabled, isReadOnly, isFocusable, hasExpandedState
traversalParentIdentifier: _OverlayPortalState#421c3
label: "Tap to reproduce"
hint: "Collapsed"
textDirection: ltr
currentValueLength: 0
inputType: text
size: Size(216.6, 56.0)
child: RenderTapRegion#45d90 relayoutBoundary=up5 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
behavior: deferToChild
groupId: MenuController#f8cf9
child: RenderSemanticsAnnotations#1dbe9 relayoutBoundary=up6 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
child: _RenderDropdownMenuBody#40fb4 relayoutBoundary=up7 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
RenderObject: _RenderLayoutSurrogateProxyBox#cb077 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT
needs compositing
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
child: RenderSemanticsAnnotations#788db relayoutBoundary=up4 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
semantics node: SemanticsNode#5
Rect.fromLTRB(92.7, 531.0, 309.3, 587.0)
actions: expand, focus
flags: isButton, isTextField, hasEnabledState, isEnabled, isReadOnly, isFocusable, hasExpandedState
traversalParentIdentifier: _OverlayPortalState#421c3
label: "Tap to reproduce"
hint: "Collapsed"
textDirection: ltr
currentValueLength: 0
inputType: text
size: Size(216.6, 56.0)
child: RenderTapRegion#45d90 relayoutBoundary=up5 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
behavior: deferToChild
groupId: MenuController#f8cf9
child: RenderSemanticsAnnotations#1dbe9 relayoutBoundary=up6 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, 56.0)
child: _RenderDropdownMenuBody#40fb4 relayoutBoundary=up7 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=300.0, 0.0<=h<=300.0)
size: Size(216.6, Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.47.4, on macOS 26.6.2 25G83 darwin-arm64, locale ja-JP) [629ms]
• Flutter version 3.47.4 on channel stable at /Users/fujidaiti/.fvm/versions/3.47.4
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9584c6713b (5 days ago), 2026-09-10 15:25:10 -0700
• Engine revision 06a2e2a110
• Dart version 3.13.3
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [2.3s]
• Android SDK at /Users/fujidaiti/Library/Android/sdk
• Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
• Platform android-37.0, build-tools 37.0.0
• ANDROID_HOME = /Users/fujidaiti/Library/Android/sdk
• Java binary at: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Temurin-17.0.20.1+1 (build 17.0.20.1+1)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.5) [1,387ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17F42
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (3 available) [7.0s]
• iPhone 17 (mobile) • 5C8B5F23-484F-46AD-A497-CC9135E971B6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-26-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 26.6.2 25G83 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 152.0.7977.83
! Error: Browsing on the local area network for P240202. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources [537ms]
• All expected network resources are available.
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: material designframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team

Activity
fujidaiti commentedon Sep 16, 2026
I ran into this while building an experimental layout in which a Navigator is given unbounded constraints so that it shrink-wraps to the current route's content, instead of filling the entire screen.
If I understand the root cause correctly, the deferred child falls back to reading the RenderTheater's size when the theater's constraints are unbounded, but which is rejected as it is not permitted to do so:
flutter/packages/flutter/lib/src/widgets/overlay.dart
Lines 2791 to 2804 in 60bae28
I think reading the theater's size is legitimate here, so the fix would be bypassing the assertion somehow, for example by cacheing the last measured size in the theater and read it here instead of RenderBox.size.
I hope the issue gets fixed for my very niche use case :)
Or, if you don't mind and the idea above is heading in the right direction, I could send a PR. Thank you.
suryaKommana2662 commentedon Sep 16, 2026
@fujidaiti Thanks for the report. I was able to reproduce the issue locally on macOS, iOS simulator and Android emulator using the provided code sample. I observed the following assertion when opening the DropdownMenu:
The stack trace also points to _RenderLayoutSurrogateProxyBox.performLayout in packages/flutter/lib/src/widgets/overlay.dart. Routing this to the framework team for further investigation.
Flutter Doctor Output
justinmc commentedon Sep 29, 2026
FYI @LongCatIsLooong
Fix OverlayPortal layout in shrink-wrapped overlays
Fix OverlayPortal layout in shrink-wrapped overlays (flutter#193079)
github-actions commentedon Oct 24, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.Fix OverlayPortal layout in shrink-wrapped overlays (flutter#193079)