dart - 是否可以使用 flutter dart 构建并排功能比较表?如何?

标签 dart flutter

只是想知道标准库(以及如何)是否可以让 Flutter dart 构建一个并排的列式表格(比如那些功能比较表,表示不同型号的 android 手机等)。请注意,我们还需要它具有 Web 可访问性,因此对讲/画外音需要逐列阅读屏幕。

最佳答案

您可以使用它并根据您的需要进行修改。

enter image description here

@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),
    ),
  );
}

关于dart - 是否可以使用 flutter dart 构建并排功能比较表?如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55539787/

相关文章:

flutter - 使用InheritedWidget在子级中触发触发器 Action

html - 如何防止flutter web htmlelementview捕获其上方对象的触摸?

android - 未处理的异常 : NoSuchMethodError: The method 'toRawHandle' was called on null

flutter - Stack 能否(应该?)将其大小扩展到其定位的子级?

flutter - 使用pdf文件的卷页效果

internationalization - 如何将国际化对象传递给 Flutter 中的子控件

HTTP 连接问题

flutter - 如何在 flutter 中访问父窗口小部件的数据?

firebase - 如何使用Dart和Flutter从云Firestore数据创建每日的csv文件?

Flutter 可关闭背景