Commit 38c14416 authored by Manuel's avatar Manuel

polished community page

parent 42576ac8
......@@ -338,7 +338,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-03-11T11:31:05.991685Z",
"generated": "2021-03-11T14:18:45.095478Z",
"generator": "pub",
"generatorVersion": "2.12.0"
}
# 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\\
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_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_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_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\\
integration_test=C:\\_libs\\flutter\\packages\\integration_test\\
path_provider=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-1.6.27\\
path_provider_linux=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-0.0.1+2\\
path_provider_macos=C:\\_libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-0.0.4+8\\
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"}
\ 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":"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
......@@ -3,7 +3,7 @@
#
# 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/
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/
......
sdk.dir=C:\\Users\\Luca\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter
\ No newline at end of file
sdk.dir=C:\\Users\\Manuel\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\_libs\\flutter
\ No newline at end of file
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:flutter/material.dart';
import '../data/post.dart';
......
......@@ -2,6 +2,7 @@ import 'dart:math';
import 'package:circlegraph/circlegraph.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/material.dart';
import 'package:flutter/rendering.dart';
......@@ -41,18 +42,18 @@ class _CommunityGraphState extends State<CommunityGraph> {
return Container(
constraints: BoxConstraints.expand(),
color: ColorHolder.color3,
child: SingleChildScrollView(
child: CircleGraph(
radius: 380,
backgroundColor: Color.fromRGBO(55, 57, 46, 1),
backgroundColor: ColorHolder.color3,
root: _getCommunityNode(community),
children: [for (var node in nodes) _getPostNode(node)],
edgeColor: Color.fromRGBO(212, 228, 188, 1),
padding: EdgeInsets.zero,
circleLayout: [
Circle(30, 4),
Circle(180, 8),
Circle(380, -1),
Circle(10, 4),
Circle(100, 8),
Circle(220, -1),
],
),
),
......@@ -67,12 +68,12 @@ class _CommunityGraphState extends State<CommunityGraph> {
child: TrustScoreNode(
community.name,
community.trust,
textColor: Color.fromRGBO(212, 228, 188, 1),
textColor: ColorHolder.color2,
icon: Icons.group_work,
),
data: data,
width: 150,
backgroundColor: Color.fromRGBO(34, 42, 104, 1),
backgroundColor: ColorHolder.color1,
);
}
......@@ -85,12 +86,12 @@ class _CommunityGraphState extends State<CommunityGraph> {
child: TrustScoreNode(
post.effectiveTitle,
post.trust,
textColor: Color.fromRGBO(212, 228, 188, 1),
textColor: ColorHolder.color2,
icon: Icons.sticky_note_2,
),
data: data,
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/loading.dart';
import 'package:dashboard/querying/datagetter.dart';
......@@ -18,12 +21,34 @@ class CommunityGraphViewPage extends StatefulWidget {
class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
int _startIndex = 0;
int _endIndex = 0;
Community _data;
void initState() {
super.initState();
_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) {
return Scaffold(
appBar: LoggedInAppBar("Community: ${widget.communityname}"),
......@@ -31,8 +56,20 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
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),
),
],
),
),
FloatingActionButton(
onPressed: () {},
onPressed: _onPrevious,
child: Icon(Icons.arrow_left),
),
SizedBox(width: 8),
......@@ -41,11 +78,12 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
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 - #$_endIndex",
"Post #${_startIndex + 1} - #${_endIndex + 1}",
style: TextStyle(
color: Colors.white,
fontSize: 18,
......@@ -54,19 +92,21 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
),
SizedBox(width: 8),
FloatingActionButton(
onPressed: () {},
onPressed: _onNext,
child: Icon(Icons.arrow_right),
)
],
),
// FloatingActionButton(
// onPressed: () => redirectToCommunityMetaGraph(context),
// child: Icon(Icons.zoom_out),
// ),
body: EnhancedFutureBuilder(
body: EnhancedFutureBuilder<Community>(
future: DataGetter.getCommunity(widget.communityname),
rememberFutureResult: false,
whenDone: (result) => CommunityGraph(result),
whenDone: (result) {
_data = result;
return CommunityGraph(
result,
offset: _startIndex,
);
},
whenNotDone: Container(
alignment: Alignment.center,
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