flutter_keyboard_actions icon indicating copy to clipboard operation
flutter_keyboard_actions copied to clipboard

When placing KeybaordActions widget inside an overlay, many render errors

Open mark8044 opened this issue 2 years ago • 3 comments

Without the KeyboardActions widget everything is fine, but as soon as I add it in I get the following errors:

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: RenderDecoratedBox#8e0ed relayoutBoundary=up2
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1979 pos 12: 'hasSize'


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.md

The relevant error-causing widget was: 
  Container-[#cf724] Container:file:///...dropdown_button.dart:106:7
When the exception was thrown, this was the stack: 
#2      RenderBox.size (package:flutter/src/rendering/box.dart:1979:12)
#3      RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2162:12)
#4      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#5      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#6      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#7      RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2419:17)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#10     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#11     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#12     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#13     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#14     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#15     _RenderTheatre.paintStack (package:flutter/src/widgets/overlay.dart:786:15)
#16     _RenderTheatre.paint (package:flutter/src/widgets/overlay.dart:804:7)
#17     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#18     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#19     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#20     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#21     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#22     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#23     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#24     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#25     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#26     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#27     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#28     RenderIndexedStack.paintStack (package:flutter/src/rendering/stack.dart:726:13)
#29     RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#30     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#31     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#32     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#33     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:408:5)
#34     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#35     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#36     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#37     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:598:11)
#38     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#39     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#40     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#41     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#42     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:1951:15)
#43     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#44     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#45     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#46     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#47     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#48     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#49     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#50     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#51     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#52     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:995:29)
#53     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:506:19)
#54     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:892:13)
#55     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370:5)
#56     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
#57     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083:9)
#58     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:997:5)
#62     _invoke (dart:ui/hooks.dart:151:10)
#63     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#64     _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: RenderDecoratedBox#8e0ed relayoutBoundary=up2
...  needs compositing
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(unconstrained)
...  size: MISSING
...  decoration: BoxDecoration
...    boxShadow: BoxShadow(Color(0x1a000000), Offset(0.0, 20.0), 30.0, 0.0), BlurStyle.normal
...  configuration: ImageConfiguration(bundle: PlatformAssetBundle#8cf5b(), devicePixelRatio: 3.0, locale: en, textDirection: TextDirection.ltr, platform: iOS)
RenderObject: RenderDecoratedBox#8e0ed relayoutBoundary=up2
  needs compositing
  parentData: <none> (can use size)
  constraints: BoxConstraints(unconstrained)
  size: MISSING
  decoration: BoxDecoration
    boxShadow: BoxShadow(Color(0x1a000000), Offset(0.0, 20.0), 30.0, 0.0), BlurStyle.normal
  configuration: ImageConfiguration(bundle: PlatformAssetBundle#8cf5b(), devicePixelRatio: 3.0, locale: en, textDirection: TextDirection.ltr, platform: iOS)
...  child: RenderClipRRect#34423 relayoutBoundary=up3 NEEDS-PAINT
...    needs compositing
...    parentData: <none> (can use size)
...    constraints: BoxConstraints(unconstrained)
...    size: MISSING
...    child: RenderBackdropFilter#352ec relayoutBoundary=up4 NEEDS-PAINT
...      needs compositing
...      parentData: <none> (can use size)
...      constraints: BoxConstraints(unconstrained)
...      size: MISSING
...      child: RenderConstrainedBox#5061e relayoutBoundary=up5 NEEDS-PAINT
...        needs compositing
...        parentData: <none> (can use size)
...        constraints: BoxConstraints(unconstrained)
...        size: MISSING
...        additionalConstraints: BoxConstraints(w=380.0, 0.0<=h<=Infinity)
...        child: RenderDecoratedBox#01691 relayoutBoundary=up6 NEEDS-PAINT
...          needs compositing
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(w=380.0, 0.0<=h<=Infinity)
...          size: MISSING
...          decoration: BoxDecoration
...            color: Color(0xccfafcff)
...          configuration: ImageConfiguration(bundle: PlatformAssetBundle#8cf5b(), devicePixelRatio: 3.0, locale: en, textDirection: TextDirection.ltr, platform: iOS)
====================================================================================================

mark8044 avatar May 29 '22 12:05 mark8044

Add minimum code to reproduce the issue

diegoveloper avatar May 29 '22 13:05 diegoveloper

In my case, I was seeing this error (or something similar), and resolved by adding shrinkWrap: true to my KeyboardActions widgets, or wrapping the KeyboardActions child with a container/sizedBox.

aaronjudd avatar Jul 19 '22 15:07 aaronjudd

I found that setting KeyboardActions.disableScroll: true resolved my error when placing inside a custom scroll view

ChrisElliotUK avatar Jul 21 '22 13:07 ChrisElliotUK