如何在ListView中对齐多个按钮

时间:2019-07-13 01:52:27

标签: flutter dart

我正在尝试将2个IconButton小部件与文本和复选框对齐,以使所有它们都水平对齐。当前,仅复选框和文本已正确对齐,而图标按钮未正确对齐。我已经调整了高度以显示问题:2个图标按钮最终位于复选框和文本下方。正确对齐后,高度最好为56。

我尝试将Wrap替换为Expanded,Row和Column,但无法让其中任何一个显示我的意愿。我还尝试将4个单独的“列”小部件放在“行”小部件中,以尝试正确对齐它,但这也行不通。

child: new ListView.separated(
        //padding: const EdgeInsets.all(10),
        itemCount: tasks.length,
        itemBuilder: (BuildContext context, int index) {
          return Container(
            height: 100,
            child: Wrap(
                children: <Widget>[
                  new CheckboxListTile(
                    value: selected[index],
                    title: new Text(
                      tasks[index],
                      style: fontSize20,
                    ),
                    controlAffinity: ListTileControlAffinity.leading,
                    onChanged: (bool val){
                      ItemChange(val, index);
                    }
                  ),
                  new IconButton(
                    icon: Icon(FontAwesomeIcons.qrcode),
                    color: Colors.black,
                    iconSize: 18,
                    onPressed: null,
                  ),
                  new IconButton(
                    icon: Icon(Icons.edit),
                    onPressed: null,
                  )
                ],
              )
            );
        },
        separatorBuilder: (BuildContext context, int index) => const Divider(),
      )

0 个答案:

没有答案