mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Show posts targets
This commit is contained in:
parent
14b6f17042
commit
d62d23bd44
@ -20,6 +20,7 @@ class _NewestPostsScreenState extends State<NewestPostsScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PostsListWidget(
|
return PostsListWidget(
|
||||||
getPostsList: _postsHelper.getLatest,
|
getPostsList: _postsHelper.getLatest,
|
||||||
|
showPostsTarget: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,15 +39,18 @@ class PostTile extends StatefulWidget {
|
|||||||
final Post post;
|
final Post post;
|
||||||
final UsersList usersInfo;
|
final UsersList usersInfo;
|
||||||
final void Function(Post) onDeletedPost;
|
final void Function(Post) onDeletedPost;
|
||||||
|
final bool showPostTarget;
|
||||||
|
|
||||||
const PostTile({
|
const PostTile({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.post,
|
@required this.post,
|
||||||
@required this.usersInfo,
|
@required this.usersInfo,
|
||||||
@required this.onDeletedPost,
|
@required this.onDeletedPost,
|
||||||
|
@required this.showPostTarget,
|
||||||
}) : assert(post != null),
|
}) : assert(post != null),
|
||||||
assert(usersInfo != null),
|
assert(usersInfo != null),
|
||||||
assert(onDeletedPost != null),
|
assert(onDeletedPost != null),
|
||||||
|
assert(showPostTarget != null),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -75,6 +78,17 @@ class _PostTileState extends State<PostTile> {
|
|||||||
|
|
||||||
set _sendingComment(bool sending) => setState(() => _submitting = sending);
|
set _sendingComment(bool sending) => setState(() => _submitting = sending);
|
||||||
|
|
||||||
|
String _getPostTarget() {
|
||||||
|
if (!widget.showPostTarget ||
|
||||||
|
(!widget.post.isGroupPost &&
|
||||||
|
widget.post.userID == widget.post.userPageID)) return "";
|
||||||
|
|
||||||
|
return " > " +
|
||||||
|
(widget.post.isGroupPost
|
||||||
|
? "Group"
|
||||||
|
: widget.usersInfo.getUser(widget.post.userPageID).displayName);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildHeaderRow() {
|
Widget _buildHeaderRow() {
|
||||||
// Header row
|
// Header row
|
||||||
return Row(
|
return Row(
|
||||||
@ -91,7 +105,7 @@ class _PostTileState extends State<PostTile> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
_user.displayName,
|
_user.displayName + _getPostTarget(),
|
||||||
style: _userNameStyle,
|
style: _userNameStyle,
|
||||||
),
|
),
|
||||||
Text(diffTimeFromNowToStr(widget.post.timeSent)),
|
Text(diffTimeFromNowToStr(widget.post.timeSent)),
|
||||||
|
@ -16,11 +16,14 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class PostsListWidget extends StatefulWidget {
|
class PostsListWidget extends StatefulWidget {
|
||||||
final Future<PostsList> Function() getPostsList;
|
final Future<PostsList> Function() getPostsList;
|
||||||
|
final bool showPostsTarget;
|
||||||
|
|
||||||
const PostsListWidget({
|
const PostsListWidget({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.getPostsList,
|
@required this.getPostsList,
|
||||||
|
@required this.showPostsTarget,
|
||||||
}) : assert(getPostsList != null),
|
}) : assert(getPostsList != null),
|
||||||
|
assert(showPostsTarget != null),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -75,6 +78,7 @@ class _PostsListWidgetState extends State<PostsListWidget> {
|
|||||||
post: _list[i],
|
post: _list[i],
|
||||||
usersInfo: _users,
|
usersInfo: _users,
|
||||||
onDeletedPost: _removePost,
|
onDeletedPost: _removePost,
|
||||||
|
showPostTarget: widget.showPostsTarget,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user