Sómente adicionei as últimas linhas de código no projeto original, irei comenta-las após o exercício. Dei uma modificada espero que gostem ^^ como o código não irá caber colocarei só oq adicionei
import 'dart:math' as math;
class ColorfulBlocksRow extends StatefulWidget {
const ColorfulBlocksRow({Key? key}) : super(key: key);
@override
State<ColorfulBlocksRow> createState() => _ColorfulBlocksRowState();
}
class _ColorfulBlocksRowState extends State<ColorfulBlocksRow> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0) ,width: 100,height: 150,),
Container(color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0),width: 100, height: 150,),
Container(color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0),width: 100, height: 150,),
ElevatedButton(onPressed: (){
setState((){});
}, child: Icon(Icons.change_circle)),
],
),
),
);
}
}