Skip to content

Commit

Permalink
make the UI simple and white classic and add webview for read full news
Browse files Browse the repository at this point in the history
  • Loading branch information
pixiedevpraveen committed Nov 25, 2020
1 parent a117cdd commit 51a527d
Show file tree
Hide file tree
Showing 52 changed files with 1,964 additions and 62 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ app.*.symbols
# Obfuscation related
app.*.map.json

# By Pcoder
/windows/flutter/ephemeral/
# pixiedev
/lib/key/key.dart
/lib/helper/data.dart
/lib/models/categorie_model.dart
bin.dart
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "devnews",
"request": "launch",
"type": "dart"
}
]
}
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

This App called <b>Dev News </b>is a flutter project for deliver most imported news to you by api.

<a href="https://pixiedevpraveen.github.io/impfiles/apk/devnews/"> <img width="30" src="https://pixiedevpraveen.github.io/impfiles/appimage/devnews/icon/devnews.png"> </a>

## Application Images:


Screenshots of the Dev news application:

<div align="center">
<img height="300vh" alt="Dev News Screenshot 1" src="assets\images\devnewsss1.jpg" >
<img height="300vh" alt="Dev News Screenshot 2" src="assets\images\devnewsss2.jpg" >
<img height="300vh" alt="Dev News Screenshot 1" src="https://pixiedevpraveen.github.io/impfiles/appimage/devnews/devnews1-231120.jpg" >
<img height="300vh" alt="Dev News Screenshot 2" src="https://pixiedevpraveen.github.io/impfiles/appimage/devnews/devnews2-231120.jpg" >
<img height="300vh" alt="Dev News Screenshot 3" src="https://pixiedevpraveen.github.io/impfiles/appimage/devnews/devnews3-231120.jpg" >
</div>

## Getting Started
work is in progress
## Contact us:

My website Link - <a href="https://pcoder7.blogspot.com">pcoder7.blogspot.com</a>

Insta Id -<a href="https://www.instagram.com/praveen7787y">@praveen7787y</a>

git - <a href="https://github.com/pixiedevpraveen">pixiedevpraveen</a>

2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
</manifest>
12 changes: 12 additions & 0 deletions android/app/src/main/res/drawable-v21/launch_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
Binary file removed assets/images/devnewsss1.jpg
Binary file not shown.
Binary file removed assets/images/devnewsss2.jpg
Binary file not shown.
Binary file removed assets/images/header.jpg
Binary file not shown.
23 changes: 11 additions & 12 deletions lib/homepage.dart → lib/devnews_old/homepage.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'dart:convert';
// import 'dart:html';
import 'package:http/http.dart' as http;
import 'package:devnews/key/key.dart';
// import 'dart:html';

import 'package:devnews/newspage.dart';
import 'package:devnews/devnews_old/newspage.dart';

import 'appbar.dart';
import 'drawer.dart'; // drink Detail
import 'package:devnews/devnews_old/widgets/widgets.dart'; // drink Detail

