1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Can click on user account image for posts to open user page

This commit is contained in:
Pierre HUBERT 2019-06-15 08:27:20 +02:00
parent f26e6139cd
commit 972cee0a18
2 changed files with 17 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import 'package:comunic/ui/widgets/network_image_widget.dart';
import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/files_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/navigation_utils.dart';
import 'package:comunic/utils/post_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
@ -42,6 +43,7 @@ class PostTile extends StatefulWidget {
final GroupsList groupsInfo;
final void Function(Post) onDeletedPost;
final bool showPostTarget;
final bool userNamesClickable;
const PostTile({
Key key,
@ -50,11 +52,13 @@ class PostTile extends StatefulWidget {
@required this.onDeletedPost,
@required this.showPostTarget,
@required this.groupsInfo,
@required this.userNamesClickable,
}) : assert(post != null),
assert(usersInfo != null),
assert(onDeletedPost != null),
assert(showPostTarget != null),
assert(groupsInfo != null),
assert(userNamesClickable != null),
super(key: key);
@override
@ -100,7 +104,15 @@ class _PostTileState extends State<PostTile> {
// User account image
Padding(
padding: const EdgeInsets.only(right: 8.0, left: 8.0),
child: InkWell(
child: AccountImageWidget(user: _user),
onTap: widget.userNamesClickable
? () => openUserPage(
userID: _user.id,
context: context,
)
: null,
),
),
// Column with user name + post target

View File

@ -20,15 +20,18 @@ class PostsListWidget extends StatefulWidget {
final Future<PostsList> Function() getPostsList;
final bool showPostsTarget;
final bool buildListView;
final bool userNamesClickable;
const PostsListWidget({
Key key,
@required this.getPostsList,
@required this.showPostsTarget,
this.userNamesClickable = true,
this.buildListView = true,
}) : assert(getPostsList != null),
assert(showPostsTarget != null),
assert(buildListView != null),
assert(userNamesClickable != null),
super(key: key);
@override
@ -106,6 +109,7 @@ class _PostsListWidgetState extends State<PostsListWidget> {
groupsInfo: _groups,
onDeletedPost: _removePost,
showPostTarget: widget.showPostsTarget,
userNamesClickable: widget.userNamesClickable,
);
}