I am trying to use spacer inside a column that is wrapped with singlechildscrollview and it gives me an error.
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
here is my widget
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Form(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
TextFormField(),
TextFormField(),
//Spacer()
Divider(),
Icon(Icons.block)
],
),
));
}
}
what should i use? your help is appreciated
You can try this out, I added an example using your code, it works:
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(body: LayoutBuilder(
builder: (context, constraint) {
return Form(
child: SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: constraint.maxHeight),
child: IntrinsicHeight(
child: Column(
children: <Widget>[
TextFormField(),
TextFormField(),
Spacer(),
Divider(),
Icon(Icons.block)
],
),
),
),
),
);
},
));
}
}
Check this Github issue for much details on the solution above: Wrapping a Column with an expanded in a SingleChildScrollView throws an exception
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With