-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the UI simple and white classic and add webview for read full news
- Loading branch information
1 parent
a117cdd
commit 51a527d
Showing
52 changed files
with
1,964 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
android/app/src/main/res/drawable-v21/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'appbar.dart'; | ||
export 'drawer.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(() {}); | ||
}, | ||
) */ | ||
], | ||
)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
}); | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
Oops, something went wrong.