diff --git a/lib/forez/ui/screens/forez_directory_screen.dart b/lib/forez/ui/screens/forez_directory_screen.dart index 65551ba..4cebbe6 100644 --- a/lib/forez/ui/screens/forez_directory_screen.dart +++ b/lib/forez/ui/screens/forez_directory_screen.dart @@ -67,6 +67,7 @@ class _ForezDirectoryScreenState extends State { itemBuilder: (c, i) => _ForezMemberTile( member: _members[i], user: _users.getUser(_members[i].userID), + onTap: (user) => _openUserProfile(user), selectedAction: _doPopupMenuAction, ), itemCount: _members.length, @@ -101,9 +102,17 @@ class _ForezDirectoryScreenState extends State { } void _doSearch() async { - final user = await searchUser(context, UsersList()..addAll(_users)); - print("found ${user?.fullName}"); - //if (user != null) _openUserProfile(user); + final user = await searchUser( + context, + UsersList() + ..addAll(_users.where((u) => + _members.where((m) => m.userID == u.id).first.isAtLeastMember))); + + if (user != null) _openUserProfile(user); + } + + void _openUserProfile(User user) { + print("Open user profile ${user.fullName}"); } } @@ -111,12 +120,14 @@ class _ForezMemberTile extends StatelessWidget { final User user; final GroupMembership member; final Function(_PopupMenuActions, User) selectedAction; + final Function(User) onTap; const _ForezMemberTile({ Key key, @required this.user, @required this.member, @required this.selectedAction, + @required this.onTap, }) : super(key: key); @override @@ -127,6 +138,7 @@ class _ForezMemberTile extends StatelessWidget { trailing: member.level == GroupMembershipLevel.PENDING ? _buildRequestedButton() : _buildPopupMenuButton(), + onTap: member.isAtLeastMember ? () => onTap(user) : null, ); Widget _buildPopupMenuButton() => user.id == userID() diff --git a/lib/models/group_membership.dart b/lib/models/group_membership.dart index e5adbc3..7320469 100644 --- a/lib/models/group_membership.dart +++ b/lib/models/group_membership.dart @@ -22,4 +22,9 @@ class GroupMembership { assert(level != null); String get membershipText => membershipToText(level); + + bool get isAtLeastMember => + level == GroupMembershipLevel.ADMINISTRATOR || + level == GroupMembershipLevel.MODERATOR || + level == GroupMembershipLevel.MEMBER; }