class HomePage extends StatefulWidget {
@override
Expand All @@ -16,7 +16,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
final appTitle = "Dev News";
var apiLink =
"http://newsapi.org/v2/top-headlines?sources=google-news-in&apiKey=53c1ce6459854f7893bee3202dc16895";
"https://newsapi.org/v2/top-headlines?sources=google-news-in&apiKey=$apiKey";
var res, newsApiOb;

@override
Expand Down Expand Up @@ -56,11 +56,11 @@ class _HomePageState extends State<HomePage> {
leading: Hero(
tag: article["title"],
child: CircleAvatar(
backgroundImage: NetworkImage(
article["urlToImage"]) ??
Image(
image: AssetImage(
'assets/images/image-not-found.jpg')),
backgroundImage:
NetworkImage(article["urlToImage"]) ??
Image(
image: AssetImage(
'assets/images/image-not-found.jpg')),
),
),
title: Text(
Expand All @@ -75,8 +75,7 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
NewsPage(article: article),
builder: (context) => NewsPage(article: article),
fullscreenDialog: true,
));
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/devnews_old/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'appbar.dart';
export 'drawer.dart';
113 changes: 113 additions & 0 deletions lib/helper/drawer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class MyDrawer extends Drawer {
MyDrawer()
: super(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage("https://avatars2.githubusercontent.com/u/58028638?s=400&u=4bd4ac811612698b5ced99990145070a49a522d6&v=4")??
Image(
image:
AssetImage('assets/images/image-not-found.jpg')),
), // will adding an network image
),
),
),
Column(
children: [
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
child: ListTile(
title: Center(child: Text("Praveen Yadav")),
subtitle: Column(
children: [
Text("Software Developer"),
Center(
child: InkWell(
child: Text(
"www.pcoder7.blogspot.com",
style: TextStyle(
color: Colors.blue,
),
),
onTap: () => launch("https://pcoder7.blogspot.com"),
),
),
],
),
tileColor: Colors.pink[50],
),
),
// SizedBox(
// height: 20.0,
// ),
// ListTile(
// leading: CircleAvatar(
// child: Text(
// "M UI",
// textScaleFactor: 1.0,
// ),
// backgroundColor: Colors.pink[50],
// foregroundColor: Colors.black,
// ),
// title: Text("Minimal UI"),
// subtitle: Text("Click To Go"),
// tileColor: Colors.pink[100],
// onTap: () {

// },
// ),

],
),
/* SizedBox(
height: 5.0,
),
ListTile(
leading: CircleAvatar(
child: Text(
"2",
textScaleFactor: 2.0,
),
backgroundColor: Colors.pink[50],
foregroundColor: Colors.black,
),
title: Text("Title 2"),
subtitle: Text("Subtitle 2"),
tileColor: Colors.pink[100],
onTap: () {
// drawerHeaderText = "You Clicked On title No: 2";
// setState(() {});
},
),
SizedBox(
height: 5.0,
),
ListTile(
leading: CircleAvatar(
child: Text(
"R",
textScaleFactor: 2.0,
),
backgroundColor: Colors.pink[50],
foregroundColor: Colors.black,
),
title: Text("Reset"),
subtitle: Text("Subtitle 2"),
tileColor: Colors.pink[200],
onTap: () {
// drawerHeaderText = "Drawer Header";
// setState(() {});
},
) */
],
));
}
83 changes: 83 additions & 0 deletions lib/helper/news.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import 'package:http/http.dart' as http;
import 'package:devnews/models/article.dart';
import 'dart:convert';

import 'package:devnews/key/key.dart';

class News {

List<Article> news = [];

Future<void> getNews() async{

String url = "https://newsapi.org/v2/top-headlines?country=in&excludeDomains=stackoverflow.com&sortBy=publishedAt&language=en&apiKey=$apiKey";

var response = await http.get(url);

var jsonData = jsonDecode(response.body);

if(jsonData['status'] == "ok"){
jsonData["articles"].forEach((element){

if(element['urlToImage'] != null && element['description'] != null){
Article article = Article(
title: element['title'],
author: element['author'],
description: element['description'],
urlToImage: element['urlToImage'],
publshedAt: DateTime.parse(element['publishedAt']),
content: element["content"],
articleUrl: element["url"],
);
news.add(article);
}

});
}


}


}


class NewsForCategorie {

List<Article> news = [];

Future<void> getNewsForCategory(String category) async{

/*String url = "https://newsapi.org/v2/everything?q=$category&apiKey=${apiKey}";*/
String url = "https://newsapi.org/v2/top-headlines?country=in&category=$category&apiKey=$apiKey";

var response = await http.get(url);

var jsonData = jsonDecode(response.body);

if(jsonData['status'] == "ok"){
jsonData["articles"].forEach((element){

if(element['urlToImage'] != null && element['description'] != null){
Article article = Article(
title: element['title'],
author: element['author'],
description: element['description'],
urlToImage: element['urlToImage'],
publshedAt: DateTime.parse(element['publishedAt']),
content: element["content"],
articleUrl: element["url"],
);
news.add(article);
}

});
}


}


}


Loading

0 comments on commit 51a527d

Please sign in to comment.