Skip to content

Instantly share code, notes, and snippets.

@salihgueler
Created January 6, 2019 19:13
Show Gist options
  • Save salihgueler/bd63e33df347a8736d2ea8c686bf6685 to your computer and use it in GitHub Desktop.
Save salihgueler/bd63e33df347a8736d2ea8c686bf6685 to your computer and use it in GitHub Desktop.
Sunday
@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