【发布时间】:2019-04-05 16:26:51
【问题描述】:
只是想知道标准库(以及如何)Flutter dart 是否可以构建并排的列式表(例如那些功能比较表,用于表示不同型号的 android 手机等)。请注意,我们还需要它是网络可访问性,因此对讲/旁白需要逐列阅读屏幕。
【问题讨论】:
-
表格小部件是否提供您需要的功能? youtu.be/_lbE0wsVZSw
只是想知道标准库(以及如何)Flutter dart 是否可以构建并排的列式表(例如那些功能比较表,用于表示不同型号的 android 手机等)。请注意,我们还需要它是网络可访问性,因此对讲/旁白需要逐列阅读屏幕。
【问题讨论】:
您可以使用它并根据需要进行修改。
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Testing")),
body: Padding(
padding: const EdgeInsets.all(4),
child: Table(
columnWidths: {
0: FlexColumnWidth(),
1: FlexColumnWidth(0.02),
2: FlexColumnWidth(),
},
children: [
TableRow(children: [_buildBox("Android is cool"), SizedBox(), _buildBox("iOS is hot")]),
TableRow(children: [_buildBox("Android is flexible"), SizedBox(), _buildBox("iOS isn't")]),
TableRow(children: [_buildBox("Android is dashing"), SizedBox(), _buildBox("No comments")]),
],
),
),
);
}
Widget _buildBox(String title) {
return Container(
decoration: BoxDecoration(
color: Colors.blue,
border: Border(top: BorderSide(color: Colors.black)),
),
height: 44,
alignment: Alignment.center,
child: Text(
title,
style: TextStyle(fontSize: 20, color: Colors.white),
),
);
}
【讨论】: