1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Ready to implement page show

This commit is contained in:
Pierre HUBERT 2021-04-25 17:49:55 +02:00
parent 8e8a3c711d
commit 8802a52816
2 changed files with 20 additions and 3 deletions

View File

@ -67,6 +67,7 @@ class _ForezDirectoryScreenState extends State<ForezDirectoryScreen> {
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<ForezDirectoryScreen> {
}
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()

View File

@ -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;
}