import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text('Flutter: Primeiros Passos'),
),
body: ListView(
children: const [
Quadro(Colors.pink, Colors.purple, Colors.blueAccent,Colors.white,Colors.lightBlueAccent,Colors.blueGrey,100,140),
Quadro(Colors.pinkAccent, Colors.amber, Colors.lightBlue,Colors.black,Colors.amberAccent,Colors.purple,100,140),
Quadro(Colors.purple, Colors.white, Colors.green,Colors.black,Colors.greenAccent,Colors.limeAccent,100,140),
Quadro(Colors.pink, Colors.purple, Colors.blueAccent,Colors.white,Colors.lightBlueAccent,Colors.blueGrey,100,140),
Quadro(Colors.pinkAccent, Colors.amber, Colors.lightBlue,Colors.black,Colors.amberAccent,Colors.purple,100,140),
Quadro(Colors.purple, Colors.white, Colors.green,Colors.black,Colors.greenAccent,Colors.limeAccent,100,140),
SizedBox(
height: 100,
),
],
),
),
);
}
}
class Quadro extends StatelessWidget {
final Color cor1;
final Color cor2;
final Color cor3;
final Color cor4;
final Color cor5;
final Color cor6;
final double largura;
final double altura;
const Quadro(this.cor1,this.cor2,this.cor3,this.cor4,this.cor5,this.cor6,this.largura,this.altura,{Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 10),
child: Container(
height: altura,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
Container(
height: altura,
width: largura,
color: cor1,
),
Container(
height: altura,
width: largura,
color: cor2,
),
Container(
height: altura,
width: largura,
color: cor3,
),
Container(
height: altura,
width: largura,
color: cor4,
),
Container(
height: altura,
width: largura,
color: cor5,
),
Container(
height: altura,
width: largura,
color: cor6,
)
],
),
),
);
}
}