Skip to content

Instantly share code, notes, and snippets.

@aaronoe
Created July 1, 2018 14:27
Show Gist options
  • Save aaronoe/6edb18121d6ca3b4e70f62cf3906156e to your computer and use it in GitHub Desktop.
Save aaronoe/6edb18121d6ca3b4e70f62cf3906156e to your computer and use it in GitHub Desktop.
@override
Widget build(BuildContext context) {
return new FutureBuilder<Repositories>(
future: apiClient.getUserRepositoriesFuture(username),
builder: (BuildContext context,
AsyncSnapshot<Repositories> snapshot) {
if (snapshot.hasError)
return new Center(child: new Text("Network error"));
if (!snapshot.hasData)
return new Center(
child: new CircularProgressIndicator(),
);
return new ListView.builder(
itemCount: snapshot.data.nodes.length,
itemBuilder: (BuildContext context, int index) =>
new RepoPreviewTile(
repository: snapshot.data.nodes[index],
),
);
},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment