Skip to content

Commit

Permalink
Add News section
Browse files Browse the repository at this point in the history
Co-authored-by: Simone Sestito <[email protected]>
  • Loading branch information
m-i-n-a-r and Simone Sestito committed Oct 21, 2018
1 parent ca667b8 commit 2df4ded
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 3 deletions.
90 changes: 90 additions & 0 deletions lib/localdata.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import 'package:escape_earth/model/News.dart';

final latestNews = List.unmodifiable(<News>[
News(
title: "Here's How to Observe the Moon",
text:
"""International Observe the Moon Night is upon us! Join the worldwide celebration of lunar exploration and science on Oct. 20, 2018, by observing the Moon in all of its beautiful splendor. Every year since 2010, International Observe the Moon Night invites participants all over the world to come together, watch the Moon, and celebrate our nearest celestial neighbor.
The best part is, anybody can participate—all you have to do is look up!
Attend an Event
Hundreds of events are planned in all manner of places—from museums to backyards to brewing companies. Any astronomy club, interested group, or individual can host an event; events range from small family gatherings to community events that draw hundreds of visitors. Take a look at our map to search for an event near you—or, take the initiative and host your own event.
Many NASA centers are also hosting public events to celebrate International Observe the Moon Night, such as Wallops, Goddard, and Marshall. Come by to peek at the Moon with our telescopes, make Moon-themed crafts with your family, and hear personal stories from NASA employees about the Apollo moon landings. It was almost 50 years ago when the Apollo 8 astronauts became the first humans to enter lunar orbit on Dec. 24, 1968. The upcoming 50th anniversaries of NASA's Apollo missions present an opportunity to discuss lunar exploration and to celebrate all of the people who participated and shared in this human triumph.
Whether you attend an event, host your own, or just look up—we want to hear about it! Hear updates, share pictures and highlights from your event, and connect to fellow lunar enthusiasts around the world through @NASAMoon and #observethemoon on Twitter and the International Observe the Moon Night page on Facebook. You can also submit your photos to the International Observe the Moon Night 2018 page on Flickr. """,
date: DateTime.utc(2018, 10, 21),
preview:
"International Observe the Moon Night is upon us! Join the worldwide celebration of lunar exploration and science on Oct. 20, 2018, by observing the Moon in all of its beautiful splendor.",
imageUrl:
"https://www.nasa.gov/sites/default/files/styles/card_page_banner/public/thumbnails/image/observethemoonbanner2.jpg"),
News(
title:
"Kes 75: Milky Way's Youngest Pulsar Exposes Secrets of Star's Demise",
text:
"""Scientists have confirmed the identity of the youngest known pulsar in the Milky Way galaxy using data from NASA's Chandra X-ray Observatory. This result could provide astronomers new information about how some stars end their lives.
After some massive stars run out of nuclear fuel, then collapse and explode as supernovas, they leave behind dense stellar nuggets called "neutron stars". Rapidly rotating and highly magnetized neutron stars produce a lighthouse-like beam of radiation that astronomers detect as pulses as the pulsar's rotation sweeps the beam across the sky.
Since Jocelyn Bell Burnell, Anthony Hewish, and their colleagues first discovered pulsars through their radio emission in the 1960s, over 2,000 of these exotic objects have been identified. However, many mysteries about pulsars remain, including their diverse range of behaviors and the nature of stars that form them.
New data from Chandra are helping address some of those questions. A team of astronomers has confirmed that the supernova remnant Kes 75, located about 19,000 light years from Earth, contains the youngest known pulsar in the Milky Way galaxy.
The rapid rotation and strong magnetic field of the pulsar have generated a wind of energetic matter and antimatter particles that flow away from the pulsar at near the speed of light . This pulsar wind has created a large, magnetized bubble of high-energy particles called a pulsar wind nebula, seen as the blue region surrounding the pulsar.
In this composite image of Kes 75, high-energy X-rays observed by Chandra are colored blue and highlight the pulsar wind nebula surrounding the pulsar, while lower-energy X-rays appear purple and show the debris from the explosion. A Sloan Digital Sky Survey optical image reveals stars in the field.
The Chandra data taken in 2000, 2006, 2009, and 2016 show changes in the pulsar wind nebula with time. Between 2000 and 2016, the Chandra observations reveal that the outer edge of the pulsar wind nebula is expanding at a remarkable 1 million meters per second, or over 2 million miles per hour.
This high speed may be due to the pulsar wind nebula expanding into a relatively low-density environment. Specifically, astronomers suggest it is expanding into a gaseous bubble blown by radioactive nickel formed in the explosion and ejected as the star exploded. This nickel also powered the supernova light, as it decayed into diffuse iron gas that filled the bubble. If so, this gives astronomers insight into the very heart of the exploding star and the elements it created.
The expansion rate also tells astronomers that Kes 75 exploded about five centuries ago as seen from Earth. (The object is some 19,000 light years away, but astronomers refer to when its light would have arrived at Earth.) Unlike other supernova remnants from this era such as Tycho and Kepler, there is no known evidence from historical records that the explosion that created Kes 75 was observed.
Why wasn't Kes 75 seen from Earth? The Chandra observations along with previous ones from other telescopes indicate that the interstellar dust and gas that fill our Galaxy are very dense in the direction of the doomed star. This would have rendered it too dim to be seen from Earth several centuries ago.
The brightness of the pulsar wind nebula has decreased by 10% from 2000 to 2016, mainly concentrated in the northern area, with a 30% decrease in a bright knot. The rapid changes observed in the Kes 75 pulsar wind nebula, as well as its unusual structure, point to the need for more sophisticated models of the evolution of pulsar wind nebulas.
A paper describing these results appeared in The Astrophysical Journal and is available online. The authors are Stephen Reynolds, Kazimierz Borokowski, and Peter Gwynne from North Carolina State University. NASA's Marshall Space Flight Center in Huntsville, Alabama, manages the Chandra program for NASA's Science Mission Directorate in Washington. The Smithsonian Astrophysical Observatory in Cambridge, Massachusetts, controls Chandra's science and flight operations.""",
date: DateTime.utc(2018, 10, 18),
preview:
"Scientists have confirmed the identity of the youngest known pulsar in the Milky Way galaxy using data from NASA's Chandra X-ray Observatory. This result could provide astronomers new information about how some stars end their lives.",
imageUrl:
"https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/kes75.jpg",
),
News(
title: "New NASA Podcast Shares ‘Invisible’ Stories of Spaceflight",
text:
"""Today, NASA released a new, limited-edition podcast called The Invisible Network, the first NASA podcast to embrace narrative storytelling. All six episodes can be downloaded and binged on NASA’s website, SoundCloud and Apple Podcasts.
You may think you know NASA: astronauts, launches, Mars rovers, and so on. This new podcast brings listeners a side of NASA they may have never heard of before — technologies crucial to spaceflight, yet often overlooked.
The podcast’s title comes from author and former NASA engineer Sunny Tsiao’s book, “Read You Loud and Clear,” which NASA published in 2008. Tsiao notes that NASA’s communications and tracking programs are often described as “invisible.” Infrastructures, he writes, are seldom recognized, except when they fall short.
If NASA’s networks are invisible, perhaps it’s because they work so well.
The goal of The Invisible Network is to engage listeners with overlooked technologies and advancements in a fresh, exciting way. The narrative format allows episodes to delve deeply into a topic, while uncovering the human side of space science and exploration. In the podcast, seemingly esoteric technologies become vital and personal pieces of NASA’s story – a rich legacy of continued innovation amongst the stars.""",
date: DateTime.utc(2018, 10, 16),
preview:
"Today, NASA released a new, limited-edition podcast called The Invisible Network, the first NASA podcast to embrace narrative storytelling. All six episodes can be downloaded and binged on NASA’s website, SoundCloud and Apple Podcasts.",
imageUrl:
"https://www.nasa.gov/sites/default/files/styles/1x1_cardfeed/public/thumbnails/image/invisinetpodcast.jpg"),
News(
title: "Chandra Operations Resume After Cause of Safe Mode Identified",
text:
"""Oct. 15 Update: The cause of Chandra's safe mode on October 10 has now been understood and the Operations team has successfully returned the spacecraft to its normal pointing mode. The safe mode was caused by a glitch in one of Chandra's gyroscopes resulting in a 3-second period of bad data that in turn led the on-board computer to calculate an incorrect value for the spacecraft momentum. The erroneous momentum indication then triggered the safe mode.
The team has completed plans to switch gyroscopes and place the gyroscope that experienced the glitch in reserve. Once configured with a series of pre-tested flight software patches, the team will return Chandra to science operations which are expected to commence by the end of this week.
At approximately 9:55 a.m. EDT on Oct. 10, 2018, NASA’s Chandra X-ray Observatory entered safe mode, in which the observatory is put into a safe configuration, critical hardware is swapped to back-up units, the spacecraft points so that the solar panels get maximum sunlight, and the mirrors point away from the Sun. Analysis of available data indicates the transition to safe mode was normal behavior for such an event. All systems functioned as expected and the scientific instruments are safe. The cause of the safe mode transition (possibly involving a gyroscope) is under investigation, and we will post more information when it becomes available.
Artist's concept of Chandra X-ray Observatory.
Artist's concept of Chandra X-ray Observatory.
Credits: NASA/CXC/SAO
Chandra is 19 years old, which is well beyond the original design lifetime of 5 years. In 2001, NASA extended its lifetime to 10 years. It is now well into its extended mission and is expected to continue carrying out forefront science for many years to come.""",
date: DateTime.utc(2018, 10, 15),
preview:
"Chandra is 19 years old, which is well beyond the original design lifetime of 5 years. In 2001, NASA extended its lifetime to 10 years.",
imageUrl:
"https://www.nasa.gov/sites/default/files/styles/2x1_cardfeed/public/thumbnails/image/chandra_4k_v2.jpg")
]);
18 changes: 18 additions & 0 deletions lib/model/News.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:meta/meta.dart';

