Skip to content

Instantly share code, notes, and snippets.

@theindianappguy
Created May 18, 2020 14:17
Show Gist options
  • Save theindianappguy/3a1c40b811cd8dcb02030929f729c4df to your computer and use it in GitHub Desktop.
Save theindianappguy/3a1c40b811cd8dcb02030929f729c4df to your computer and use it in GitHub Desktop.
Widget wallpapersList({List<WallpaperModel> wallpapers, context}){
return Container(
child: GridView.count(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 16),
physics: ClampingScrollPhysics(),
crossAxisCount: 2,
childAspectRatio: 0.6,
mainAxisSpacing: 6.0,
crossAxisSpacing: 6.0,
children: wallpapers.map((wallpaper){
return GridTile(
child: GestureDetector(
onTap: (){
Navigator.push(context, MaterialPageRoute(
builder: (context) => ImageView(
imgUrl: wallpaper.src.portrait,
)
));
},
child: Hero(
tag: wallpaper.src.portrait,
child: Container(
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image.network(wallpaper.src.portrait, fit: BoxFit.cover,)),
),
),
),
);
}).toList(),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment