I have a widget that has a Column with 2 expanded children, flexes are 2 and 1.
second children is another column with 3 Row children each with two text.
The mainAxisAlignment: MainAxisAlignment.spaceBetween
in each Row should push the two children texts to the margins but they are staying centered with no space in the middle.
Can you see why there is no space between them?
This is the Widget:
class DisplayCell extends StatelessWidget {
final AutoSizeGroup autoSizeGroup;
final String imageUrl;
final String name;
final String price;
final String vendor;
final Function onTap;
const DisplayCell(
{Key key,
this.autoSizeGroup,
this.imageUrl,
this.name,
this.price,
this.vendor,
this.onTap})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
padding: EdgeInsets.all(5),
child: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black.withAlpha(120),
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.redAccent, width: 1),
),
child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 2,
child: Image(
image: NetworkImage(imageUrl),
),
),
Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AutoSizeText(
AppLocalizations.instance.text('Name:'),
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
// SizedBox(
// width: 10,
// ),
AutoSizeText(
name,
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AutoSizeText(
AppLocalizations.instance.text('Price:'),
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
// SizedBox(
// width: 10,
// ),
AutoSizeText(
price,
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AutoSizeText(
AppLocalizations.instance.text('Vendor:'),
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
// SizedBox(
// width: 10,
// ),
AutoSizeText(
vendor,
style: TextStyle(color: Colors.white, fontSize: 12),
minFontSize: 8,
maxLines: 1,
group: autoSizeGroup,
),
],
),
],
),
),
],
),
),
);
}
}