Created
May 27, 2018 16:01
-
-
Save alfianlosari/0ce257c25f5d17478e2a21cd5933db70 to your computer and use it in GitHub Desktop.
This file contains 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
class GithubItem extends StatelessWidget { | |
final Repo repo; | |
GithubItem(this.repo); | |
@override | |
Widget build(BuildContext context) { | |
return Card( | |
child: InkWell( | |
highlightColor: Colors.lightBlueAccent, | |
splashColor: Colors.red, | |
child: Container( | |
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text((repo.name != null) ? repo.name : '-', | |
style: Theme.of(context).textTheme.subhead), | |
Padding( | |
padding: EdgeInsets.only(top: 4.0), | |
child: Text( | |
repo.description != null | |
? repo.description | |
: 'No desription', | |
style: Theme.of(context).textTheme.body1), | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 8.0), | |
child: Row( | |
children: <Widget>[ | |
Expanded( | |
child: Text((repo.owner != null) ? repo.owner : '', | |
textAlign: TextAlign.start, | |
style: Theme.of(context).textTheme.caption)), | |
Expanded( | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
crossAxisAlignment: CrossAxisAlignment.center, | |
children: <Widget>[ | |
Icon( | |
Icons.star, | |
color: Colors.deepOrange, | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 4.0), | |
child: Text( | |
(repo.watchersCount != null) | |
? '${repo.watchersCount} ' | |
: '0 ', | |
textAlign: TextAlign.center, | |
style: Theme.of(context).textTheme.caption), | |
), | |
], | |
), | |
), | |
Expanded( | |
child: Text( | |
(repo.language != null) ? repo.language : '', | |
textAlign: TextAlign.end, | |
style: Theme.of(context).textTheme.caption)), | |
], | |
), | |
), | |
]), | |
)), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment