alvinvin00

detail.dart

Mar 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.97 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. import 'package:bencana/post.dart';
  4. import 'package:bencana/utilities.dart';
  5. import 'package:cached_network_image/cached_network_image.dart';
  6.  
  7. class DetailPage extends StatefulWidget {
  8.   final Post post;
  9.  
  10.   DetailPage(this.post);
  11.  
  12.   @override
  13.   _DetailPageState createState() => _DetailPageState();
  14. }
  15.  
  16. class _DetailPageState extends State<DetailPage> {
  17.   Utilities util;
  18.  
  19.   @override
  20.   Widget build(BuildContext context) {
  21.     return Scaffold(
  22.       appBar: AppBar(
  23.         title: Text('Detail'),
  24.       ),
  25.       body: Container(
  26.         child: Column(
  27.           children: <Widget>[
  28.             Center(
  29.               child: CachedNetworkImage(
  30.                 placeholder: (context, url) => CircularProgressIndicator(),
  31.                 errorWidget: (context, url, error) => Icon(Icons.error),
  32.                 imageUrl: widget.post.photo,
  33.                 height: 240.0,
  34.                 width: double.infinity,
  35.                 fit: BoxFit.fitWidth,
  36.               ),
  37.             ),
  38.             Card(
  39.               child: Column(
  40.                 crossAxisAlignment: CrossAxisAlignment.start,
  41.                 children: <Widget>[
  42.                   Padding(
  43.                     padding: const EdgeInsets.only(
  44.                       left: 16.0,
  45.                       right: 16.0,
  46.                       top: 10.0,
  47.                       bottom: 10.0,
  48.                     ),
  49.                     child: Row(
  50.                       children: <Widget>[
  51.                         Text(
  52.                           widget.post.title,
  53.                           style: TextStyle(
  54.                             fontWeight: FontWeight.bold,
  55.                             fontSize: 18.0,
  56.                           ),
  57.                         ),
  58.                         Expanded(
  59.                           child: SizedBox(),
  60.                         ),
  61. //                        Text(
  62. //                          util.convertTimestamp(
  63. //                            post.timestamp,
  64. //                          ),
  65. //                          style: TextStyle(
  66. //                            fontSize: 14.0,
  67. //                            color: Colors.grey,
  68. //                          ),
  69. //                        ),
  70.                       ],
  71.                     ),
  72.                   ),
  73.                   Padding(
  74.                     padding: const EdgeInsets.only(
  75.                       left: 16.0,
  76.                       right: 16.0,
  77.                       bottom: 10.0,
  78.                     ),
  79.                     child: Text(
  80.                       widget.post.content,
  81.                       style: TextStyle(
  82.                         fontSize: 14.0,
  83.                         color: Colors.grey,
  84.                       ),
  85.                     ),
  86.                   ),
  87.                   SizedBox(
  88.                     height: 20,
  89.                   ),
  90.                 ],
  91.               ),
  92.             ),
  93.           ],
  94.         ),
  95.       ),
  96.     );
  97.   }
  98. }
Add Comment
Please, Sign In to add comment