When using last container, an error occured: bottom overflowed by 14 pixels
Container(
height: 50,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Equal spacing
children: [
Text(" ${item.vchrName}"),
Icon(IconlyLight.heart),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Equal spacing
children: [
Text("$ ${item.dblSellingPrice}"),
Icon(IconlyLight.chat),
],
),
],
),
),
Container(
height: 25,
color:Colors.redAccent,
)
2
Answers
Because the main
Container
has 50 fixed height, its childColumn
has 3 children, all their heights combined is exceeding above 50.Remove the main container’s height and add
mainAxisSize: MainAxisSize.min
to Column. So, it won’t take more space than its children already has:Remove the height of the container.
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Equal spacing
children: [
Text(" hello"),
Icon(Icons.add),