Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1.  
  2. class HalamanDetailBerita extends StatelessWidget {
  3. Article article;
  4.  
  5. HalamanDetailBerita(this.article);
  6.  
  7. @override
  8. Widget build(BuildContext context) {
  9. return Scaffold(
  10. appBar: AppBar(
  11. title: Text("detail berita"),
  12. actions: <Widget>[
  13. IconButton(
  14. icon: Icon(Icons.link),
  15. onPressed: () {
  16. Navigator.push(context,
  17. MaterialPageRoute(builder: (context) => HalamanWebView(article.url)));
  18. },
  19. )
  20. ],
  21. ),
  22. body: SingleChildScrollView(
  23. child: Column(
  24. mainAxisAlignment: MainAxisAlignment.center,
  25. children: <Widget>[
  26. Container(
  27. width: double.infinity,
  28. child: Image.network(
  29. article.urlToImage,
  30. fit: BoxFit.fill,
  31. )),
  32. Text(
  33. article?.title ?? "tidak ada",
  34. style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
  35. ),
  36. Row(
  37. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  38. children: <Widget>[
  39. Text(
  40. article?.author ?? " tidak ada",
  41. ),
  42. Text(article?.publishedAt.toString().substring(0, 11) ??
  43. "tidak ada"),
  44. ],
  45. ),
  46. Container(
  47. child: Text(
  48. article.content,
  49. textAlign: TextAlign.justify,
  50. ),
  51. )
  52. ],
  53. ),
  54. ));
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement