So I have created a custom list view (list_item.dart) which is used to save data that comes from an api inside a card and display it to the user.Ehen I try to populate my listview with data I get the error "A RenderFlex overflowed by 1307 pixels on the right. inside a card widget".I have tried putting the card widget iside a flexible widget but it didnt work. please help.
class CustomListItem extends StatelessWidget {
final String subtitle;
final String secondaryText;
final String body;
final int index;
final Widget image;
final void Function() onTap;
const CustomListItem({
required this.subtitle,
required this.secondaryText,
required this.body,
required this.index, required this.onTap,
required this.image,
});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
image,
Column(
children: <Widget>[
RichText(
text: TextSpan(
text: subtitle,
recognizer: TapGestureRecognizer()..onTap = onTap,
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
Text(secondaryText)
],
),
],
),
Container(
height: 1.0,
width: MediaQuery.of(context).size.width,
color: Colors.black,
),
Row(
children: <Widget>[Text(body)],
),
],
),
),
),
);
}
}