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
df60c4bf
Commit
df60c4bf
authored
Mar 15, 2021
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polished post dialog
parent
1a3d8c05
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 @
df60c4bf
...
@@ -12,4 +12,10 @@ class Post {
...
@@ -12,4 +12,10 @@ class Post {
if
(
title
!=
null
&&
title
.
isNotEmpty
)
return
title
;
if
(
title
!=
null
&&
title
.
isNotEmpty
)
return
title
;
return
content
;
return
content
;
}
}
String
get
effectiveContent
{
if
(
content
!=
null
&&
content
.
isNotEmpty
)
return
content
;
return
title
;
}
}
}
src/dashboard/lib/graphing/postnode.dart
View file @
df60c4bf
import
'package:dashboard/graphing/usergraph.dart'
;
import
'package:dashboard/graphing/usergraph.dart'
;
import
'package:dashboard/ui/graphs/community/index.dart'
;
import
'package:dashboard/ui/graphs/community/index.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'
;
import
'trustcolorcalculator.dart'
;
import
'trustcolorcalculator.dart'
;
class
PostNode
extends
StatelessWidget
{
class
PostNode
extends
StatelessWidget
{
final
Post
post
;
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
)
{
Widget
build
(
BuildContext
context
)
{
trustColor
=
TrustColorCalculator
.
calculateTrustColor
(
post
.
trust
);
return
GestureDetector
(
return
GestureDetector
(
onTap:
()
=>
redirectToPost
(
context
),
onTap:
()
=>
redirectToPost
(
context
),
child:
Row
(
child:
Row
(
...
@@ -37,145 +36,106 @@ class PostNode extends StatelessWidget {
...
@@ -37,145 +36,106 @@ class PostNode extends StatelessWidget {
void
redirectToPost
(
BuildContext
context
)
{
void
redirectToPost
(
BuildContext
context
)
{
showDialog
(
showDialog
(
context:
context
,
builder:
(
_
)
=>
new
PostNodeDialog
(
post
,
trustColor
));
context:
context
,
//Navigator.push(
builder:
(
_
)
=>
new
PostNodeDialog
(
post
,
trustColor
),
// context,
);
// MaterialPageRoute(
// builder: (context) => PostNodeTooltip(post, this.trustColor),
// ));
}
}
}
}
class
PostNodeDialog
extends
StatelessWidget
{
class
PostNodeDialog
extends
StatelessWidget
{
PostNodeDialog
(
this
.
post
,
this
.
trustColor
);
PostNodeDialog
(
this
.
post
,
this
.
trustColor
,
{
this
.
width
=
350
,
this
.
height
=
400
});
final
Post
post
;
final
Post
post
;
final
Color
trustColor
;
final
Color
trustColor
;
final
double
titleSize
=
22
;
final
double
titleSize
=
22
;
final
double
width
;
final
double
height
;
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
AlertDialog
(
return
AlertDialog
(
titlePadding:
EdgeInsets
.
all
(
0
),
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
(
title:
Container
(
width:
width
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
blue
,
color:
Colors
.
blue
,
boxShadow:
[
BoxShadow
(
blurRadius:
0.2
,
spreadRadius:
0.2
)]),
boxShadow:
[
BoxShadow
(
blurRadius:
0.2
,
spreadRadius:
0.2
)],
),
padding:
EdgeInsets
.
all
(
5
),
padding:
EdgeInsets
.
all
(
5
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
Row
(
Expanded
(
children:
[
child:
Text
(
Container
(
post
.
title
!=
""
?
post
.
title
:
"Comment"
,
child:
Text
(
overflow:
TextOverflow
.
ellipsis
,
post
.
title
!=
""
?
post
.
title
:
"Comment"
,
style:
TextStyle
(
overflow:
TextOverflow
.
fade
,
fontWeight:
FontWeight
.
bold
,
style:
TextStyle
(
color:
Colors
.
black
,
fontWeight:
FontWeight
.
bold
,
fontSize:
titleSize
,
color:
Colors
.
black
,
fontSize:
titleSize
,
),
),
//constraints: BoxConstraints.expand(),
),
),
]
,
)
,
),
),
Container
(
IconButton
(
margin:
EdgeInsets
.
fromLTRB
(
10
,
0
,
5
,
0
),
onPressed:
()
=>
Navigator
.
pop
(
context
),
child:
Row
(
icon:
Icon
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
Icons
.
close
,
children:
[
color:
Colors
.
white
,
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
).
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
,
),
),
),
),
],
),
),
)
)
,
],
],
),
),
),
),
content:
Column
(
content:
Container
(
children:
[
width:
width
,
Column
(
height:
height
,
children:
[
child:
Column
(
SingleChildScrollView
(
children:
[
Expanded
(
child:
SingleChildScrollView
(
child:
Container
(
child:
Container
(
//constraints: BoxConstraints.expand(),
padding:
EdgeInsets
.
fromLTRB
(
0
,
10
,
0
,
0
),
padding:
EdgeInsets
.
fromLTRB
(
0
,
10
,
0
,
0
),
child:
Text
(
child:
Text
(
post
.
content
!=
""
post
.
effectiveContent
,
?
post
.
content
:
"There is nothing here :("
,
overflow:
TextOverflow
.
fade
,
overflow:
TextOverflow
.
fade
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
19
),
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
19
),
),
),
),
),
),
),
]
,
)
,
),
Row
(
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
children:
[
Text
(
Text
(
post
.
title
!=
""
?
"
${post.comments}
Comments"
:
""
,
post
.
title
!=
""
?
post
.
comments
.
toString
()
+
" Comments"
:
""
,
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
style:
TextStyle
(
fontSize:
16
)
,
style:
TextStyle
(
fontSize:
16
),
),
)
,
]
,
],
)
)
],
]
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
)
,
),
),
);
);
}
}
void
redirectToUserGraph
(
BuildContext
context
)
{
void
redirectToUserGraph
(
BuildContext
context
)
{
// pop dialog
Navigator
.
of
(
context
).
pop
();
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
...
@@ -184,10 +144,13 @@ class PostNodeDialog extends StatelessWidget {
...
@@ -184,10 +144,13 @@ class PostNodeDialog extends StatelessWidget {
}
}
void
redirectToCommunityGraph
(
BuildContext
context
)
{
void
redirectToCommunityGraph
(
BuildContext
context
)
{
// pop dialog
Navigator
.
of
(
context
).
pop
();
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
context
)
=>
CommunityGraphViewPage
(
post
.
community
),
builder:
(
context
)
=>
CommunityGraphViewPage
(
post
.
community
),
));
),
);
}
}
}
}
src/dashboard/lib/main.dart
View file @
df60c4bf
...
@@ -18,8 +18,6 @@ class MyApp extends StatefulWidget {
...
@@ -18,8 +18,6 @@ class MyApp extends StatefulWidget {
class
_MyAppState
extends
State
<
MyApp
>
{
class
_MyAppState
extends
State
<
MyApp
>
{
Future
<
BackendUser
>
_checkLoginStuff
()
async
{
Future
<
BackendUser
>
_checkLoginStuff
()
async
{
await
Future
.
delayed
(
Duration
(
milliseconds:
500
));
try
{
try
{
return
await
LoginHelper
().
loggedInUser
;
return
await
LoginHelper
().
loggedInUser
;
}
on
LoginException
{
}
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