"Cannot hit test a render box that has never been laid out" error when navigating back.

3,258 views
Skip to first unread message

D M

unread,
Jul 13, 2018, 11:04:53 AM7/13/18
to Flutter Dev
Hi all,
   I have tried the sample app to move from one page to another. Here is the snippet.

class NewReadingWidget extends StatefulWidget {
}




Navigator.of(context).push(
new MaterialPageRoute(
builder: (context) => new NewReadingWidget()
)
);

When the NewReadingWidget is opened, it has the left arrow. When I click on the arrow, I get this error message. Navigation to previous wdiget does not work. My home widget is also of type StatefulWidget

07-13 20:15:49.753 5295-5311/com.mimosa.lpg E/flutter: [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
    Cannot hit test a render box that has never been laid out.
    The hitTest() method was called on this RenderBox:
      RenderStack#66f67 NEEDS-LAYOUT NEEDS-PAINT
    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).
    #0      RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:1838:11)
    #1      RenderBox.hitTest (package:flutter/src/rendering/box.dart:1861:6)
    #2      _RenderCustomMultiChildLayoutBox&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2190:17)
Reply all
Reply to author
Forward
0 new messages