@spgms Sorry, my bad. It wasn’t about the Spacer
. The code you posted is right, but on following the instructions in the book, it ends up looking like this:
return SizedBox(
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// This should be wrapped in a row
Container(width: 5.0, color: item.color),
const SizedBox(width: 16.0),
Column(...),
// till here
Row(
children: [
Text(...),
buildCheckbox()
],
)
],
),
);
Initially the Row
looks like this:
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// TODO 22: Add Row to group (name, date, importance)
// TODO 23: Add Row to group (quantity, checkbox)
],
),
The book says to replace // TODO 22: Add Row to group (name, date, importance)
with the following:
// 2
Container(width: 5.0, color: item.color),
// 3
const SizedBox(width: 16.0),
// 4
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 5
Text(
item.name,
style: GoogleFonts.lato(
decoration: textDecoration,
fontSize: 21.0,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 4.0),
buildDate(),
const SizedBox(height: 4.0),
buildImportance(),
],
),

Giving Row 4 childrens(Container,SizedBox,Column and Row) instead of 2 children[Row(Container,SizedBox,Column),Row]
The correct code would be:
// 1
Row(children: [
// 2
Container(width: 5.0, color: item.color),
// 3
const SizedBox(width: 16.0),
// 4
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 5
Text(
item.name,
style: GoogleFonts.lato(
decoration: textDecoration,
fontSize: 21.0,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 4.0),
buildDate(),
const SizedBox(height: 4.0),
buildImportance(),
]
),
),