Commit 0b45a305 authored by Luca Braun's avatar Luca Braun

Refactored Dashboard

parent 7a4e0313
2021/03/09-14:07:30.955 3bdc Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.1fcc5587\flutter_tools_chrome_device.ef533692\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/09-14:07:30.956 3bdc Recovering log #3
2021/03/09-14:07:30.956 3bdc Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.1fcc5587\flutter_tools_chrome_device.ef533692\Default\AutofillStrikeDatabase/000003.log
2021/03/09-16:02:38.898 33fc Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.ee53618f\flutter_tools_chrome_device.ec8c1ca2\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/09-16:02:38.898 33fc Recovering log #3
2021/03/09-16:02:38.899 33fc Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.ee53618f\flutter_tools_chrome_device.ec8c1ca2\Default\AutofillStrikeDatabase/000003.log
2021/03/09-12:18:45.146 3080 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.782406af\flutter_tools_chrome_device.a8330de4\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/09-15:17:15.703 1204 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.c522d41b\flutter_tools_chrome_device.8027b81f\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/09-15:17:15.705 1204 Recovering log #3
2021/03/09-15:17:15.705 1204 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.c522d41b\flutter_tools_chrome_device.8027b81f\Default\AutofillStrikeDatabase/000003.log
2021/03/09-14:07:30.954 3bdc Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.1fcc5587\flutter_tools_chrome_device.ef533692\Default\BudgetDatabase/MANIFEST-000001
2021/03/09-14:07:30.954 3bdc Recovering log #3
2021/03/09-14:07:30.954 3bdc Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.1fcc5587\flutter_tools_chrome_device.ef533692\Default\BudgetDatabase/000003.log
2021/03/09-16:02:38.881 33fc Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.ee53618f\flutter_tools_chrome_device.ec8c1ca2\Default\BudgetDatabase/MANIFEST-000001
2021/03/09-16:02:38.881 33fc Recovering log #3
2021/03/09-16:02:38.881 33fc Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.ee53618f\flutter_tools_chrome_device.ec8c1ca2\Default\BudgetDatabase/000003.log
2021/03/09-12:18:45.173 2288 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.782406af\flutter_tools_chrome_device.a8330de4\Default\BudgetDatabase/MANIFEST-000001
2021/03/09-15:17:15.571 1204 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.c522d41b\flutter_tools_chrome_device.8027b81f\Default\BudgetDatabase/MANIFEST-000001
2021/03/09-15:17:15.571 1204 Recovering log #3
2021/03/09-15:17:15.571 1204 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.c522d41b\flutter_tools_chrome_device.8027b81f\Default\BudgetDatabase/000003.log
......@@ -19,15 +19,15 @@ define("main_module.bootstrap", ["web_entrypoint.dart", "dart_sdk"], function(ap
main();
});
}
window.$dartAppId = "tBn/Y71DDV3j4znroLVwFA==";
window.$dartAppId = "J+TMOIhiHOcFXyNx4XwAbQ==";
window.$dartReloadConfiguration = "ReloadConfiguration.none";
window.$dartModuleStrategy = "require-js";
window.$loadModuleConfig = require;
window.$dwdsVersion = "7.1.1";
window.$dwdsDevHandlerPath = "http://localhost:53611/$dwdsSseHandler";
window.$dwdsDevHandlerPath = "http://localhost:58521/$dwdsSseHandler";
window.$dartEntrypointPath = "main_module.bootstrap.js";
window.$requireLoader.forceLoadModule("dwds/src/injected/client");
window.$dartExtensionUri = "http://127.0.0.1:53613/$debug";
window.$dartExtensionUri = "ws://127.0.0.1:58523/$debug";
} else {
if(window.$dartMainExecuted){
......@@ -499,11 +499,12 @@ let modulePaths = {
"packages/http/src/multipart_file_stub.dart": "packages/http/src/multipart_file_stub.dart.lib",
"packages/http/src/boundary_characters.dart": "packages/http/src/boundary_characters.dart.lib",
"packages/dashboard/communityGraphNodeData.dart": "packages/dashboard/communityGraphNodeData.dart.lib",
"packages/circlegraph/tree_painter.dart": "packages/circlegraph/tree_painter.dart.lib",
"packages/circlegraph/circle/tree_painter.dart": "packages/circlegraph/circle/tree_painter.dart.lib",
"packages/vector_math/vector_math.dart": "packages/vector_math/vector_math.dart.lib",
"packages/circlegraph/tree_edge.dart": "packages/circlegraph/tree_edge.dart.lib",
"packages/circlegraph/point.dart": "packages/circlegraph/point.dart.lib",
"packages/circlegraph/graph_tooltip.dart": "packages/circlegraph/graph_tooltip.dart.lib",
"packages/circlegraph/circle/tree_edge.dart": "packages/circlegraph/circle/tree_edge.dart.lib",
"packages/circlegraph/tuple.dart": "packages/circlegraph/tuple.dart.lib",
"packages/circlegraph/circle/graph_tooltip.dart": "packages/circlegraph/circle/graph_tooltip.dart.lib",
"packages/circlegraph/data_stack.dart": "packages/circlegraph/data_stack.dart.lib",
"packages/dashboard/usernode.dart": "packages/dashboard/usernode.dart.lib",
"packages/apex_flutter_sdk/apex_flutter_sdk.dart": "packages/apex_flutter_sdk/apex_flutter_sdk.dart.lib",
"packages/apex_flutter_sdk/components/lists/chiplist.dart": "packages/apex_flutter_sdk/components/lists/chiplist.dart.lib",
......@@ -944,11 +945,12 @@ let moduleNames = {
"packages/http/src/multipart_file_stub.dart.lib": "packages/http/src/multipart_file_stub.dart",
"packages/http/src/boundary_characters.dart.lib": "packages/http/src/boundary_characters.dart",
"packages/dashboard/communityGraphNodeData.dart.lib": "packages/dashboard/communityGraphNodeData.dart",
"packages/circlegraph/tree_painter.dart.lib": "packages/circlegraph/tree_painter.dart",
"packages/circlegraph/circle/tree_painter.dart.lib": "packages/circlegraph/circle/tree_painter.dart",
"packages/vector_math/vector_math.dart.lib": "packages/vector_math/vector_math.dart",
"packages/circlegraph/tree_edge.dart.lib": "packages/circlegraph/tree_edge.dart",
"packages/circlegraph/point.dart.lib": "packages/circlegraph/point.dart",
"packages/circlegraph/graph_tooltip.dart.lib": "packages/circlegraph/graph_tooltip.dart",
"packages/circlegraph/circle/tree_edge.dart.lib": "packages/circlegraph/circle/tree_edge.dart",
"packages/circlegraph/tuple.dart.lib": "packages/circlegraph/tuple.dart",
"packages/circlegraph/circle/graph_tooltip.dart.lib": "packages/circlegraph/circle/graph_tooltip.dart",
"packages/circlegraph/data_stack.dart.lib": "packages/circlegraph/data_stack.dart",
"packages/dashboard/usernode.dart.lib": "packages/dashboard/usernode.dart",
"packages/apex_flutter_sdk/apex_flutter_sdk.dart.lib": "packages/apex_flutter_sdk/apex_flutter_sdk.dart",
"packages/apex_flutter_sdk/components/lists/chiplist.dart.lib": "packages/apex_flutter_sdk/components/lists/chiplist.dart",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14894,7 +14894,7 @@ define(['dart_sdk', 'packages/flutter/src/painting/basic_types.dart', 'packages/
isStructuredErrorsEnabled() {
let enabled = false;
if (!dart.test(dart.fn(() => {
enabled = false;
enabled = true;
return true;
}, T$.VoidTobool())())) dart.assertFailed(null, I[2], 963, 12, "() {\r\n // TODO(kenz): add support for structured errors on the web.\r\n enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb);\r\n return true;\r\n }()");
return enabled;
......@@ -45,7 +45,7 @@
},
{
"name": "circlegraph",
"rootUri": "file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.2",
"rootUri": "file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.5",
"packageUri": "lib/",
"languageVersion": "2.7"
},
......@@ -272,7 +272,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-03-09T11:18:11.221906Z",
"generated": "2021-03-09T14:12:32.242847Z",
"generator": "pub",
"generatorVersion": "2.12.0-259.9.beta"
}
......@@ -32,8 +32,8 @@ file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.p
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/
circlegraph
2.7
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.2/
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.2/lib/
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.5/
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.5/lib/
clock
2.12
file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/
......
{"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":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-03-09 14:06:47.955506","version":"1.26.0-17.5.pre"}
\ 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:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-03-09 16:03:59.874345","version":"1.26.0-17.5.pre"}
\ 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-09 12:18:11.189928.
# Generated by pub on 2021-03-09 15:12:32.200872.
apex_flutter_sdk:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/apex_flutter_sdk-1.1.1+1/lib/
archive:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
......@@ -11,7 +11,7 @@ async:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flut
boolean_selector:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
characters:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib/
charcode:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/
circlegraph:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.2/lib/
circlegraph:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/circlegraph-0.0.5/lib/
clock:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
convert:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
......
import 'package:flutter/cupertino.dart';
import 'community.dart';
import 'post.dart';
......
import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/datagetter.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'community.dart';
import 'communityGraphNodeData.dart';
import 'datagetter.dart';
import 'post.dart';
import '../data/community.dart';
import '../data/communityGraphNodeData.dart';
import '../querying/datagetter.dart';
import '../data/post.dart';
import 'postnode.dart';
import 'shared.dart';
import 'postnode.dart';
import 'communitymetagraph.dart';
......@@ -24,7 +23,7 @@ class _CommunityGraphState extends State<CommunityGraph> {
_CommunityGraphState(this.community);
final Community community;
int nrPerPage = 15;
int nrPerPage = 10;
int pageNr = 0;
build(BuildContext context) {
......@@ -47,7 +46,7 @@ class _CommunityGraphState extends State<CommunityGraph> {
boundaryMargin: EdgeInsets.all(100),
minScale: 0.01,
maxScale: 5.6,
child: CircleTree(
child: CircleGraph(
root: _getCommunityNode(community),
children: [for (var node in nodes) _getPostNode(node)],
),
......@@ -62,47 +61,38 @@ class _CommunityGraphState extends State<CommunityGraph> {
return TreeNodeData<CommunityGraphNodeData>(
child: getCommunityNodeWidget(community.name, community.trust),
data: data,
width: 150,
);
}
TreeNodeData<CommunityGraphNodeData> _getPostNode(Post post) {
CommunityGraphNodeData data = CommunityGraphNodeData.fromPost(post);
PostNode postNode = PostNode(post);
return TreeNodeData<CommunityGraphNodeData>(
child: PostNode(post),
child: postNode,
data: data,
width: 250,
);
}
Widget getCommunityNodeWidget(String name, double trustvalue) {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.orange[400] ?? Colors.orange, spreadRadius: 1),
],
),
width: 1000,
child: Row(
return Row(
children: [
Expanded(
child: Text(
name,
overflow: TextOverflow.ellipsis,
style:
TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
),
),
Text(
(trustvalue * 100).toString() + "%",
style:
TextStyle(fontWeight: FontWeight.bold, color: Colors.green),
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.green),
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
));
);
}
}
......
import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/communityGraphNodeData.dart';
import 'package:dashboard/datagetter.dart';
import 'package:dashboard/postnode.dart';
import 'package:dashboard/shared.dart';
import 'package:dashboard/data/communityGraphNodeData.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/graphing/postnode.dart';
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import 'community.dart';
import 'post.dart';
import '../data/community.dart';
import '../data/post.dart';
import 'postnode.dart';
import 'shared.dart';
import 'trustcolorcalculator.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
......@@ -36,10 +34,10 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> {
boundaryMargin: EdgeInsets.all(100),
minScale: 0.01,
maxScale: 5.6,
child: Wrap(
children: [
child: BubbleGraph(
[
for (Community community in communities)
CircleTree(
CircleGraph(
root: _getCommunityNode(community),
children: [
for (Post post in community.posts) _getPostNode(post)
......@@ -55,7 +53,11 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> {
CommunityGraphNodeData data =
CommunityGraphNodeData.fromCommunity(community);
return TreeNodeData(child: getCommunityNodeWidget(community), data: data);
return TreeNodeData(
child: getCommunityNodeWidget(community),
data: data,
width: 500,
);
}
TreeNodeData<CommunityGraphNodeData> _getPostNode(Post post) {
......@@ -64,42 +66,30 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> {
return TreeNodeData<CommunityGraphNodeData>(
child: PostNode(post),
data: data,
width: 500,
);
}
Widget getCommunityNodeWidget(Community community) {
return GestureDetector(
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.orange[400] ?? Colors.orange,
spreadRadius: 1),
],
),
width: 200,
child: Row(
children: [
Expanded(
child: Text(
community.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
),
),
Text(
(community.trust * 100).toString() + "%",
style: TextStyle(
fontWeight: FontWeight.bold,
color: TrustColorCalculator.calculateTrustColor(
community.trust)),
color: TrustColorCalculator.calculateTrustColor(community.trust)),
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
)));
));
}
}
......
......@@ -17,34 +17,23 @@ class PostNode extends StatelessWidget {
trustColor = TrustColorCalculator.calculateTrustColor(post.trust);
return GestureDetector(
onTap: () => redirectToPost(context),
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.grey[300] ?? Colors.grey, spreadRadius: 1),
],
),
width: 1000,
child: Row(
children: [
Expanded(
child: Text(
post.title != "" ? post.title : post.content,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
style:
TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
),
),
Text(
(post.trust * 100).toString() + "%",
style:
TextStyle(fontWeight: FontWeight.bold, color: trustColor),
style: TextStyle(fontWeight: FontWeight.bold, color: trustColor),
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
)),
),
);
}
......
......@@ -4,11 +4,11 @@ import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'post.dart';
import 'userGraphNodeData.dart';
import '../data/post.dart';
import '../data/userGraphNodeData.dart';
import 'usernode.dart';
import 'postnode.dart';
import 'user.dart';
import '../data/user.dart';
class UserGraph extends StatefulWidget {
UserGraph(this.user);
......@@ -41,7 +41,7 @@ class _UserGraphState extends State<UserGraph> {
boundaryMargin: EdgeInsets.all(100),
minScale: 0.01,
maxScale: 5.6,
child: CircleTree(
child: CircleGraph(
root: _getUserNode(user),
children: [for (Post post in nodes) _getPostNode(post)],
)),
......@@ -51,7 +51,10 @@ class _UserGraphState extends State<UserGraph> {
TreeNodeData<UserGraphNodeData> _getUserNode(User user) {
UserGraphNodeData data = UserGraphNodeData.fromUser(user);
return TreeNodeData(child: UserNode(user.trustScores), data: data);
return TreeNodeData(
child: UserNode(user.trustScores),
data: data,
backgroundColor: Colors.transparent);
}
TreeNodeData<UserGraphNodeData> _getPostNode(Post post) {
......@@ -73,9 +76,6 @@ class UserGraphViewPage extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Wrap(
children: [],
),
EnhancedFutureBuilder<User>(
future: DataGetter.getUser(username),
// future: DataGetter.getJson(
......
import 'package:flutter/material.dart';
import 'package:circlegraph/circlegraph.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int numberOfChildren = 5;
void onAdd() {
setState(() {
numberOfChildren += 1;
});
}
///
/// generate a simple node that holds an integer with a text inside that
/// contains its index
///
TreeNodeData _nodeWithIndex(int i) {
return TreeNodeData<int>(
child: Text(
"child $i",
style: TextStyle(color: color3),
),
data: i,
onNodeClick: _onNodeClick,
color: color2);
}
///
/// Build the tooltip based on the node that is currently hovered
///
Widget buildTooltip(TreeNodeData node, int data) {
return Container(
padding: EdgeInsets.all(10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10),
),
color: color4,
),
child: Text(
"Hovering over node $data",
),
);
}
///
/// callback when a node is clicked
///
void _onNodeClick(TreeNodeData node, int data) {
print("clicked on node $data");
}
Color get color1 => Color.fromRGBO(154, 212, 214, 1); // powder blue
Color get color2 => Color.fromRGBO(139, 30, 63, 1); // claret (red-ish)
Color get color3 =>
Color.fromRGBO(240, 201, 135, 1); // gold crayola (yellow-ish)
Color get color4 => Color.fromRGBO(71, 170, 174, 1); // verdigris
Color get color5 => Color.fromRGBO(16, 37, 66, 1); // oxford blue
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: onAdd,
),
body: Center(
child: Container(
padding: EdgeInsets.all(160),
decoration: BoxDecoration(
color: color1,
shape: BoxShape.circle,
),
child: CircleTree(
root: _nodeWithIndex(0),
children: [
for (int i = 0; i < numberOfChildren; i++) _nodeWithIndex(i + 1),
],
tooltipBuilder: buildTooltip,
),
),
),
);
}
}
......@@ -4,9 +4,9 @@ import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:logger/logger.dart';
import 'community.dart';
import 'post.dart';
import 'user.dart';
import 'data/community.dart';
import 'data/post.dart';
import 'data/user.dart';
class DataGetter {
static Future<Map<String, dynamic>> getJson(String url,
......
export 'package:graphview/GraphView.dart';
import 'package:dashboard/communitymetagraph.dart';
import 'package:dashboard/credentials.dart';
import 'package:dashboard/datagetter.dart';
import 'package:dashboard/graphing/communitymetagraph.dart';
import 'package:dashboard/sign_in/credentials.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/sign_in/login_form.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
......
......@@ -56,7 +56,7 @@ packages:
name: circlegraph
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
version: "0.0.5"
clock:
dependency: transitive
description:
......
......@@ -16,7 +16,7 @@ dependencies:
apex_flutter_sdk: ^1.1.1+1
enhanced_future_builder: ^1.0.3
http: ^0.12.2
circlegraph: ^0.0.2
circlegraph: ^0.0.5
cupertino_icons: ^1.0.1
logger: ^0.9.4
......
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