1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +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/date_utils.dart';
import 'package:comunic/utils/files_utils.dart'; import 'package:comunic/utils/files_utils.dart';
import 'package:comunic/utils/intl_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/post_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -42,6 +43,7 @@ class PostTile extends StatefulWidget {
final GroupsList groupsInfo; final GroupsList groupsInfo;
final void Function(Post) onDeletedPost; final void Function(Post) onDeletedPost;
final bool showPostTarget; final bool showPostTarget;
final bool userNamesClickable;
const PostTile({ const PostTile({
Key key, Key key,
@ -50,11 +52,13 @@ class PostTile extends StatefulWidget {
@required this.onDeletedPost, @required this.onDeletedPost,
@required this.showPostTarget, @required this.showPostTarget,
@required this.groupsInfo, @required this.groupsInfo,
@required this.userNamesClickable,
}) : assert(post != null), }) : assert(post != null),
assert(usersInfo != null), assert(usersInfo != null),
assert(onDeletedPost != null), assert(onDeletedPost != null),
assert(showPostTarget != null), assert(showPostTarget != null),
assert(groupsInfo != null), assert(groupsInfo != null),
assert(userNamesClickable != null),
super(key: key); super(key: key);
@override @override
@ -100,7 +104,15 @@ class _PostTileState extends State<PostTile> {
// User account image // User account image
Padding( Padding(
padding: const EdgeInsets.only(right: 8.0, left: 8.0), padding: const EdgeInsets.only(right: 8.0, left: 8.0),
child: AccountImageWidget(user: _user), child: InkWell(
child: AccountImageWidget(user: _user),
onTap: widget.userNamesClickable
? () => openUserPage(
userID: _user.id,
context: context,
)
: null,
),
), ),
// Column with user name + post target // Column with user name + post target

View File

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