Commit 9f51b022 authored by Manuel Herold's avatar Manuel Herold

communitygraph

parent 78f45865
2021/03/15-17:09:04.000 282c Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/15-17:09:04.000 282c Recovering log #3
2021/03/15-17:09:04.000 282c Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\AutofillStrikeDatabase/000003.log
2021/03/15-17:09:03.997 1d00 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\BudgetDatabase/MANIFEST-000001
2021/03/15-17:09:03.997 1d00 Recovering log #3
2021/03/15-17:09:03.997 1d00 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.feb939e7\flutter_tools_chrome_device.d8bc148a\Default\BudgetDatabase/000003.log
This source diff could not be displayed because it is too large. You can view the blob instead.
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 17:08:16.625001","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"D:\\\\Libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"D:\\\\Libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 23:28:51.019776","version":"2.0.0"}
\ No newline at end of file
This diff is collapsed.
import 'package:intl/intl.dart';
import 'post.dart';
class Community {
......@@ -5,4 +7,10 @@ class Community {
final String name;
final double trust;
List<Post> posts;
String get formattedTrustScore {
NumberFormat format = NumberFormat("###.00");
return format.format(trust*100)+"%";
}
}
......@@ -21,12 +21,6 @@ class Post {
return title;
}
String get effectiveContent {
if (content != null && content.isNotEmpty) return content;
return title;
}
String get formattedTrustScore {
NumberFormat format = NumberFormat("###.00");
......
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
......@@ -9,16 +10,23 @@ class LoadingScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ColorHolder.color3,
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SpinKitRotatingCircle(
color: Theme.of(context).primaryColor,
size: 150.0,
color: ColorHolder.color2,
size: 200.0,
),
SizedBox(height: 16),
Text(message),
Text(
message,
style: TextStyle(
color: ColorHolder.color2,
fontSize: 22,
),
),
],
),
),
......
import 'package:dashboard/exceptions/login_exception.dart';
import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/cluster.dart';
import 'package:dashboard/ui/graphs/community/index.dart';
import 'package:dashboard/ui/graphs/community_meta/index.dart';
import 'package:dashboard/ui/sign_in/loginpage.dart';
import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/material.dart';
import 'graphing/communitymetagraph.dart';
void main() {
runApp(MyApp());
runApp(ArticonfDashboardDemo());
}
class MyApp extends StatefulWidget {
class ArticonfDashboardDemo extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
_ArticonfDashboardDemoState createState() => _ArticonfDashboardDemoState();
}
class _MyAppState extends State<MyApp> {
class _ArticonfDashboardDemoState extends State<ArticonfDashboardDemo> {
Future<BackendUser> _checkLoginStuff() async {
try {
return await LoginHelper().loggedInUser;
......@@ -30,7 +27,8 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
ClusterGetter().getClusters();
// ClusterGetter().getClusters();
return MaterialApp(
home: EnhancedFutureBuilder<BackendUser>(
future: _checkLoginStuff(),
......
......@@ -10,17 +10,15 @@ class ClusterGetter {
Future<List<Community>> getNodesfromLayer(String layerName) async {
String url =
"https://articonf1.itec.aau.at:30101/api/use-cases/reddit/tables/reddit/layers/$layerName/nodes";
Logger().i(url);
BackendUser user = await LoginHelper().loggedInUser;
String token = user.token;
Logger().i(token);
Map<String, dynamic> headers = {"Authorization": "Bearer $token"};
List<dynamic> nodesList =
await DataGetter.getJsonList(url, headers: headers);
Logger().i(nodesList.toString());
Map<String, List<Post>> resultMap = {};
List<Community> communityList = [];
......@@ -47,8 +45,6 @@ class ClusterGetter {
entry["subreddit"],
entry["percentage_upvoted"],
entry["n_comments"]));
Logger().i(community.posts.toString());
}
return communityList;
......
......@@ -136,8 +136,6 @@ class DataGetter {
Map<String, dynamic> communities =
await DataGetter.getJson("http://live.nope-api.systems:81/communities");
Logger().i(communities.toString());
List<Community> communityList = [];
for (var entry in communities.entries) {
......
import 'dart:math';
import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/communitymetagraph.dart';
import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/ui/graphs/community/circle/communitygraph.dart';
import 'package:dashboard/ui/graphs/community/cloud/communitycloud.dart';
import 'package:dashboard/ui/graphs/community/list/community_list.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:dashboard/ui/graphs/community_meta/index.dart';
import 'package:flutter/material.dart';
class CommunityGraphViewPage extends StatefulWidget {
......@@ -71,88 +68,6 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
Widget build(BuildContext context) {
return LoadingScreen(message: "Fetching posts...");
// return Scaffold(
// appBar: LoggedInAppBar("Community: ${widget.communityname}"),
// backgroundColor: Colors.white,
// floatingActionButton: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Expanded(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// SizedBox(width: 32),
// FloatingActionButton(
// onPressed: () => redirectToCommunityMetaGraph(context),
// child: Icon(Icons.zoom_out),
// ),
// SizedBox(width: 8),
// FloatingActionButton(
// onPressed: () => _toggleCloudMode(context),
// child: Icon(
// _inCloudMode ? Icons.circle : Icons.cloud,
// ),
// ),
// ],
// ),
// ),
// FloatingActionButton(
// onPressed: _onPrevious,
// child: Icon(Icons.arrow_left),
// ),
// SizedBox(width: 8),
// Container(
// decoration: BoxDecoration(
// color: Theme.of(context).primaryColor,
// borderRadius: BorderRadius.all(Radius.circular(20)),
// ),
// width: 200,
// height: 60,
// alignment: Alignment.center,
// padding: EdgeInsets.symmetric(horizontal: 16),
// child: Text(
// "Post #${_startIndex + 1} - #${_endIndex + 1}",
// style: TextStyle(
// color: Colors.white,
// fontSize: 18,
// ),
// ),
// ),
// SizedBox(width: 8),
// FloatingActionButton(
// onPressed: _onNext,
// child: Icon(Icons.arrow_right),
// )
// ],
// ),
// body: EnhancedFutureBuilder<Community>(
// future: DataGetter.getCommunity(widget.communityname),
// rememberFutureResult: false,
// whenDone: (result) {
// _data = result;
// return _inCloudMode
// ? CommunityList(
// result,
// _startIndex,
// )
// // ? CommunityCloud(
// // result,
// // _startIndex,
// // )
// : CommunityGraph(
// result,
// offset: _startIndex,
// );
// },
// whenNotDone: Container(
// alignment: Alignment.center,
// child: LoadingScreen(
// message: "Fetching Posts...",
// ),
// ),
// ),
// );
}
void redirectToCommunityMetaGraph(BuildContext context) {
......
import 'package:dashboard/data/post.dart';
import 'package:dashboard/graphing/postnode.dart';
import 'package:flutter/material.dart';
class PostView extends StatelessWidget {
......@@ -13,6 +14,16 @@ class PostView extends StatelessWidget {
this.withExplanation = false,
});
void _onPostTap(BuildContext context) {
showDialog(
context: context,
builder: (context) => PostNodeDialog(
post,
Colors.green,
),
);
}
@override
Widget build(BuildContext context) {
return Row(
......@@ -66,45 +77,48 @@ class PostView extends StatelessWidget {
children: [
Align(
alignment: Alignment.center,
child: Container(
width: 400,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
post.effectiveTitle,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
child: GestureDetector(
onTap: () => _onPostTap(context),
child: Container(
width: 400,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
post.effectiveTitle,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
textAlign: TextAlign.center,
),
// author credit
Row(
children: [
if (index > 0)
// author credit
Row(
children: [
if (index > 0)
Text(
"#$index",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
Expanded(
child: SizedBox(),
),
Text(
"#$index",
"by ${post.author}",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
Expanded(
child: SizedBox(),
),
Text(
"by ${post.author}",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
],
),
],
],
),
],
),
),
),
),
......
import 'dart:math';
import 'package:circlegraph/bubble/bubblegraph.dart';
import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/data/communityGraphNodeData.dart';
import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/trustcolorcalculator.dart';
import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/cluster.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/graphing/postnode.dart';
import 'package:dashboard/ui/graphs/community/index.dart';
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import '../data/community.dart';
import '../data/post.dart';
import 'postnode.dart';
import 'trustcolorcalculator.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
class CommunityMetaGraph extends StatefulWidget {
......@@ -30,36 +27,87 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> {
_CommunityMetaGraphState(this.communities);
Widget build(BuildContext context) {
Logger().i(communities.toString());
return SingleChildScrollView(
child: Wrap(
children: [
for (Community community in communities)
getCommunityNodeWidget(community)
],
child: BubbleGraph(
communities
.map(
(Community community) => CircleGraph(
root: TreeNodeData(
onNodeClick: (node, data) => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CommunityGraphViewPage(data.name),
),
),
data: community,
backgroundColor: ColorHolder.color1,
child: Container(
constraints: BoxConstraints.expand(),
child: Stack(
children: [
Align(
alignment: Alignment.topRight,
child: Container(
width: 70,
height: 70,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
child: Text(
community.formattedTrustScore,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.green[800],
fontSize: 14,
),
),
),
),
Align(
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.only(top: 32.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.group_work,
color: ColorHolder.color2,
),
Text(
"${community.name}",
style: TextStyle(
color: ColorHolder.color2,
),
),
],
),
),
),
],
),
),
height: 160,
width: 160,
),
circlify: true,
backgroundColor: ColorHolder.color1,
),
)
.toList(),
),
);
}
TreeNodeData<CommunityGraphNodeData> _getCommunityNode(Community community) {
CommunityGraphNodeData data =
CommunityGraphNodeData.fromCommunity(community);
return TreeNodeData(
child: getCommunityNodeWidget(community),
data: data,
width: 500,
);
}
TreeNodeData<CommunityGraphNodeData> _getPostNode(Post post) {
CommunityGraphNodeData data = CommunityGraphNodeData.fromPost(post);
return TreeNodeData<CommunityGraphNodeData>(
child: PostNode(post),
data: data,
width: 500,
);
// return SingleChildScrollView(
// child: Wrap(
// children: [
// for (Community community in communities)
// getCommunityNodeWidget(community)
// ],
// ),
// );
}
Widget getCommunityNodeWidget(Community community) {
......@@ -107,29 +155,23 @@ class CommunityMetaGraphViewPage extends StatelessWidget {
Widget build(BuildContext context) {
ClusterGetter().getNodesfromLayer("Upvotes_Layer");
return Scaffold(
appBar: LoggedInAppBar("Communities"),
backgroundColor: ColorHolder.color3,
//floatingActionButton: FloatingActionButton(
// onPressed: () => print("hoe"),
// child: Icon(Icons.zoom_in),
//),
body: Container(
padding: EdgeInsets.all(12),
constraints: BoxConstraints.expand(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
EnhancedFutureBuilder(
future: DataGetter.getCommunities(),
rememberFutureResult: false,
whenDone: (communities) => CommunityMetaGraph(communities),
whenNotDone: Container(
alignment: Alignment.center,
child: Text("Loading..."),
),
),
],
appBar: LoggedInAppBar("Communities"),
backgroundColor: ColorHolder.color3,
body: Container(
padding: EdgeInsets.all(12),
constraints: BoxConstraints.expand(),
child: EnhancedFutureBuilder(
future: DataGetter.getCommunities(),
rememberFutureResult: false,
whenDone: (communities) => CommunityMetaGraph(communities),
whenNotDone: Container(
alignment: Alignment.center,
child: LoadingScreen(
message: "Fetching Data...",
),
),
));
),
),
);
}
}
......@@ -100,7 +100,7 @@ class _LoginPageState extends State<LoginPage> {
// restart app (should login automatically)
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => MyApp(),
builder: (context) => ArticonfDashboardDemo(),
),
);
}
......
......@@ -15,7 +15,7 @@ class LoggedInAppBar extends PreferredSize {
await LoginHelper().logout();
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => MyApp(),
builder: (context) => ArticonfDashboardDemo(),
),
);
}
......
......@@ -13,7 +13,7 @@ import 'package:dashboard/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(ArticonfDashboardDemo());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
......
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