Commit c0934c6f authored by Brian Runck's avatar Brian Runck
Browse files

update 2

parent 19bb86e0
# untitled
# NeutralNews
A new Flutter project.
More and more news articles are in this day and age are peppered with opinions and emotions.
## Getting Started
To combat this NeutralNews targets to inform the user of the Kind and degree of positive or negative Sentiment in the title and description of the article using AI.
Newsprovider : nytimes.com
This project is a starting point for a Flutter application.
Analysis API Provider: monkeylearn.com and sentim-api.herokuapp.com
A few resources to get you started if this is your first Flutter project:
# Getting Started
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
1. Install the Dart and Flutter SDK
2. Navigate to the Flutter SDK folder and change to the Flutter beta channel and enable web support with
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
flutter channel beta
flutter upgrade
flutter config --enable-web
3. Clone the Project and navigate to its Path
4. Run with
flutter run -d web
\ No newline at end of file
......@@ -12,6 +12,8 @@ import 'dart:convert';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:http/http.dart';
import 'package:syncfusion_flutter_gauges/gauges.dart';
import 'package:url_launcher/url_launcher.dart';
void main() => runApp(MyApp());
......@@ -25,40 +27,16 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bullshit Analyser',
title: 'NeutralNews',
home: HomePage(),
);
}
}
class Article extends StatefulWidget {
@override
State<StatefulWidget> createState() => _ArticleState();
}
class _ArticleState extends State<Article> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget> [
Image.asset("assets/lol.gif"),
Text('test',
style : TextStyle(
fontSize: 25,
),
textAlign: TextAlign.left,
),
],
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
......@@ -108,7 +86,7 @@ class _HomePageState extends State<HomePage> {
//print(lol);
Response response = await http.post( Uri.encodeFull(URLS.Monkey_URL),
headers: {
"Authorization" : "Token bc1149743cca098ac5c2d5c10fbeff3c11e9dac8",
"Authorization" : "Token b518f54897fce220ad41d4b150e33b821cfa4fae",
"Content-Type" : "application/json"
},
body:
......@@ -116,7 +94,6 @@ class _HomePageState extends State<HomePage> {
);
var soos = jsonDecode(response.body);
print(soos);
return json.decode(response.body);
......@@ -130,45 +107,66 @@ class _HomePageState extends State<HomePage> {
final _biggerFont = TextStyle(fontSize: 18.0);
return ListView.builder(
itemCount: 50,
padding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
itemCount: 30,
itemBuilder: (BuildContext context, int index) {
return Column(
children: [
Image.network(
Uri.encodeFull(_suggestions["results"][index]["multimedia"][0]["url"]),
if (index.isEven) {
return Divider(thickness: 4,height: 50,);
}
return Flex(
direction: MediaQuery.of(context).size.width>0 ? Axis.horizontal : Axis.vertical,
children: [Image.network(
Uri.encodeFull(_suggestions["results"][index~/2]["multimedia"][0]["url"]),
height: 180),
Text(_suggestions["results"][index]["title"], style: TextStyle(fontSize: 24)),
Text(_suggestions["results"][index]["abstract"], style: TextStyle(fontSize: 18)),
FutureBuilder(
future: Future.wait([
getSentimOpinion("${_suggestions["results"][index]["title"]}.\n${_suggestions["results"][index]["abstract"]}"),
getMonkeyOpinion("${_suggestions["results"][index]["title"]}.\n${_suggestions["results"][index]["abstract"]}")
]),
builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Center (
heightFactor: 2,
child : CircularProgressIndicator(),
);
SizedBox(width: 50),
Expanded(
flex: 3,
child:
Column(
children: [
Text(_suggestions["results"][index~/2]["title"], style: TextStyle(fontSize: 24)),
Text(_suggestions["results"][index~/2]["abstract"], style: TextStyle(fontSize: 18)),
FutureBuilder(
future: Future.wait([
getSentimOpinion("${_suggestions["results"][index~/2]["title"]}.\n${_suggestions["results"][index~/2]["abstract"]}"),
getMonkeyOpinion("${_suggestions["results"][index~/2]["title"]}.\n${_suggestions["results"][index~/2]["abstract"]}")
]),
builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Center (
heightFactor: 2,
child : CircularProgressIndicator(),
);
default:
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
else
return Text(
"\nJudgement : Sentim-API 1 : ${snapshot.data[0]["result"]["type"]} : Polarity : ${snapshot.data[0]["result"]["polarity"]}\n"
" Monkeylearn-API 2 : ${snapshot.data[1][0]["classifications"][0]["tag_name"]} : Confidence : ${snapshot.data[1][0]["classifications"][0]["confidence"]}",
style: TextStyle(fontSize: 25,color: Colors.blue));
}
})
]
default:
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
else
return Text(
"\nJudgement 1 : ${snapshot.data[0]["result"]["type"]} : ${snapshot.data[0]["result"]["polarity"]}\n\n"
"Judgement 2 : ${snapshot.data[1][0]["classifications"][0]["tag_name"]} : ${snapshot.data[1][0]["classifications"][0]["confidence"]}\n",
style: TextStyle(fontSize: 20));
}
})
],); }
)
)
]);
}
);
String imgUrl = _suggestions["results"][index]["multimedia"][0]["url"];
String title = _suggestions["results"][index]["title"];
String abstract = _suggestions["results"][index]["abstract"];
......@@ -199,31 +197,63 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[
DrawerHeader(
child: Text('Bullshit Analyser'),
child: Text('NeutralNews',style: TextStyle(color: Colors.white)),
decoration: BoxDecoration(
color: Colors.blue,
),
),
ListTile(
title: Text('Item 1'),
title: Text('GitLab'),
onTap: () {
launch("https://git.thm.de/brnk73/neutralnews");
},
),
ListTile(
title: Text('about'),
onTap: () {
// Update the state of the app.
// ...
showDialog(
context: context,
builder :
(context) {
return AlertDialog(
title: Container(alignment: Alignment.center, child: Text('about')),
content: Text("More and more news articles are in this day and age are peppered with opinions and emotions. "
"To combat this NeutralNews targets to inform the user of the Kind and degree of positive or negative Sentiment in the title and description of the article using AI. "
"\n\nNewsprovider : nytimes.com\n\nAnalysis API Provider: monkeylearn.com and sentim-api.herokuapp.com"),
);
}
);
},
),
ListTile(
title: Text('Item 2'),
title: Text('imprint'),
onTap: () {
// Update the state of the app.
// ...
showDialog(
context: context,
builder :
(context) {
return AlertDialog(
title: Container(alignment: Alignment.center, child: Text('imprint')),
content: Text("Brian Runck\nGrünberger Str. 190\n35394 Gießen\n\nGermany\n\nMail: brian.runck@mni.thm.de\nPhone: +4915738968025\n\nprivate individual"),
);
}
);
},
),
],
)
),
appBar: AppBar(
title: Text('Bullshit Analyser'),
title: Text('NeutralNews'),
),
body: FutureBuilder<Widget>(
future: haupt,
......
......@@ -74,6 +74,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
......@@ -88,6 +93,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
matcher:
dependency: transitive
description:
......@@ -116,6 +128,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
sky_engine:
dependency: transitive
description: flutter
......@@ -149,6 +182,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety"
syncfusion_flutter_core:
dependency: transitive
description:
name: syncfusion_flutter_core
url: "https://pub.dartlang.org"
source: hosted
version: "18.2.55"
syncfusion_flutter_gauges:
dependency: "direct main"
description:
name: syncfusion_flutter_gauges
url: "https://pub.dartlang.org"
source: hosted
version: "18.2.55"
term_glyph:
dependency: transitive
description:
......@@ -170,6 +217,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.5.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+5"
vector_math:
dependency: transitive
description:
......@@ -179,3 +268,4 @@ packages:
version: "2.1.0-nullsafety.2"
sdks:
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
......@@ -25,7 +25,8 @@ dependencies:
sdk: flutter
english_words: ^3.1.5
http: ^0.12.0+2
syncfusion_flutter_gauges: ^18.2.55
url_launcher: ^5.4.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
......
......@@ -12,10 +12,11 @@
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<link rel="shortcut icon" href="favicon.ico"/>
<title>untitled</title>
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
......@@ -29,5 +30,21 @@
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#edeff5",
"text": "#838391"
},
"button": {
"background": "#4b81e8"
}
},
"position": "bottom-right"
});
</script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment