标签: flutter-table

如何在 TableRow 中为 Flutter Table 设置表格列大小

我不知道如何在 Flutter 中设置表列大小。如果我使用RowExpanded可以使用,但TableRow不允许使用。

请告诉我一些如何设置表格列大小的建议。对我来说最好的解决方案是调整列中文本长度的大小。

dart flutter flutter-table

13
推荐指数
3
解决办法
1万
查看次数

将动态高度值设置为 DataTable Widget 的 dataRowHeight 属性以适应不同 Row 的内容 - #flutter

我需要将动态高度值设置为 DataTable Widget 的 dataRowHeight 属性以适应不同的 Row 内容,但我不想使用允许这样做的 Table Widget。-#flutter

默认情况下,它使用 DataTableThemeData 中定义的 kMinInteractiveDimension 值 (48.0)。

DataTable(dataRowHeight: 150, columns: [DataColumn()...], rows: [DataRow()....])
Run Code Online (Sandbox Code Playgroud)

检查这个图像:

dart flutter flutter-layout material-components-android flutter-table

8
推荐指数
0
解决办法
1261
查看次数

如何使用 Flutter 设置表格右对齐

我正在使用颤动表。我想将数字设置为右对齐(或居中)

我怎样才能让他们找到?

我想要标题居中。右边的数字。

在此输入图像描述

             Container(
                margin: EdgeInsets.all(8.0),
                width: double.infinity,
                decoration: BoxDecoration(border: Border.all(width: 1.0)),
                child: Table(
                  columnWidths: {
                    0: FlexColumnWidth(1),
                    1: FlexColumnWidth(1),
                    2: FlexColumnWidth(4),
                    3: FlexColumnWidth(1),
                    4: FlexColumnWidth(1),
                    5: FlexColumnWidth(1),
                    6: FlexColumnWidth(1),
                  },
                  border: TableBorder.all(),
                  defaultVerticalAlignment: TableCellVerticalAlignment.middle,
                  children: <TableRow>[
                    TableRow(children: <Widget>[
                      Container(
                        padding: EdgeInsets.all(2.0),
                        child: Text('G',
                            style: TextStyle(fontWeight: FontWeight.bold)),
                      ),
                      Container(
                        padding: EdgeInsets.all(2.0),
                        child: Text('A',
                            style: TextStyle(fontWeight: FontWeight.bold)),
                      ),
                    ]
                  ),

Run Code Online (Sandbox Code Playgroud)
        TableRow(children: <Widget>[
          Container(
            padding: EdgeInsets.all(2.0),
            child: Text('2'),
          ),
          Container(
            padding: EdgeInsets.all(2.0),
            child: Text('FW'),
          ),
          ]
        )

Run Code Online (Sandbox Code Playgroud)

代码太多了,那我就写一些代码吧。请看一下。

dart flutter flutter-table

3
推荐指数
1
解决办法
7767
查看次数

Flutter TableRow 中的手柄点击

我需要使 TableRow 可点击并导航到其他屏幕,但我无法使用 GestureDetector 或 Inkwell 包装 TableRow。如何使 TableRow 可点击。我已实施如下:

for (int i = 0; i < menuList.length; i++)
              TableRow(children: [
                SizedBox(
                  width: 5,
                ),
                Text((i + 1).toString()),
                Text(menuList[i].name),
                Text(menuList[i].price.toString()),
                Text(menuList[i].maxQty.toString()),
                menuList[i].status == 0
                    ? Text(
                        menuList[i].foodStatus,
                        style: TextStyle(color: Colors.red),
                      )
                    : YourListViewItem(
                        id: menuList[i].id,
                        index: menuList[i].status,
                      ),
              ]),
Run Code Online (Sandbox Code Playgroud)

flutter flutter-table

2
推荐指数
1
解决办法
6451
查看次数