[Flutter]Table

小黑
發佈於APP
2023/12/19閱讀時間約 1 分鐘


class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Table(
columnWidths: const <int, TableColumnWidth>{
0: FixedColumnWidth(50.0),
1: FixedColumnWidth(50.0),
},
border: TableBorder.all(
color: Colors.black87, width: 2.0, style: BorderStyle.solid),
children: const <TableRow>[
TableRow(
children: <Widget>[
Text('Name'),
Text('Age'),
],
),
TableRow(
children: <Widget>[
Text('Tom'),
Text('20'),
],
),
],
),
);
}
}

columnWidths為指定索引及固定列宽;border為設定表格樣式。








7會員
78內容數
嗨,我是一名程式設計師,會在這分享開發與學習紀錄。
留言0
查看全部
發表第一個留言支持創作者!
從 Google News 追蹤更多 vocus 的最新精選內容