I want to display a list of images in GridView. And I'm not able to do that. I want to know the data type for a list of images from the assets and how a constructor would help in this case. I've just started to learn flutter and I don't know how to use it.
class Home extends StatefulWidget {
final String title;
Home({this.title}) : super();
@override
_HomeState createState() => _HomeState();
}
@override
Widget build(BuildContext context) {
var gridView = new GridView.builder(
itemCount: 20,
gridDelegate:
new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (BuildContext context, int index) {
return new GestureDetector(
child: new Card(
elevation: 10,
child: new Container(
// child: *Image list as child*, but don't know about the list datatype hence not created it!
alignment: Alignment.center,
),
),
onTap: () {},
);
});
return new Scaffold(
appBar: new AppBar(
backgroundColor: Colors.red,
title: new Text("Flutter TabBar"),
),
body: Container(
padding: EdgeInsets.all(10),
child: gridView,
),
);
}
}