1+ import 'package:flutter/material.dart' ;
2+
3+ class Index extends StatefulWidget {
4+ @override
5+ _IndexState createState () => _IndexState ();
6+ }
7+
8+ class _IndexState extends State <Index > {
9+ @override
10+ Widget build (BuildContext context) {
11+ return Scaffold (
12+ appBar: AppBar (title: Text ('Table' ),),
13+ body: Center (
14+ child: Container (
15+ decoration: BoxDecoration (
16+ image: DecorationImage (
17+ image: NetworkImage ('http://pic1.win4000.com/wallpaper/2019-01-31/5c52bf7fdc959_270_185.jpg' ),
18+ fit: BoxFit .cover
19+ )
20+ ),
21+ child: Table (
22+ columnWidths: const < int , TableColumnWidth > {
23+ 0 : FixedColumnWidth (40.0 ),
24+ 1 : FixedColumnWidth (80.0 ),
25+ 2 : FixedColumnWidth (40.0 ),
26+ // 3: FixedColumnWidth(80.0)
27+ },
28+ defaultColumnWidth: FixedColumnWidth (100.0 ),
29+ textDirection: TextDirection .ltr,
30+ border: TableBorder .all (
31+ width: 1.0 , style: BorderStyle .solid, color: Theme .of (context).primaryColor
32+ ),
33+ defaultVerticalAlignment: TableCellVerticalAlignment .top,
34+ // textBaseline: TextBaseline.alphabetic,
35+ children: List .generate (4 , (index) {
36+ return TableRow (
37+ children: < Widget > [
38+ Container (
39+ height: 50.0 ,
40+ alignment: Alignment .center,
41+ child: Text ('A${index +1 }' , style: TextStyle (fontSize: 20.0 , color: Theme .of (context).primaryColor),),
42+ ),
43+ Container (
44+ height: 50.0 ,
45+ alignment: Alignment .center,
46+ child: Text ('B${index +1 }' , style: TextStyle (fontSize: 20.0 , color: Theme .of (context).primaryColor),),
47+ ),
48+ Container (
49+ height: 50.0 ,
50+ alignment: Alignment .center,
51+ child: Text ('C${index +1 }' , style: TextStyle (fontSize: 20.0 , color: Theme .of (context).primaryColor),),
52+ ),
53+ Container (
54+ height: 50.0 ,
55+ alignment: Alignment .center,
56+ child: Text ('D${index +1 }' , style: TextStyle (fontSize: 20.0 , color: Theme .of (context).primaryColor),),
57+ ),
58+ ]
59+ );
60+ })
61+ ),
62+ ),
63+ )
64+ );
65+ }
66+ }
0 commit comments