6

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")),
  ])])))])));

} 

}

Peter
  • 87
  • 1
  • 6
  • There already an answer here. https://stackoverflow.com/questions/52801201/flutter-renderbox-was-not-laid-out#52801899 does this answer your question? – Pirogrammer Mar 09 '21 at 13:14
  • Does this answer your question? [Flutter: RenderBox was not laid out](https://stackoverflow.com/questions/52801201/flutter-renderbox-was-not-laid-out) – Pirogrammer Mar 09 '21 at 13:25
  • Thank you, I already saw these, but I can't transform it to my problem. I think the problem is because I put "Expanded" in Column, but I need it this way... – Peter Mar 09 '21 at 13:42
  • Yes, that's the problem. Why do you need the 'Expanded' inside a `SingleChildScrollView`? Can you share your Wireframe Design? What do you want to achieve? – Thierry Mar 09 '21 at 13:48
  • Thank you! That helped me. I deleted SingleChildScrollView and SafeArea and it works!!! THX – Peter Mar 09 '21 at 15:06

1 Answers1

1

Just specify the size, 2 options:

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