Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
05c7962e
Commit
05c7962e
authored
Mar 15, 2021
by
Luca Braun
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature/dashboard' into feature/dashboard
parents
3a20813c
d067c9b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
112 deletions
+79
-112
post.dart
src/dashboard/lib/data/post.dart
+6
-0
postnode.dart
src/dashboard/lib/graphing/postnode.dart
+73
-110
main.dart
src/dashboard/lib/main.dart
+0
-2
No files found.
src/dashboard/lib/data/post.dart
View file @
05c7962e
...
...
@@ -12,4 +12,10 @@ class Post {
if
(
title
!=
null
&&
title
.
isNotEmpty
)
return
title
;
return
content
;
}
String
get
effectiveContent
{
if
(
content
!=
null
&&
content
.
isNotEmpty
)
return
content
;
return
title
;
}
}
src/dashboard/lib/graphing/postnode.dart
View file @
05c7962e
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'
;
import
'trustcolorcalculator.dart'
;
class
PostNode
extends
StatelessWidget
{
final
Post
post
;
PostNode
(
this
.
post
)
;
final
Color
trustColor
;
Color
trustColor
=
Colors
.
transparent
;
PostNode
(
this
.
post
)
:
trustColor
=
TrustColorCalculator
.
calculateTrustColor
(
post
.
trust
);
Widget
build
(
BuildContext
context
)
{
trustColor
=
TrustColorCalculator
.
calculateTrustColor
(
post
.
trust
);
return
GestureDetector
(
onTap:
()
=>
redirectToPost
(
context
),
child:
Row
(
...
...
@@ -37,145 +36,106 @@ class PostNode extends StatelessWidget {
void
redirectToPost
(
BuildContext
context
)
{
showDialog
(
context:
context
,
builder:
(
_
)
=>
new
PostNodeDialog
(
post
,
trustColor
));
//Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => PostNodeTooltip(post, this.trustColor),
// ));
context:
context
,
builder:
(
_
)
=>
new
PostNodeDialog
(
post
,
trustColor
),
);
}
}
class
PostNodeDialog
extends
StatelessWidget
{
PostNodeDialog
(
this
.
post
,
this
.
trustColor
);
PostNodeDialog
(
this
.
post
,
this
.
trustColor
,
{
this
.
width
=
350
,
this
.
height
=
400
});
final
Post
post
;
final
Color
trustColor
;
final
double
titleSize
=
22
;
final
double
width
;
final
double
height
;
Widget
build
(
BuildContext
context
)
{
return
AlertDialog
(
titlePadding:
EdgeInsets
.
all
(
0
),
actions:
[
TextButton
.
icon
(
onPressed:
()
=>
redirectToCommunityGraph
(
context
),
icon:
Icon
(
Icons
.
group_work
),
label:
Text
(
post
.
community
),
),
SizedBox
(
width:
16
),
TextButton
.
icon
(
onPressed:
()
=>
redirectToUserGraph
(
context
),
icon:
Icon
(
Icons
.
supervised_user_circle_rounded
),
label:
Text
(
post
.
author
),
),
],
title:
Container
(
width:
width
,
decoration:
BoxDecoration
(
color:
Colors
.
blue
,
boxShadow:
[
BoxShadow
(
blurRadius:
0.2
,
spreadRadius:
0.2
)]),
color:
Colors
.
blue
,
boxShadow:
[
BoxShadow
(
blurRadius:
0.2
,
spreadRadius:
0.2
)],
),
padding:
EdgeInsets
.
all
(
5
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
children:
[
Container
(
child:
Text
(
post
.
title
!=
""
?
post
.
title
:
"Comment"
,
overflow:
TextOverflow
.
fade
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
fontSize:
titleSize
,
),
),
//constraints: BoxConstraints.expand(),
Expanded
(
child:
Text
(
post
.
title
!=
""
?
post
.
title
:
"Comment"
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
fontSize:
titleSize
,
),
]
,
)
,
),
Container
(
margin:
EdgeInsets
.
fromLTRB
(
10
,
0
,
5
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
0
,
25
,
0
),
child:
TextButton
(
onPressed:
()
=>
redirectToUserGraph
(
context
),
child:
Text
(
post
.
author
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
titleSize
,
),
),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
25
,
0
,
25
,
0
),
child:
TextButton
(
onPressed:
()
=>
redirectToCommunityGraph
(
context
),
child:
Text
(
post
.
community
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
titleSize
,
),
),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
25
,
0
,
25
,
0
),
child:
Text
(
(
post
.
trust
*
100
).
roundToDouble
().
toString
()
+
"%"
,
style:
TextStyle
(
color:
trustColor
,
fontSize:
titleSize
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
25
,
0
,
0
,
0
),
child:
Material
(
color:
Colors
.
blue
,
child:
IconButton
(
onPressed:
()
=>
Navigator
.
pop
(
context
),
icon:
Icon
(
Icons
.
close
,
color:
Colors
.
white
,
),
),
),
),
],
IconButton
(
onPressed:
()
=>
Navigator
.
pop
(
context
),
icon:
Icon
(
Icons
.
close
,
color:
Colors
.
white
,
),
)
)
,
],
),
),
content:
Column
(
children:
[
Column
(
children:
[
SingleChildScrollView
(
content:
Container
(
width:
width
,
height:
height
,
child:
Column
(
children:
[
Expanded
(
child:
SingleChildScrollView
(
child:
Container
(
//constraints: BoxConstraints.expand(),
padding:
EdgeInsets
.
fromLTRB
(
0
,
10
,
0
,
0
),
child:
Text
(
post
.
content
!=
""
?
post
.
content
:
"This post only has a title."
,
post
.
effectiveContent
,
overflow:
TextOverflow
.
fade
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
19
),
),
),
),
]
,
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Text
(
post
.
title
!=
""
?
post
.
comments
.
toString
()
+
" Comments"
:
""
,
textAlign:
TextAlign
.
right
,
style:
TextStyle
(
fontSize:
16
),
)
,
],
)
]
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
)
,
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Text
(
post
.
title
!=
""
?
"
${post.comments}
Comments"
:
""
,
textAlign:
TextAlign
.
right
,
style:
TextStyle
(
fontSize:
16
)
,
),
]
,
)
],
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
)
,
),
);
}
void
redirectToUserGraph
(
BuildContext
context
)
{
// pop dialog
Navigator
.
of
(
context
).
pop
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -184,10 +144,13 @@ class PostNodeDialog extends StatelessWidget {
}
void
redirectToCommunityGraph
(
BuildContext
context
)
{
// pop dialog
Navigator
.
of
(
context
).
pop
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
CommunityGraphViewPage
(
post
.
community
),
));
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
CommunityGraphViewPage
(
post
.
community
),
),
);
}
}
src/dashboard/lib/main.dart
View file @
05c7962e
...
...
@@ -20,8 +20,6 @@ class MyApp extends StatefulWidget {
class
_MyAppState
extends
State
<
MyApp
>
{
Future
<
BackendUser
>
_checkLoginStuff
()
async
{
await
Future
.
delayed
(
Duration
(
milliseconds:
500
));
try
{
return
await
LoginHelper
().
loggedInUser
;
}
on
LoginException
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment