Skip to content

Instantly share code, notes, and snippets.

@agarasul
Last active August 1, 2019 06:42
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 agarasul/b86e4eca455afa6940389547239e611a to your computer and use it in GitHub Desktop.
Save agarasul/b86e4eca455afa6940389547239e611a to your computer and use it in GitHub Desktop.
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