The card structure I want to make
I tried to do something as I specified in my code, but it was not exactly what I wanted.
For example, I get overflow errors etc. even though I specify horizontal.
Is using listTile the wrong decision here
SizedBox(
child: ListView.builder(
scrollDirection: Axis.vertical,
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: campSites.length,
itemBuilder: (context, index) {
Map<String, dynamic> campSite = campSites[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 99,
width: 94,
child: ClipRRect(
borderRadius: BorderRadius.circular(15),
child: CachedNetworkImage(
imageUrl: campSite['image'],
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
placeholder: (context, url) =>
const CircularProgressIndicator(),
errorWidget: (context, url, error) =>
const Icon(Icons.error),
),
),
),
ListTile(
title: Text(campSite['name'],
style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text('${campSite['location']} away'),
),
],
),
);
},
),
);
2
Answers
Please try
PageView
+Row
See the example for more information
It seems like you are trying to create a card structure for displaying campsite information using Flutter. The code you provided is on the right track, but if you are facing overflow errors, you might need to adjust the sizing and layout of your widgets.