Skip to content

Instantly share code, notes, and snippets.

@rrifafauzikomara
Created December 14, 2019 16:48
Show Gist options
  • Save rrifafauzikomara/0fd5520e8cddb4cd4a571a6e0252c79e to your computer and use it in GitHub Desktop.
Save rrifafauzikomara/0fd5520e8cddb4cd4a571a6e0252c79e to your computer and use it in GitHub Desktop.
Widget showListMovie(AsyncSnapshot<Movie> snapshot) {
return ListView.builder(
itemCount: snapshot == null ? 0 : snapshot.data.results.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
child: CardListMovies(
image: 'https://image.tmdb.org/t/p/w185${snapshot.data.results[index].posterPath}',
title: snapshot.data.results[index].title,
vote: snapshot.data.results[index].voteAverage,
releaseDate: snapshot.data.results[index].releaseDate,
overview: snapshot.data.results[index].overview,
genre: snapshot.data.results[index].genreIds.take(3).map(buildGenreChip).toList(),
),
onTap: () {
Navigator.push(
context,
PageRouteBuilder(
transitionDuration: Duration(milliseconds: 777),
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return DetailPage(
title: snapshot.data.results[index].title,
imagePoster: 'https://image.tmdb.org/t/p/w185${snapshot.data.results[index].posterPath}',
rating: double.parse(snapshot.data.results[index].voteAverage),
imageBanner: 'https://image.tmdb.org/t/p/original${snapshot.data.results[index].backdropPath}',
genre: snapshot.data.results[index].genreIds.take(3).map(buildGenreChip).toList(),
overview: snapshot.data.results[index].overview,
);
}
),
);
},
);
},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment