как я могу применить и CircleAvatar, и Checkbox в одном ListTile - PullRequest
0 голосов
/ 06 августа 2020

Sorry, i don't have a layout right now for what i want to achieve but my idea is just to add a CircleAvatar right after the CheckBox Thankyou.

Sorry, i don't have a layout right now for what i want to achieve but my idea is just to add a CircleAvatar right after the CheckBox Thankyou.

' Im trying to display all inserted and updated data stored in database how ever i see that i can't apply both CircleAvatar and Checkbox in one ListTile is there any other way to combine them ? any suggestion will be appreciated.

return Card(
    child: ListTile(
  leading: Checkbox(
    value: widget.Contactlist[index].isSelect,
    onChanged: (bool value) {
      setState(() {
        widget.Contactlist[index].isSelect = value;
      });
    },
  ),
  trailing: GestureDetector(
    onTap: () {
      _selectedDetele(snapshot.data[index].id);
    },
    child: Icon(Icons.delete),
  ),
  title: Text(
    '${snapshot.data[index].firstname}' +
        ',' +
        '${snapshot.data[index].lastname}' +
        '(' +
        '${snapshot.data[index].contactnumber}' +
        ')',
    maxLines: 1,
  ),
  subtitle: Text(
    '${snapshot.data[index].birthday}',
    style: TextStyle(fontSize: 10),
  ),
  dense: true,
  selected: true,
  onTap: () {},
));

1 Ответ

0 голосов
/ 06 августа 2020

CheckboxListTile оптимально для этого:

CheckboxListTile(
      controlAffinity: ListTileControlAffinity.leading,
      title: Text('Title'),
      subtitle: Text('subtitle'),
      value: true,
      onChanged: (bool value) {},
      secondary: CircleAvatar(),
    )
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...