View post_details.dart
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:news_aggreator/home_page.dart';
class PostDetails extends StatefulWidget {
PostDetails(this.post);
final Post post;
@override
State<StatefulWidget> createState() => new _PostDetailsState(post);
View home_page.dart
Widget _getPostWidgets(int index) {
var post = postList[index];
return new GestureDetector(
onTap: () {
openDetailsUI(post);
},
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0),
child: new Card(
elevation: 3.0,
View home_page.dart
class _MyHomePageState extends State<MyHomePage> {
bool _isRequestSent = false;
List<Post> postList = [];
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
View post.dart
class Post {
String title;
String summary;
String thumbUrl;
int timeStamp;
String url;
Post(this.title, this.summary, this.thumbUrl, this.timeStamp, this.url);
static Post getPostFrmJSONPost(dynamic jsonObject) {
View home_page.dart
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
View home_page.dart
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
View main.dart
import 'package:flutter/material.dart';
import 'package:news_aggreator/home_page.dart'
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(