@immutable
class News {
final String title;
final String preview;
final String imageUrl;
final String text;
final DateTime date;

News({
@required this.title,
@required this.preview,
@required this.imageUrl,
@required this.text,
@required this.date,
});
}
38 changes: 38 additions & 0 deletions lib/route/SingleNewsRoute.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:escape_earth/model/News.dart';
import 'package:flutter/material.dart';

class SingleNewsRoute extends StatelessWidget {
final News news;

SingleNewsRoute({
Key key,
this.news,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(news.title),
backgroundColor: Theme.of(context).backgroundColor,
),
body: ListView(
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 250.0,
),
child: Hero(
child: Image.network(news.imageUrl, fit: BoxFit.fitWidth),
tag: news.imageUrl,
),
),
Padding(
padding: EdgeInsets.all(16.0),
child: Text(news.text),
),
],
),
);
}
}
5 changes: 3 additions & 2 deletions lib/route/collection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CollectionRocketRoute extends StatelessWidget {
}

return ListView.builder(
padding: EdgeInsets.only(top: 90.0),
padding: EdgeInsets.only(top: 90.0, right: 16.0, left: 16.0),
itemCount: snap.data.length,
itemBuilder: (context, i) => RocketView(launch: snap.data[i]),
);
Expand All @@ -34,7 +34,8 @@ class CollectionRocketRoute extends StatelessWidget {
Align(
alignment: Alignment.topCenter,
child: RoundSearch(onSearch: (query) {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => LaunchesResultRoute(query: query)));
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => LaunchesResultRoute(query: query)));
}),
),
],
Expand Down
5 changes: 4 additions & 1 deletion lib/route/home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:escape_earth/bottom_home.dart';
import 'package:escape_earth/route/collection.dart';
import 'package:escape_earth/route/qa.dart';
import 'package:escape_earth/view/NewsView.dart';
import 'package:escape_earth/view/RocketHero.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -42,7 +43,9 @@ class HomeState extends State<Home> {
clickListener: (index) {
switch (index) {
case 0:
// TODO click
setState(() {
currentFragment = NewsList();
});
break;
case 1:
if (currentFragment is HomeBody) {
Expand Down
75 changes: 75 additions & 0 deletions lib/view/NewsView.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'package:escape_earth/model/News.dart';
import 'package:escape_earth/route/SingleNewsRoute.dart';
import 'package:flutter/material.dart';
import 'package:escape_earth/localdata.dart';

class NewsList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: ListView.builder(
itemCount: latestNews.length,
padding: EdgeInsets.only(left: 16.0, right: 16.0),
itemBuilder: (context, i) => NewsItem(news: latestNews[i])),
);
}
}

class NewsItem extends StatelessWidget {
final News news;

NewsItem({
Key key,
this.news,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return GestureDetector(
child: Card(
color: Color.fromARGB(0xe5, 0xff, 0xff, 0xff),
child: Column(
children: <Widget>[
Stack(
alignment: Alignment.center,
children: <Widget>[
Stack(
children: <Widget>[
Hero(
tag: news.imageUrl,
child: Container(
height: 100.0,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
colorFilter:
ColorFilter.mode(Colors.black, BlendMode.overlay),
image: NetworkImage(news.imageUrl),
)),
),
),
],
),
Padding(
padding: EdgeInsets.all(12.0),
child: Text(
news.title,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
],
),
Padding(
padding: EdgeInsets.all(11.0),
child: Text(news.preview, style: TextStyle(color: Colors.black)),
),
],
),
),
onTap: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => SingleNewsRoute(news: news))),
);
}
}

0 comments on commit 2df4ded

Please sign in to comment.