Commit 38c14416 authored by Manuel's avatar Manuel

polished community page

parent 42576ac8
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
"languageVersion": "2.7" "languageVersion": "2.7"
} }
], ],
"generated": "2021-03-11T11:31:05.991685Z", "generated": "2021-03-11T14:18:45.095478Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.12.0" "generatorVersion": "2.12.0"
} }
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
integration_test=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\packages\\integration_test\\ integration_test=C:\\_libs\\flutter\\packages\\integration_test\\
path_provider=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-1.6.27\\ path_provider=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-1.6.27\\
path_provider_linux=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\\ path_provider_linux=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-0.0.1+2\\
path_provider_macos=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\\ path_provider_macos=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-0.0.4+8\\
path_provider_windows=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-0.0.5\\ path_provider_windows=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-0.0.5\\
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\_libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\_libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\_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-11 12:34:54.486234","version":"2.0.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\_libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\_libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\_libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\_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-11 15:18:45.264480","version":"2.0.1"}
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# For more info see: https://dart.dev/go/dot-packages-deprecation # For more info see: https://dart.dev/go/dot-packages-deprecation
# #
# Generated by pub on 2021-03-11 12:31:05.973685. # Generated by pub on 2021-03-11 15:18:45.075478.
apex_flutter_sdk:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/apex_flutter_sdk-1.1.1+1/lib/ apex_flutter_sdk:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/apex_flutter_sdk-1.1.1+1/lib/
archive:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/ archive:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/ args:file:///C:/_libs/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
......
sdk.dir=C:\\Users\\Luca\\AppData\\Local\\Android\\sdk sdk.dir=C:\\Users\\Manuel\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter flutter.sdk=C:\\_libs\\flutter
\ No newline at end of file \ No newline at end of file
import 'package:dashboard/graphing/usergraph.dart'; import 'package:dashboard/graphing/usergraph.dart';
import 'package:dashboard/ui/graphs/community/index.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart'; import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../data/post.dart'; import '../data/post.dart';
......
...@@ -2,6 +2,7 @@ import 'dart:math'; ...@@ -2,6 +2,7 @@ import 'dart:math';
import 'package:circlegraph/circlegraph.dart'; import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/ui/graphs/community/node_community.dart'; import 'package:dashboard/ui/graphs/community/node_community.dart';
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -41,18 +42,18 @@ class _CommunityGraphState extends State<CommunityGraph> { ...@@ -41,18 +42,18 @@ class _CommunityGraphState extends State<CommunityGraph> {
return Container( return Container(
constraints: BoxConstraints.expand(), constraints: BoxConstraints.expand(),
color: ColorHolder.color3,
child: SingleChildScrollView( child: SingleChildScrollView(
child: CircleGraph( child: CircleGraph(
radius: 380, backgroundColor: ColorHolder.color3,
backgroundColor: Color.fromRGBO(55, 57, 46, 1),
root: _getCommunityNode(community), root: _getCommunityNode(community),
children: [for (var node in nodes) _getPostNode(node)], children: [for (var node in nodes) _getPostNode(node)],
edgeColor: Color.fromRGBO(212, 228, 188, 1), edgeColor: Color.fromRGBO(212, 228, 188, 1),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
circleLayout: [ circleLayout: [
Circle(30, 4), Circle(10, 4),
Circle(180, 8), Circle(100, 8),
Circle(380, -1), Circle(220, -1),
], ],
), ),
), ),
...@@ -67,12 +68,12 @@ class _CommunityGraphState extends State<CommunityGraph> { ...@@ -67,12 +68,12 @@ class _CommunityGraphState extends State<CommunityGraph> {
child: TrustScoreNode( child: TrustScoreNode(
community.name, community.name,
community.trust, community.trust,
textColor: Color.fromRGBO(212, 228, 188, 1), textColor: ColorHolder.color2,
icon: Icons.group_work, icon: Icons.group_work,
), ),
data: data, data: data,
width: 150, width: 150,
backgroundColor: Color.fromRGBO(34, 42, 104, 1), backgroundColor: ColorHolder.color1,
); );
} }
...@@ -85,12 +86,12 @@ class _CommunityGraphState extends State<CommunityGraph> { ...@@ -85,12 +86,12 @@ class _CommunityGraphState extends State<CommunityGraph> {
child: TrustScoreNode( child: TrustScoreNode(
post.effectiveTitle, post.effectiveTitle,
post.trust, post.trust,
textColor: Color.fromRGBO(212, 228, 188, 1), textColor: ColorHolder.color2,
icon: Icons.sticky_note_2, icon: Icons.sticky_note_2,
), ),
data: data, data: data,
width: 200, width: 200,
backgroundColor: Color.fromRGBO(34, 42, 104, 1), backgroundColor: ColorHolder.color1,
); );
} }
} }
import 'dart:math';
import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/communitymetagraph.dart'; import 'package:dashboard/graphing/communitymetagraph.dart';
import 'package:dashboard/loading.dart'; import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/datagetter.dart';
...@@ -18,12 +21,34 @@ class CommunityGraphViewPage extends StatefulWidget { ...@@ -18,12 +21,34 @@ class CommunityGraphViewPage extends StatefulWidget {
class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> { class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
int _startIndex = 0; int _startIndex = 0;
int _endIndex = 0; int _endIndex = 0;
Community _data;
void initState() { void initState() {
super.initState(); super.initState();
_endIndex = CommunityGraph.postsPerPage; _endIndex = CommunityGraph.postsPerPage;
} }
void _onNext() {
if (_data != null)
setState(() {
_endIndex = min(
_endIndex + CommunityGraph.postsPerPage,
_data.posts.length - 1,
);
_startIndex = max(
0,
_endIndex - CommunityGraph.postsPerPage,
);
});
}
void _onPrevious() {
setState(() {
_startIndex = max(0, _startIndex - CommunityGraph.postsPerPage);
_endIndex = _startIndex + CommunityGraph.postsPerPage;
});
}
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: LoggedInAppBar("Community: ${widget.communityname}"), appBar: LoggedInAppBar("Community: ${widget.communityname}"),
...@@ -31,8 +56,20 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> { ...@@ -31,8 +56,20 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
floatingActionButton: Row( floatingActionButton: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 32),
FloatingActionButton( FloatingActionButton(
onPressed: () {}, onPressed: () => redirectToCommunityMetaGraph(context),
child: Icon(Icons.zoom_out),
),
],
),
),
FloatingActionButton(
onPressed: _onPrevious,
child: Icon(Icons.arrow_left), child: Icon(Icons.arrow_left),
), ),
SizedBox(width: 8), SizedBox(width: 8),
...@@ -41,11 +78,12 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> { ...@@ -41,11 +78,12 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
), ),
width: 200,
height: 60, height: 60,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
child: Text( child: Text(
"Post #$_startIndex - #$_endIndex", "Post #${_startIndex + 1} - #${_endIndex + 1}",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18, fontSize: 18,
...@@ -54,19 +92,21 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> { ...@@ -54,19 +92,21 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
), ),
SizedBox(width: 8), SizedBox(width: 8),
FloatingActionButton( FloatingActionButton(
onPressed: () {}, onPressed: _onNext,
child: Icon(Icons.arrow_right), child: Icon(Icons.arrow_right),
) )
], ],
), ),
// FloatingActionButton( body: EnhancedFutureBuilder<Community>(
// onPressed: () => redirectToCommunityMetaGraph(context),
// child: Icon(Icons.zoom_out),
// ),
body: EnhancedFutureBuilder(
future: DataGetter.getCommunity(widget.communityname), future: DataGetter.getCommunity(widget.communityname),
rememberFutureResult: false, rememberFutureResult: false,
whenDone: (result) => CommunityGraph(result), whenDone: (result) {
_data = result;
return CommunityGraph(
result,
offset: _startIndex,
);
},
whenNotDone: Container( whenNotDone: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: LoadingScreen( child: LoadingScreen(
......
import 'package:flutter/material.dart';
class ColorHolder {
///
/// royal blue dark
///
static Color get color1 => Color.fromRGBO(34, 42, 104, 1);
///
/// tea green
///
static Color get color2 => Color.fromRGBO(212, 228, 188, 1);
///
/// black olive
///
static Color get color3 => Color.fromRGBO(55, 57, 46, 1);
///
/// royal blue dark
///
static Color get color4 => Color.fromRGBO(34, 42, 104, 1);
///
/// royal blue dark
///
static Color get color5 => Color.fromRGBO(34, 42, 104, 1);
}
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