Skip to content

Instantly share code, notes, and snippets.

@DK15
Created October 19, 2018 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DK15/783af00ade80f676ee670c61c7802cc9 to your computer and use it in GitHub Desktop.
Save DK15/783af00ade80f676ee670c61c7802cc9 to your computer and use it in GitHub Desktop.
Returns a list tile
Widget _getReviewTile(Review review) {
// Keep only the day, month, and year
var date = review.created.split(" ")[0];
return new Container(
child: new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Text('${review.fullName}',
style: TextStyle(color: Colors.black)),
review.profilePicURL == ""
? Image.asset(
'icons/default_profile_icon.png', height: 60.0)
: CircleAvatar(radius: 30.0,
backgroundImage: NetworkImage(review.profilePicURL))
],
),
new Column(
children: <Widget>[
],
),
new ListTile(
leading: new Column(
children: <Widget>[
new Text(_shortenedName(review.fullName), style: TextStyle(color: Colors.black)),
review.profilePicURL == "" ? Image.asset('icons/default_profile_icon.png', height: 60.0): CircleAvatar(radius: 30.0, backgroundImage: NetworkImage(review.profilePicURL))
]),
subtitle: new Text('${review.review}'),
title: new Row(
children: <Widget>[
// StarRating can only take a double, hence the " + 0.0"
new StarRating(starCount: 5, rating: review.rating + 0.0, color: Colors.amber),
new Text(date, style: new TextStyle(fontSize: 10.0))
],
)
)
],
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment