mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Show posts targets
This commit is contained in:
@ -39,15 +39,18 @@ class PostTile extends StatefulWidget {
|
||||
final Post post;
|
||||
final UsersList usersInfo;
|
||||
final void Function(Post) onDeletedPost;
|
||||
final bool showPostTarget;
|
||||
|
||||
const PostTile({
|
||||
Key key,
|
||||
@required this.post,
|
||||
@required this.usersInfo,
|
||||
@required this.onDeletedPost,
|
||||
@required this.showPostTarget,
|
||||
}) : assert(post != null),
|
||||
assert(usersInfo != null),
|
||||
assert(onDeletedPost != null),
|
||||
assert(showPostTarget != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@ -75,6 +78,17 @@ class _PostTileState extends State<PostTile> {
|
||||
|
||||
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() {
|
||||
// Header row
|
||||
return Row(
|
||||
@ -91,7 +105,7 @@ class _PostTileState extends State<PostTile> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
_user.displayName,
|
||||
_user.displayName + _getPostTarget(),
|
||||
style: _userNameStyle,
|
||||
),
|
||||
Text(diffTimeFromNowToStr(widget.post.timeSent)),
|
||||
|
Reference in New Issue
Block a user