Created
October 19, 2018 09:52
-
-
Save DK15/783af00ade80f676ee670c61c7802cc9 to your computer and use it in GitHub Desktop.
Returns a list tile
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
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