I am building a horizontal list view where I want to display products with a caption describing the product. Each element in the list view must display an image from the url provided and have caption text beneath it. So far it works fine and displays the images but the text will not appear. I am not receiving any log errors and have used different emulators in case that was the issue with no success.
Any help and explanation would be greatly appreciated.
class HorizontalList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Container(
height: 80.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Category(
image_location: 'images/cats/accessories.png',
image_caption: 'accessories',
),
Category(
image_location: 'images/cats/dress.png',
image_caption: 'dress',
),
Category(
image_location: 'images/cats/formal.png',
image_caption: 'formal',
),
Category(
image_location: 'images/cats/informal.png',
image_caption: 'informal',
),
Category(
image_location: 'images/cats/tshirt.png',
image_caption: 'tshirt',
),
Category(
image_location: 'images/cats/jeans.png',
image_caption: 'jeans',
),
Category(
image_location: 'images/cats/shoe.png',
image_caption: 'shoe',
),
],
),
);
}
}
class Category extends StatelessWidget {
final String image_location;
final String image_caption;
Category({
this.image_location,
this.image_caption
});
@override
Widget build(BuildContext context) {
return new Padding(padding: const EdgeInsets.all(2.0),
child: InkWell(onTap: () {},
child: Container(
width: 100.0,
child: ListTile(
title: Image.asset(image_location,
width: 100.0,
height: 80.0,),
subtitle: Container(
alignment: Alignment.topCenter,
child: Text(image_caption),
)
),
),
),);
}
}