Olá, respondendo ao desafio proposto na atividade, o meu stateful widget ficou assim:
body: ListView(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Task(corRow1: Colors.black, corRow2: Colors.pinkAccent, corRow3: Colors.purple, widthContainer: 100,),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Task(corRow1: Colors.redAccent, corRow2: Colors.greenAccent, corRow3: Colors.yellow, widthContainer: 100,),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Task(corRow1: Colors.orange, corRow2: Colors.purple, corRow3: Colors.lightBlue, widthContainer: 100,),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Task(corRow1: Colors.brown, corRow2: Colors.black45, corRow3: Colors.red, widthContainer: 100,),
),
],
),
a classe:
class Task extends StatelessWidget {
final Color corRow1;
final Color corRow2;
final Color corRow3;
final double widthContainer;
const Task({required this.corRow1, required this.corRow2, required this.corRow3, required this.widthContainer, super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
color: corRow1,
width: widthContainer,
height: 100,
),
Container(
color: corRow2,
width: widthContainer,
height: 100,
),
Container(
color: corRow3,
width: widthContainer,
height: 100,
),
],
),
);
}
}