I try to place a dividing line between each item ListView
that is filled with the elements of an Array being as follows
body: ListView(
children: litems
.map((data) => ListTile(
title: Text(data),
trailing: PopupMenuButton(
onSelected: removeItemSelecteMenu,
icon: Icon(Icons.delete),
itemBuilder: (context) => [
PopupMenuItem(
value: data,
child: Text("Eliminar"),
)
]),
))
.toList(),
),
I try to do it the following way
body: ListView(
children: litems
.map((data) => ListTile.divideTiles(
context: context,
title: Text(data),
trailing: PopupMenuButton(
onSelected: removeItemSelecteMenu,
icon: Icon(Icons.delete),
itemBuilder: (context) => [
PopupMenuItem(
value: data,
child: Text("Eliminar"),
)
]),
))
.toList(),
),
but it sends me an error in the following lines or code
children: litems
title:
trailing:
when going to review the error children: litems
shows me the following
The argument type 'List<Iterable<Widget>>' can't be assigned to the parameter type 'List<Widget>'
You can review the parameters that the method receives
divideTiles
to understand how it works, the correct thing would be to do it this way:Another option you have is to use the ListView.separated , here is an example of how to implement it:
https://medium.com/flutter-community/flutter-adding-separator-in-listview-c501fe568c76