1
resposta

Meu código

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Scaffold(
            appBar: AppBar(
              title: Text('Desafio 2'),
            ),
            body: Container(
              color: Colors.grey,
              child: ListView(
                children: [
                  RowsColors(Colors.white, Colors.purple, Colors.blue),
                  RowsColors(Colors.red, Colors.purpleAccent, Colors.blueAccent),
                  RowsColors(Colors.pink, Colors.yellow, Colors.lightBlue),
                ],
              ),
            )));
  }
}

class RowsColors extends StatelessWidget {
  final Color c1;
  final Color c2;
  final Color c3;
  const RowsColors(this.c1, this.c2, this.c3, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double alt = 150;
    double lag = 100;

    return Padding(
      padding: const EdgeInsets.all(10.0),
      child: Container(
        child: Row(
          children: [
            Container(
              width: lag,
              height: alt,
              color: c1,
            ),
            Container(
              width: lag,
              height: alt,
              color: c2,
            ),
            Container(
              width: lag,
              height: alt,
              color: c3,
            )
          ],
        ),
      ),
    );
  }
}``
1 resposta

Adorei João! Você já ta produzindo um código muito bem estruturado, os parâmetros de cores foi um toque elegante, continue o bom trabalho c: