如何在Flutter中更改DataTable的列宽? [英] How to change DataTable's column width in Flutter?

查看:190
本文介绍了如何在Flutter中更改DataTable的列宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Flutter应用中有一个DataTable.问题在于,填充数据时,列的宽度会自动设置,并且过大.如何手动设置列宽?我尝试更改窗口小部件构建"中的宽度参数,但它更改了整个表的宽度,而不是所需列的宽度.

I have a DataTable in my Flutter app. The problem is that when data is filled, the width of the columns is set automatically, and it too large. How can I manually set the column width? I tried to change the width parameters in the "Widget build", but it change the width of the whole table, but not a desired column.

推荐答案

@Smith,您是说不能这样做?如果您可以共享一些代码...

@Smith, you mean you can't do this ? if you could share some code ...

Widget build(BuildContext context) {
    return Scaffold(
      body: DataTable(
        columns: [DataColumn(label: Text('label'))],
        rows: [
          DataRow(cells: [DataCell(
            Container(
              width: 200, //SET width
              child: Text('text')))
              ])
        ]
      ),
    );

这篇关于如何在Flutter中更改DataTable的列宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