flutter table使用方法


/** * 表格 * 表格的每一行的高度,由其內容決定,每一列的寬度,則由columnWidths控制 Table({ Key key, this.children = const <TableRow>[],// this.columnWidths,//設置每一列的寬度。 this.defaultColumnWidth = const FlexColumnWidth(1.0),//默認的每一列寬度值,默認情況下均分 this.textDirection,//文字方向,一般無需考慮。 this.border,//表格邊框。 this.defaultVerticalAlignment = TableCellVerticalAlignment.top,//每一個cell的垂直方向的alignment。 top:被放置在的頂部; middle:垂直居中; bottom:放置在底部; baseline:文本baseline對齊; fill:充滿整個cell。 this.textBaseline,//defaultVerticalAlignment為baseline的時候,會用到這個屬性。 }) */ 


Table(
columnWidths: <int, TableColumnWidth>{
0: FixedColumnWidth(Screen.width(300)),
1: FixedColumnWidth(Screen.width(300))
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
border: TableBorder.all(
color: Colors.grey,
width: Screen.width(2)
),
children: [
TableRow(
decoration: BoxDecoration(
color: ColorGather.colorBg()
),
children: [
Container(
alignment: Alignment.center,
height: Screen.width(80),
child: Text('榮譽等級', style: TextStyle(fontSize: Screen.width(28)),),
),
Text('榮譽等級', style: TextStyle(fontSize: Screen.width(28)), textAlign: TextAlign.center,)
]
),
TableRow(
children: [
Container(
alignment: Alignment.center,
height: Screen.width(80),
child: Text('黃銅', style: TextStyle(fontSize: Screen.width(28)),),
),
Text('榮譽等級', style: TextStyle(fontSize: Screen.width(28)), textAlign: TextAlign.center,)
]
),
],
)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM