Flutter: Cannot hit test a render box that has never been laid out

Viewed 3667

with Flutter i get the error: "Cannot hit test a render box that has never been laid out, The hitTest() method was called on this RenderBox: RenderStack#53ea6 NEEDS-LAYOUT NEEDS-PAINT:". Can anyone help? That would be great! I put "Expanded" in there. Thx.

      Scaffold(
      body: SafeArea(
          child: Column(
          children: [
          //.. some Code
          Padding(padding: EdgeInsets.symmetric(vertical: 10.0),
              child: SingleChildScrollView(
                     child:
                     Column(
                        children: [
                            // .. some Code
                           Column(
                              children: [
                                 Expanded(child:
                                           Container(padding: EdgeInsets.all(10),
                                                     color: Colors.red,
                                                     child: Text("test A"))),
                                Container(padding: EdgeInsets.all(10),
                                          color: Colors.yellow,
                                          child: Text("test b")),
  ])])))])));

} 

}

1 Answers

Just specify the size, 2 options:

  1. Wrap with Container(height: ..., width: ...)
  2. Wrap with Expanded()
Related