Created
January 6, 2019 19:13
-
-
Save salihgueler/bd63e33df347a8736d2ea8c686bf6685 to your computer and use it in GitHub Desktop.
Sunday
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return new FutureBuilder( | |
future: getMovies(), | |
builder: (BuildContext context, | |
AsyncSnapshot<List> snapshot) { | |
if (!snapshot.hasData) | |
// Shows progress indicator until the data is load. | |
return new MaterialApp( | |
home: new Scaffold( | |
body: new Center( | |
child: new CircularProgressIndicator(), | |
), | |
) | |
); | |
// Shows the real data with the data retrieved. | |
List movies = snapshot.data; | |
return new CustomScrollView( | |
primary: false, | |
slivers: <Widget>[ | |
new SliverPadding( | |
padding: const EdgeInsets.all(10.0), | |
sliver: new SliverGrid.count( | |
crossAxisSpacing: 10.0, | |
mainAxisSpacing: 10.0, | |
crossAxisCount: 2, | |
children: createMovieCardItem(movies, context), | |
), | |
), | |
], | |
); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment