简体   繁体   English

如何创建带有2个小部件的Listtile?

[英]How to Create Listtile leading with 2 Widgets?

How can i create a leading Widget that contains an image and a checkbox? 如何创建一个包含图像和复选框的领先的小部件?

i tried with a Row Widget but then my listtile grows up to much. 我尝试使用“行小部件”,但是我的列表对象长大了。

ListTile(
                      leading: Row(
                        children: <Widget>[
                          LoadImage(),
                          Checkbox(value: false, onChanged: null),öööö
                        ],
                      ),
                      title: Text(snapshot.data.documents[index]["Name"]),
                      subtitle: Text(snapshot.data.documents[index]["Status"]),
                      trailing: IconButton(
                        onPressed: (){
                          showDialog(
                              context: context,
                              builder: (_) {
                                return DialogSpielerLoeschen(
                                  snapshot: snapshot,
                                  index: index,
                                );
                              },
                          );
                        },
                        icon: Icon(Icons.delete),
                      ),
                    );

在这里,您连续查看效果

without the row and with only the image, title and subtitle are visible. 没有该行且仅包含图像,则标题和副标题可见。

pls help. 请帮助。 Ty

use CheckboxListTile 使用CheckboxListTile

ListView(
        children: List.generate(
            30,
            (item) => CheckboxListTile(
                  dense: true,
                  controlAffinity: ListTileControlAffinity.leading,
                  secondary: Icon(Icons.delete),
                  value: false,
                  onChanged: (g) {},
                  title: Row(
                    children: <Widget>[
                      FlutterLogo(),
                      Expanded(
                        child: Text("item"),
                      ),
                    ],
                  ),
                )),
      )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM