Flutter Editable Widget 中如何在表格左侧显示保存图标

问题描述 投票:0回答:1

在下面的 flutter 小部件中,有一种方法可以在表格左侧显示“保存”图标。默认情况下,它显示在最右端。我想用它来显示批准列表,并希望用户单击图标来批准给定的交易。

Editable(
        key: editableKey,
        columns: cols,
        rows: rows,
        zebraStripe: true,
        stripeColor1: Colors.blue,
        stripeColor2: Colors.grey,
        onRowSaved: (value) {
          debugPrint('onRowSaved=$value');
        },
        onSubmitted: (value) {
          debugPrint('onSubmitted=$value');
        },
        borderColor: Colors.blueGrey,
        tdStyle: const TextStyle(fontWeight: FontWeight.bold),
        trHeight: 80,
        thStyle: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
        thAlignment: TextAlign.center,
        thVertAlignment: CrossAxisAlignment.end,
        thPaddingBottom: 3,
        showSaveIcon: true,
        saveIconColor: Colors.black,
        saveIcon: Icons.approval_sharp,
        showCreateButton: true,
        tdAlignment: TextAlign.left,
        tdEditableMaxLines: 100, // don't limit and allow data to wrap
        tdPaddingTop: 0,
        tdPaddingBottom: 14,
        tdPaddingLeft: 10,
        tdPaddingRight: 8,
        focusedBorder: const OutlineInputBorder(
            borderSide: BorderSide(color: Colors.blue),
            borderRadius: BorderRadius.all(Radius.circular(0))),
      )

*** 编辑****

这是当前的 UI 图像。最右边的图像是“保存”图标。我希望这些显示在表格的左侧。

flutter datagrid
1个回答
0
投票

*) 在数据网格中:

GridColumn(columnWidthMode:ColumnWidthMode.fill,minimumWidth:200,columnName:"打印",标签:Container(padding: const EdgeInsets.对称(水平:16.0),对齐方式:Alignment.centerRight,child:Text("打印",溢出:TextOverflow.ellipsis).tr())),

*) 在 EmployeeDataSource 中: *) DataGrid 的单元格 DataGridCell(列名:'打印',值:图标(Icons.print)),

© www.soinside.com 2019 - 2024. All rights reserved.