Skip to content

Instantly share code, notes, and snippets.

@Elvis10ten
Last active March 5, 2018 23:08
Show Gist options
  • Select an option

  • Save Elvis10ten/c47517c0552cb18ccbc12958e0070689 to your computer and use it in GitHub Desktop.

Select an option

Save Elvis10ten/c47517c0552cb18ccbc12958e0070689 to your computer and use it in GitHub Desktop.
Widget _getListViewWidget() {
// We want the ListView to have the flexibility to expand to fill the
// available space in the vertical axis
return new Flexible(
child: new ListView.builder(
// The number of items to show
itemCount: _currencies.length,
// Callback that should return ListView children
// The index parameter = 0...(itemCount-1)
itemBuilder: (context, index) {
// Get the currency at this position
final Map currency = _currencies[index];
// Get the icon color. Since x mod y, will always be less than y,
// this will be within bounds
final MaterialColor color = _colors[index % _colors.length];
return _getListItemWidget(currency, color);
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment