Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- Color kCol1 = Color(0xFF33658A);
- Color kCol2 = Color(0xFFA799B7);
- Color kCol3 = Color(0xFF979B8D);
- Color kCol4 = Color(0xFF8FC0A9);
- Color kCol5 = Color(0xFF68B0AB);
- Color kCol6 = Color(0xFF8DA9C4);
- @override
- Widget build(BuildContext context) {
- return SafeArea(
- child: Scaffold(
- body: Center(
- child: Table(
- children: <TableRow>[
- TableRow(children: <Widget>[
- DayTile(
- color: kCol1,
- text: 'Mon',
- ),
- DayTile(
- color: kCol2,
- text: 'Tue',
- ),
- DayTile(
- color: kCol3,
- text: 'Wed',
- ),
- DayTile(
- color: kCol4,
- text: 'Thur',
- ),
- DayTile(
- color: kCol5,
- text: 'Fri',
- ),
- DayTile(
- color: kCol6,
- text: 'Sat',
- ),
- DayTile(
- color: Colors.deepOrangeAccent,
- text: 'Sun',
- ),
- ]),
- ],
- ),
- ),
- ),
- );
- }
- }
- class DayTile extends StatelessWidget {
- final Color color;
- final String text;
- DayTile({this.color = Colors.deepOrangeAccent, this.text = ' '});
- @override
- Widget build(BuildContext context) {
- return FittedBox(
- fit: BoxFit.contain,
- child: Container(
- margin: EdgeInsets.all(2),
- color: color,
- width: 50.0,
- height: 50.0,
- child: Center(
- child: Text(
- text,
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white,
- fontSize: 12.0,
- ),
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement