Last active
August 1, 2019 06:42
-
-
Save agarasul/b86e4eca455afa6940389547239e611a 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
import 'package:flutter/material.dart'; | |
import 'package:news_app/entity/news.dart'; | |
class ListItem extends StatelessWidget { | |
final Article article; | |
ListItem(this.article); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: Row( | |
children: <Widget>[ | |
Container( | |
height: 80, | |
width: 100, | |
child: Image.network(article.urlToImage), | |
), | |
Expanded( | |
child: Padding( | |
padding: EdgeInsets.all(8), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
article.title, | |
overflow: TextOverflow.ellipsis, | |
textAlign: TextAlign.left, | |
maxLines: 2, | |
style: TextStyle(fontWeight: FontWeight.Bold, fontSize: 16), | |
), | |
Text( | |
article.description, | |
overflow: TextOverflow.ellipsis, | |
textAlign: TextAlign.left, | |
maxLines: 2, | |
style: TextStyle(fontStyle: FontStyle.italic, fontSize: 12), | |
) | |
]), | |
), | |
) | |
], | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment