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:
parent
8e8a3c711d
commit
8802a52816
@ -67,6 +67,7 @@ class _ForezDirectoryScreenState extends State<ForezDirectoryScreen> {
|
|||||||
itemBuilder: (c, i) => _ForezMemberTile(
|
itemBuilder: (c, i) => _ForezMemberTile(
|
||||||
member: _members[i],
|
member: _members[i],
|
||||||
user: _users.getUser(_members[i].userID),
|
user: _users.getUser(_members[i].userID),
|
||||||
|
onTap: (user) => _openUserProfile(user),
|
||||||
selectedAction: _doPopupMenuAction,
|
selectedAction: _doPopupMenuAction,
|
||||||
),
|
),
|
||||||
itemCount: _members.length,
|
itemCount: _members.length,
|
||||||
@ -101,9 +102,17 @@ class _ForezDirectoryScreenState extends State<ForezDirectoryScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _doSearch() async {
|
void _doSearch() async {
|
||||||
final user = await searchUser(context, UsersList()..addAll(_users));
|
final user = await searchUser(
|
||||||
print("found ${user?.fullName}");
|
context,
|
||||||
//if (user != null) _openUserProfile(user);
|
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 User user;
|
||||||
final GroupMembership member;
|
final GroupMembership member;
|
||||||
final Function(_PopupMenuActions, User) selectedAction;
|
final Function(_PopupMenuActions, User) selectedAction;
|
||||||
|
final Function(User) onTap;
|
||||||
|
|
||||||
const _ForezMemberTile({
|
const _ForezMemberTile({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.user,
|
@required this.user,
|
||||||
@required this.member,
|
@required this.member,
|
||||||
@required this.selectedAction,
|
@required this.selectedAction,
|
||||||
|
@required this.onTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -127,6 +138,7 @@ class _ForezMemberTile extends StatelessWidget {
|
|||||||
trailing: member.level == GroupMembershipLevel.PENDING
|
trailing: member.level == GroupMembershipLevel.PENDING
|
||||||
? _buildRequestedButton()
|
? _buildRequestedButton()
|
||||||
: _buildPopupMenuButton(),
|
: _buildPopupMenuButton(),
|
||||||
|
onTap: member.isAtLeastMember ? () => onTap(user) : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildPopupMenuButton() => user.id == userID()
|
Widget _buildPopupMenuButton() => user.id == userID()
|
||||||
|
@ -22,4 +22,9 @@ class GroupMembership {
|
|||||||
assert(level != null);
|
assert(level != null);
|
||||||
|
|
||||||
String get membershipText => membershipToText(level);
|
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