I would like to get the name of each item coming from snapshot.data!.sections![i].checklists! .map((e) => e.quesito and transform it into Text (' ') for each item, but I didn't find a solution at this moment and I can't get the title for my SwitchListTile...
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 6,
itemBuilder: (context, i) {
return Column(
children: <Widget>[
Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 15),
color: Colors.grey[200],
child: Row(
children: [
Text(
'${snapshot.data!.secoes![i].nome}',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 30,
),
],
),
),
...snapshot.data!.secoes![i].checklists!
.map<Widget>(
(e) => SwitchListTile(
title: Text(''),
value: true,
onChanged: (bool newValue) {},
),
),
],
);
},
),
CodePudding user response:
If you are sure you have the data parsed, you can simply call the data from the map.
...snapshot.data!.secoes![i].checklists!
.map<Widget>(
(e) => SwitchListTile(
title: Text(e.quesito),
value: true,
onChanged: (bool newValue) {},
),
),