mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 12:58:51 +00:00
Ready to implement page show
This commit is contained in:
parent
8e8a3c711d
commit
8802a52816
@ -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()
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user