Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OccludeWrapper: Getting "RenderBox was not laid out" issue in custom widgets #54

Open
jebstern opened this issue May 20, 2024 · 0 comments

Comments

@jebstern
Copy link

I keep "RenderBox was not laid out" errors when using OccludeWrapper on custom widgets. Doesn't help if I give them height & width.

flutter_uxcam version: 2.5.2
Flutter SDK version: 3.22.0
Dart: 3.4.0

Error Message:

E/flutter (23543): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/rendering/box.dart': Failed assertion: line 2165 pos 12: 'hasSize': RenderBox was not laid out: RenderMouseRegion#bb55c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
E/flutter (23543): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter (23543): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter (23543): #2      RenderBox.size (package:flutter/src/rendering/box.dart:2165:12)
E/flutter (23543): #3      RenderBox.paintBounds (package:flutter/src/rendering/box.dart:2903:41)
E/flutter (23543): #4      GlobalKeyExtension.globalPaintBounds (package:flutter_uxcam/src/widgets/occlude_wrapper.dart:82:46)
E/flutter (23543): #5      _OccludeWrapperState.getOccludePoints (package:flutter_uxcam/src/widgets/occlude_wrapper.dart:58:30)
E/flutter (23543): #6      _OccludeWrapperState.initState.<anonymous closure> (package:flutter_uxcam/src/widgets/occlude_wrapper.dart:30:9)
E/flutter (23543): #7      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (23543): #8      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (23543): #9      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter (23543): 

If I replace the Timer in OccludeWrapper --> initState() method to use WidgetsBinding.instance.addPostFrameCallback((_) {});, then the app works normally. (Haven't verified end results in UXCam dashboard yet)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant