import 'package:flutter/material.dart';
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(
backgroundColor: Colors.grey,
appBar: AppBar(
leading: IconButton(
onPressed: () {}, icon: const Icon(Icons.add_task_outlined)),
title: const Text('Flutter: Primeiros Passos'),
),
body: ListView(children: [
const square(Colors.white, Colors.pink, Colors.lightBlueAccent),
const square(Colors.red, Colors.purple, Colors.blueAccent),
const square(Colors.pinkAccent, Colors.orange, Colors.blueAccent),
const square(Colors.purpleAccent, Colors.white, Colors.green),
]),
));
}
}
class square extends StatelessWidget {
final Color color1;
final Color color2;
final Color color3;
const square(this.color1, this.color2, this.color3, {Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
children: [
Container(color: color1, height: 140, width: 110),
Container(color: color2, height: 140, width: 110),
Container(color: color3, height: 140, width: 110)
],
),
),
),
],
);
}
}