android - Flutter 中是否有支持 rowspan 和 colspan 的小部件?
问题描述
我正在尝试使用 Table 小部件在颤振中创建一个表格,但我找不到合并其单元格的方法。
Table(border: TableBorder.all(color: Colors.red),children: [
TableRow(children: [
Text("item 1"),
Text("item 2"),
]),
TableRow(children: [
Text("item 3"),
Text("item 4"),
]),
]),
有支持 rowspan 和 colspan 的 Widget 吗?
解决方案
我认为现在仍然不可能做到这一点。您可以做的是将 2 个表并排放置以获得您正在处理的结果,如下所示:
Row(
children: <Widget>[
Container(
width: 100.0,
color: Colors.cyan,
child: Table(
children: [
TableRow(
children: [
Container(
color: Colors.green,
width: 50.0,
height: 50.0,
child: Text("1111111111111111111111111111111111111111111"),
),
Container(
color: Colors.red,
width: 50.0,
height: 50.0,
child: Text("2"),
),
]),
TableRow(
children: [
Container(
color: Colors.deepPurple,
width: 50.0,
height: 50.0,
child: Text("5"),
),
Container(
color: Colors.cyan,
width: 50.0,
height: 50.0,
child: Text("6"),
),
]),
TableRow(
children: [
Container(
color: Colors.amberAccent,
width: 50.0,
height: 50.0,
child: Text("7"),
),
Container(
color: Colors.black87,
width: 50.0,
height: 50.0,
child: Text("8"),
),
]),
],
),
),
Container(
width: 100.0,
color: Colors.cyan,
child: Table(
columnWidths: {
1: FractionColumnWidth(.3),
},
children: [
TableRow(
children: [
Container(
color: Colors.green,
width: 50.0,
height: 50.0,
child: Text("1111111111111111111111111111111111111111111"),
),
Container(
color: Colors.red,
width: 50.0,
height: 50.0,
child: Text("2"),
),
]),
TableRow(
children: [
Container(
color: Colors.deepPurple,
width: 50.0,
height: 100.0,
child: Text("5"),
),
Container(
color: Colors.cyan,
width: 50.0,
height: 100.0,
child: Text("6"),
),
]),
],
),
),
],
),
推荐阅读
- asp.net - ASP.NET 应用程序无法加载非托管 DLL
- python - 如何遍历列表,删除元素?
- selenium-webdriver - 在量角器中进行 e2e 测试时,我可以使用什么来模拟获取请求,类似于没有 Angular 的 addMockModule
- html - 用户代理是否需要按文档顺序提交 URL 编码的表单数据?
- ruby-on-rails - 保存foreign_key = nil后-解决db中的错误
- bolt-cms - 在 Bolt CMS 中修改内容记录
- c++ - QGroupBox 的子限制缩小表格
- linux - Bash字典错误没有这样的文件或目录
- android - 无法在 Android 9 Nokia 5 设备中加载本机 .so 库
- akka - 如何知道 Akka Cluster Client 的初始联系人?