I want to make these elements in the middle
and I want the code to be formatted correctly
Container(
height: 100,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: controller.categories.length,
itemBuilder: (context, index) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 70,
height: 70,
child: CachedNetworkImage(
imageUrl:
"${Applink.imagesCat}/${controller.categories[index]["categories_image"]}",
),
),
SizedBox(height: 2),
Text(controller.categories[index]
["categories_name"]),
],
),
),
);
},
),
),
I tried to put the items in a row but it didn’t work
2
Answers
You can simply render your list by using map with
Row
widget to center the elements in the screenCould you try the code below? It works flawlessly for me too.