Anton Schrage
Anton Schrage

Reputation: 1301

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),
                      ),
                    );

Here u see how it looks with a row

without the row and with only the image, title and subtitle are visible.

pls help. Ty

Upvotes: 0

Views: 1639

Answers (1)

Ahmed
Ahmed

Reputation: 2319

use 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"),
                      ),
                    ],
                  ),
                )),
      )

Upvotes: 1

Related Questions