Skip to content

[Regression]: Hovering on a button in Overlay throws Cannot hit test a render box that has never been laid out #133545

Closed

Description

@mrcsh

Is there an existing issue for this?

Steps to reproduce

I have a widget that creates a button bar in the overlay, with flutter 3.10.x it works fine. When built with flutter 3.13 the following exception is thrown when the mouse hovers over any of the buttons in the button bar.

Updated layout information required for RenderFollowerLayer#d5060 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.

The app then gets in a infinite loop spewing exceptions and is completely unresponsive.

This happens on desktop Linux and web (chrome on Linux)

I did confirm that downgrading flutter to 3.10.6 and running sample code works correctly.

Expected results

expect the tooltip to be shown when mouse is over button

Actual results

exception is thrown and overlay entry disappears

Code sample

Code sample
[code.zip](https://github.com/flutter/flutter/files/12464004/code.zip)

Screenshots or Video

No response

Logs

Logs
here is the full trace

═══════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
Updated layout information required for RenderFollowerLayer#d5060 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.
'package:flutter/src/rendering/object.dart':
object.dart:1
Failed assertion: line 3567 pos 12: '!_needsLayout'

2

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=2_bug.yml

When the exception was thrown, this was the stack
#2 RenderObject._getSemanticsForParent
object.dart:3567
#3 RenderObject._getSemanticsForParent.
object.dart:3583
#4 _RenderTheater.visitChildrenForSemantics
overlay.dart:1151
#5 RenderObject._getSemanticsForParent
object.dart:3581
#6 RenderObject._getSemanticsForParent.
object.dart:3583
#7 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#8 RenderObject.visitChildrenForSemantics
object.dart:3724
#9 RenderAbsorbPointer.visitChildrenForSemantics
proxy_box.dart:3864
#10 RenderObject._getSemanticsForParent
object.dart:3581
#11 RenderObject._getSemanticsForParent.
object.dart:3583
#12 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#13 RenderObject.visitChildrenForSemantics
object.dart:3724
#14 RenderObject._getSemanticsForParent
object.dart:3581
#15 RenderObject._getSemanticsForParent.
object.dart:3583
#16 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#17 RenderObject.visitChildrenForSemantics
object.dart:3724
#18 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#19 RenderObject._getSemanticsForParent
object.dart:3581
#20 RenderObject._getSemanticsForParent.
object.dart:3583
#21 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#22 RenderObject.visitChildrenForSemantics
object.dart:3724
#23 RenderObject._getSemanticsForParent
object.dart:3581
#24 RenderObject._getSemanticsForParent.
object.dart:3583
#25 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#26 RenderObject.visitChildrenForSemantics
object.dart:3724
#27 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#28 RenderObject._getSemanticsForParent
object.dart:3581
#29 RenderObject._getSemanticsForParent.
object.dart:3583
#30 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#31 RenderObject.visitChildrenForSemantics
object.dart:3724
#32 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#33 RenderObject._getSemanticsForParent
object.dart:3581
#34 RenderObject._getSemanticsForParent.
object.dart:3583
#35 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#36 RenderObject.visitChildrenForSemantics
object.dart:3724
#37 RenderObject._getSemanticsForParent
object.dart:3581
#38 RenderObject._getSemanticsForParent.
object.dart:3583
#39 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#40 RenderObject.visitChildrenForSemantics
object.dart:3724
#41 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#42 RenderObject._getSemanticsForParent
object.dart:3581
#43 RenderObject._getSemanticsForParent.
object.dart:3583
#44 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#45 RenderObject.visitChildrenForSemantics
object.dart:3724
#46 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#47 RenderObject._getSemanticsForParent
object.dart:3581
#48 RenderObject._getSemanticsForParent.
object.dart:3583
#49 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#50 RenderObject.visitChildrenForSemantics
object.dart:3724
#51 RenderSemanticsAnnotations.visitChildrenForSemantics
proxy_box.dart:4284
#52 RenderObject._getSemanticsForParent
object.dart:3581
#53 RenderObject._getSemanticsForParent.
object.dart:3583
#54 RenderObjectWithChildMixin.visitChildren
object.dart:4000
#55 RenderObject.visitChildrenForSemantics
object.dart:3724
#56 RenderObject._getSemanticsForParent
object.dart:3581
#57 RenderObject._updateSemantics
object.dart:3533
#58 PipelineOwner.flushSemantics
object.dart:1265
#59 RendererBinding.drawFrame
binding.dart:499
#60 WidgetsBinding.drawFrame
binding.dart:918
#61 RendererBinding._handlePersistentFrameCallback
binding.dart:360
#62 SchedulerBinding._invokeFrameCallback
binding.dart:1297
#63 SchedulerBinding.handleDrawFrame
binding.dart:1227
#64 SchedulerBinding._handleDrawFrame
binding.dart:1085
#65 _invoke (dart:ui/hooks.dart:170:13)
#66 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
#67 _drawFrame (dart:ui/hooks.dart:140:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.1, on Fedora Linux 38 (Thirty Eight) 6.4.6-200.fc38.x86_64, locale en_US.UTF-8)
    • Flutter version 3.13.1 on channel stable at /server/home/csh/lib/flutter3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (6 days ago), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/csh/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /server/home/csh/lib/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 16.0.6 (Fedora 16.0.6-2.fc38)
    • cmake version 3.27.2
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[✓] Android Studio (version 2022.3)
    • Android Studio at /server/home/csh/lib/android-studio
    • Flutter plugin version 75.1.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.81.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.70.0

[✓] Connected device (3 available)
    • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 13 (API 33) (emulator)
    • Linux (desktop)            • linux         • linux-x64      • Fedora Linux 38 (Thirty Eight) 6.4.6-200.fc38.x86_64
    • Chrome (web)               • chrome        • web-javascript • Google Chrome 116.0.5845.96

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. mrcsh commented on Aug 29, 2023

    @mrcsh
    Author

    Also confirmed on windows and macos desktop with 3.13.1

  2. arsd-ansari commented on Aug 29, 2023

    @arsd-ansari

    Wrapping positioned with stack remove the error and the button work fine

    Capture

  3. darshankawar commented on Aug 30, 2023

    @darshankawar
    Member

    Thank for the report. I am able to replicate the reported behavior using latest stable and master wherein, trying to hover over the overlay button options throws below error in the console.

    console error log
    
    today:
    
    
    
    
    
    
    ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
    The following assertion was thrown during a scheduler callback:
    Cannot hit test a render box that has never been laid out.
    The hitTest() method was called on this RenderBox: _RenderDeferredLayoutBox#4e8ad NEEDS-LAYOUT NEEDS-PAINT:
      creator: _DeferredLayout ← _OverlayPortal ← OverlayPortal ← Tooltip ← Semantics ← Align ← Padding ←
        IconTheme ← Builder ← Listener ← RawGestureDetector ← GestureDetector ← ⋯
      parentData: not positioned; offset=Offset(0.0, 0.0)
      constraints: MISSING
      size: MISSING
    Unfortunately, this object's geometry is not known at this time, probably because it has never been
    laid out. This means it cannot be accurately hit-tested.
    If you are trying to perform a hit test during the layout phase itself, make sure you only hit test
    nodes that have completed layout (e.g. the node's children, after their layout() method has been
    called).
    
    When the exception was thrown, this was the stack:
    #0      RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:2442:11)
    #1      RenderBox.hitTest (package:flutter/src/rendering/box.dart:2473:6)
    #2      _RenderTheaterMixin.hitTestChildren.childHitTest (package:flutter/src/widgets/overlay.dart:856:81)
    #3      BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:800:31)
    #4      _RenderTheaterMixin.hitTestChildren (package:flutter/src/widgets/overlay.dart:857:22)
    #5      RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #6      RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #7      RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #8      RenderAbsorbPointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3856:17)
    #9      RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #10     RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:172:19)
    #11     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #12     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #13     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #14     RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:544:18)
    #15     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #16     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #17     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #18     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #19     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #20     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #21     RenderTapRegionSurface.hitTest (package:flutter/src/widgets/tap_region.dart:213:28)
    #22     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #23     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #24     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #25     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #26     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #27     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #28     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
    #29     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2475:11)
    #30     RenderView.hitTest (package:flutter/src/rendering/view.dart:194:14)
    #31     RendererBinding.hitTestInView (package:flutter/src/rendering/binding.dart:534:16)
    #32     RendererBinding.initMouseTracker.<anonymous closure> (package:flutter/src/rendering/binding.dart:319:7)
    #33     MouseTracker._findAnnotations (package:flutter/src/rendering/mouse_tracker.dart:261:60)
    #34     MouseTracker.updateAllDevices.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:375:80)
    #35     MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:210:9)
    #36     MouseTracker.updateAllDevices (package:flutter/src/rendering/mouse_tracker.dart:372:5)
    #37     RendererBinding._scheduleMouseTrackerUpdate.<anonymous closure> (package:flutter/src/rendering/binding.dart:377:22)
    #38     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)
    #39     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1236:9)
    #40     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)
    #41     _invoke (dart:ui/hooks.dart:170:13)
    #42     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
    #43     _drawFrame (dart:ui/hooks.dart:140:31)
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: Cannot hit test a render box that has never been laid out.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 205 pos 12: '!_debugDuringDeviceUpdate': is not true.
    
    

    Below video shows the error:

    133545_s.mov

    The reported errors occurs on desktop and web platforms.

    The same code sample works properly in stable 3.10.6, wherein we are able to hover over the overlay button options properly without throwing any errors:

    133545_so.mov
    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.13.1, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.13.1 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision e1e47221e8 (2 days ago), 2023-08-22 21:43:18 -0700
        • Engine revision b20183e040
        • Dart version 3.1.0
        • DevTools version 2.25.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.14.0-12.0.pre.107, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.14.0-12.0.pre.107 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 56ea352cc0 (2 hours ago), 2023-08-29 21:00:10 -0700
        • Engine revision 69f04bdfe9
        • Dart version 3.2.0 (build 3.2.0-122.0.dev)
        • DevTools version 2.26.2
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
    runnable code sample
    
    import 'package:flutter/material.dart';
    import 'dart:async';
    //import 'overlay_button.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            // This is the theme of your application.
            //
            // TRY THIS: Try running your application with "flutter run". You'll see
            // the application has a blue toolbar. Then, without quitting the app,
            // try changing the seedColor in the colorScheme below to Colors.green
            // and then invoke "hot reload" (save your changes or press the "hot
            // reload" button in a Flutter-supported IDE, or press "r" if you used
            // the command line to start the app).
            //
            // Notice that the counter didn't reset back to zero; the application
            // state is not lost during the reload. To reset the state, use hot
            // restart instead.
            //
            // This works for code too, not just values: Most code changes can be
            // tested with just a hot reload.
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      const MyHomePage({super.key, required this.title});
    
      // This widget is the home page of your application. It is stateful, meaning
      // that it has a State object (defined below) that contains fields that affect
      // how it looks.
    
      // This class is the configuration for the state. It holds the values (in this
      // case the title) provided by the parent (in this case the App widget) and
      // used by the build method of the State. Fields in a Widget subclass are
      // always marked "final".
    
      final String title;
    
      @override
      State<MyHomePage> createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      int _counter = 0;
      final _controller = OverlayButtonController();
      void _incrementCounter([final int delta = 1]) {
        setState(() {
          // This call to setState tells the Flutter framework that something has
          // changed in this State, which causes it to rerun the build method below
          // so that the display can reflect the updated values. If we changed
          // _counter without calling setState(), then the build method would not be
          // called again, and so nothing would appear to happen.
          _counter += delta;
        });
      }
    
      @override
      Widget build(BuildContext context) {
        // This method is rerun every time setState is called, for instance as done
        // by the _incrementCounter method above.
        //
        // The Flutter framework has been optimized to make rerunning build methods
        // fast, so that you can just rebuild anything that needs updating rather
        // than having to individually change instances of widgets.
        return Scaffold(
          appBar: AppBar(
            // TRY THIS: Try changing the color here to a specific color (to
            // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
            // change color while the other colors stay the same.
            backgroundColor: Theme.of(context).colorScheme.inversePrimary,
            // Here we take the value from the MyHomePage object that was created by
            // the App.build method, and use it to set our appbar title.
            title: Text(widget.title),
          ),
          body: Center(
            // Center is a layout widget. It takes a single child and positions it
            // in the middle of the parent.
            child: Column(
              // Column is also a layout widget. It takes a list of children and
              // arranges them vertically. By default, it sizes itself to fit its
              // children horizontally, and tries to be as tall as its parent.
              //
              // Column has various properties to control how it sizes itself and
              // how it positions its children. Here we use mainAxisAlignment to
              // center the children vertically; the main axis here is the vertical
              // axis because Columns are vertical (the cross axis would be
              // horizontal).
              //
              // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
              // action in the IDE, or press "p" in the console), to see the
              // wireframe for each widget.
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                const Text(
                  'You have pushed the button this many times:',
                ),
                Text(
                  '$_counter',
                  style: Theme.of(context).textTheme.headlineMedium,
                ),
                OverlayButton(
                  key: const Key("compose-actions"),
                  controller: _controller,
                  child: const Icon(Icons.add_circle),
                  children: [
                    _IconButton(
                      icon: const Icon(Icons.image),
                      tooltip: 'Send Image',
                      onPressed: () => _incrementCounter(2),
                    ),
                    _IconButton(
                      icon: const Icon(Icons.camera),
                      tooltip: 'camera',
                      onPressed: () => _incrementCounter(5),
                    ),
                    _IconButton(
                      icon: const Icon(Icons.call),
                      tooltip: 'Audio Call',
                      onPressed: () => _incrementCounter(10),
                    ),
                    _IconButton(
                      icon: const Icon(Icons.videocam),
                      tooltip: 'Video Call',
                      onPressed: () => _incrementCounter(50),
                    ),
                  ],
                ),
              ],
            ),
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: const Icon(Icons.add),
          ), // This trailing comma makes auto-formatting nicer for build methods.
        );
      }
    }
    
    class _IconButton extends StatelessWidget {
      final Widget icon;
      final String tooltip;
      final VoidCallback? onPressed;
    
      const _IconButton({
        required this.icon,
        required this.tooltip,
        required this.onPressed,
      });
    
      @override
      Widget build(final BuildContext context) {
        // final t = context.theme;
        return IconButton(
          padding: const EdgeInsets.fromLTRB(14, 8, 14, 10),
          icon: icon,
          tooltip: tooltip,
          //color: t.iconTheme.color,
          //disabledColor: context.theme.disabledColor,
          onPressed: onPressed,
        );
      }
    }
    
    enum OpenDirection { up, down, left, right }
    
    class OverlayButtonController {
      final _onDismiss = StreamController<void>.broadcast();
    
      void dismiss() => _onDismiss.add(null);
    
      void dispose() => _onDismiss.close();
    }
    
    class OverlayButton extends StatefulWidget {
      final List<Widget> children;
      final Axis direction;
      final Widget child;
      final OverlayButtonController? controller;
      final OpenDirection openDirection;
      final ShapeBorder? shape;
      final Offset? openOffset;
    
      const OverlayButton({
        super.key,
        required this.child,
        this.children = const [],
        this.direction = Axis.vertical,
        this.controller,
        this.openDirection = OpenDirection.up,
        this.shape,
        this.openOffset,
      });
    
      @override
      State<OverlayButton> createState() => _OverlayButtonState();
    }
    
    class _OverlayButtonState extends State<OverlayButton> {
    //
      final LayerLink _layerLink = LayerLink();
      OverlayEntry? _overlayEntry;
      StreamSubscription? _csub;
      ThemeData t = ThemeData();
    
      @override
      void initState() {
        super.initState();
        _csub = widget.controller?._onDismiss.stream.listen(
              (final event) {
            _overlayEntry?.remove();
            setState(() => _overlayEntry = null);
          },
        );
      }
    
      @override
      void didChangeDependencies() {
        super.didChangeDependencies();
        t = Theme.of(context);
      }
    
      @override
      void dispose() {
        _overlayEntry?.remove();
        _csub?.cancel();
        super.dispose();
      }
    
      @override
      Widget build(final BuildContext context) {
        return CompositedTransformTarget(
          link: _layerLink,
          child: IconButton(
            icon: _overlayEntry == null ? widget.child : const Icon(Icons.close),
            onPressed: _show,
          ),
        );
      }
    
      Offset get _openOffset {
        return widget.openOffset ??
            switch (widget.openDirection) {
              OpenDirection.up =>
                  Offset(-2, -widget.children.length * kMinInteractiveDimension),
              OpenDirection.down => const Offset(-75, kMinInteractiveDimension),
              OpenDirection.left => const Offset(0, 0),
              OpenDirection.right => const Offset(0, 0),
            };
      }
    
      void _show() {
        if (_overlayEntry != null) {
          _overlayEntry?.remove();
          setState(() => _overlayEntry = null);
          return;
        }
        /*
        final renderBox = context.findRenderObject() as RenderBox?;
        if (renderBox == null) {
          debug("no renderbox!");
          return;
        }
        */
        final overlay = Overlay.of(context);
        /*
        final offset = renderBox.localToGlobal(Offset.zero);
        debug("renderbox offset=$offset");
        */
    
        final overlayEntry = _overlayEntry = OverlayEntry(
          builder: (final context) {
            return Positioned(
              top: 0,
              left: 0,
              child: CompositedTransformFollower(
                link: _layerLink,
                offset: _openOffset,
                child: Material(
                  color: t.brightness == Brightness.light
                      ? Colors.grey.shade200
                      : Colors.grey.shade800,
                  shape: widget.shape ??
                      RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(32),
                      ),
                  elevation: 3,
                  child: Flex(
                    mainAxisSize: MainAxisSize.min,
                    direction: widget.direction,
                    children: [
                      for (final item in widget.children)
                        SizedBox(
                          //width: kMinInteractiveDimension,
                          height: kMinInteractiveDimension,
                          child: item,
                        ),
                    ],
                  ),
                ),
              ),
            );
          },
        );
        setState(() => overlay.insert(overlayEntry));
      }
    }
    
    
    
  4. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    c: regressionIt was better in the past than it is now
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: error messageError messages from the Flutter framework
    platform-webWeb applications specifically
    and removed
    in triagePresently being triaged by the triage team
    on Aug 30, 2023
  5. changed the title [-]hit test exception regression with flutter 3.13[/-] [+][Regression]: Hovering on `overlaybutton` options throws `Cannot hit test a render box that has never been laid out`[/+] on Aug 30, 2023
  6. changed the title [-][Regression]: Hovering on `overlaybutton` options throws `Cannot hit test a render box that has never been laid out`[/-] [+][Regression]: Hovering on a button in `Overlay` throws `Cannot hit test a render box that has never been laid out`[/+] on Aug 30, 2023
  7. added
    P2Important issues not at the top of the work list
    on Aug 30, 2023
  8. Piinks commented on Aug 30, 2023

    @Piinks
    Contributor

    I bisected this regression to #127728, cc @LongCatIsLooong

  9. added
    r: fixedIssue is closed as already fixed in a newer version
    on Sep 13, 2023
  10. github-actions commented on Sep 27, 2023

    @github-actions

    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 -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: error messageError messages from the Flutter frameworkc: regressionIt was better in the past than it is nowfound in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions