I'd like to make a widget scrollable, which is basically Column which contains other columns.
My TreeWidget may contain one or more TreeWidgets like so. I tried to wrap it inside a SingleChildScroolView like so:
SingleChildScrollView {
TreeWidget {
TreeWidget{
TreeWidget {
Column {
Text( 'something' )
Text( 'something' )
}
}
}
}
}
Note, that I do not know the size of any TreeWidget beforehand. Unless I first walk the tree downwards, collect heights and finally compute the total height.
When this renders, Flutter complains about infinite size.
Thus my question: How to I make a recursive widget like the above scrollable?
Error Message:
The relevant error-causing widget was: Column Column:file:///..path.../lib/main_widget.dart:46:16
The overflowing RenderFlex has an orientation of Axis.vertical. The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size. This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.