Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MyApp());
  4.  
  5. class MyApp extends StatelessWidget {
  6. // This widget is the root of your application.
  7. @override
  8. Widget build(BuildContext context) {
  9. return MaterialApp(
  10. title: 'Flutter Demo',
  11. theme: ThemeData(
  12. primarySwatch: Colors.blue,
  13. ),
  14. home: MyHomePage(),
  15. );
  16. }
  17. }
  18.  
  19. class MyHomePage extends StatefulWidget {
  20. @override
  21. _MyHomePageState createState() => _MyHomePageState();
  22. }
  23.  
  24. class _MyHomePageState extends State<MyHomePage> {
  25. Color kCol1 = Color(0xFF33658A);
  26. Color kCol2 = Color(0xFFA799B7);
  27. Color kCol3 = Color(0xFF979B8D);
  28. Color kCol4 = Color(0xFF8FC0A9);
  29. Color kCol5 = Color(0xFF68B0AB);
  30. Color kCol6 = Color(0xFF8DA9C4);
  31. @override
  32. Widget build(BuildContext context) {
  33. return SafeArea(
  34. child: Scaffold(
  35. body: Center(
  36. child: Table(
  37. children: <TableRow>[
  38. TableRow(children: <Widget>[
  39. DayTile(
  40. color: kCol1,
  41. text: 'Mon',
  42. ),
  43. DayTile(
  44. color: kCol2,
  45. text: 'Tue',
  46. ),
  47. DayTile(
  48. color: kCol3,
  49. text: 'Wed',
  50. ),
  51. DayTile(
  52. color: kCol4,
  53. text: 'Thur',
  54. ),
  55. DayTile(
  56. color: kCol5,
  57. text: 'Fri',
  58. ),
  59. DayTile(
  60. color: kCol6,
  61. text: 'Sat',
  62. ),
  63. DayTile(
  64. color: Colors.deepOrangeAccent,
  65. text: 'Sun',
  66. ),
  67. ]),
  68. ],
  69. ),
  70. ),
  71. ),
  72. );
  73. }
  74. }
  75.  
  76. class DayTile extends StatelessWidget {
  77. final Color color;
  78. final String text;
  79. DayTile({this.color = Colors.deepOrangeAccent, this.text = ' '});
  80. @override
  81. Widget build(BuildContext context) {
  82. return FittedBox(
  83. fit: BoxFit.contain,
  84. child: Container(
  85. margin: EdgeInsets.all(2),
  86. color: color,
  87. width: 50.0,
  88. height: 50.0,
  89. child: Center(
  90. child: Text(
  91. text,
  92. textAlign: TextAlign.center,
  93. style: TextStyle(
  94. color: Colors.white,
  95. fontSize: 12.0,
  96. ),
  97. ),
  98. ),
  99. ),
  100. );
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement