flutter table使用方法

自作多情 提交于 2020-03-25 17:27:48
/**
 * 表格
 * 表格的每一行的高度,由其内容决定,每一列的宽度,则由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,)        ]    ),  ],)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!