I was wondering how to build a Cupertino list like that, with a listView.builder
I did it with the CupertinoFormSection, but when i add the listView.builder
inside the form, the list does not show. So, right now i put the CupertinoFormSection after the listView, but the result is not what I want.
This is my code:
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: ListView.builder(
itemCount: entries.length,
itemBuilder: (context, i) {
return GestureDetector(
onTap: () {
setState(() async {
index = i;
if (i == 0){
await context.setLocale(Locale('en','US'));
}
else if (i == 1){
await context.setLocale(Locale('fr','FR'));
}
else {
await context.setLocale(Locale('it','IT'));
}
});
},
child: CupertinoFormSection(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:[
Text(entries[i]),
index == i
? Icon(Icons.check_outlined, color: Colors.blue,)
: Icon(null),
],
),
),
],
),
);
},
),
This is the output: