From a3b2c2791b42db82aaee1d4647b8227894eaf324 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Fri, 20 Jun 2025 12:08:51 -0400 Subject: [PATCH] chore: make non-joined room members less opaque in room details view --- .../pages/pangea_chat_details.dart | 118 +++++++++--------- .../spaces/utils/load_participants_util.dart | 10 +- 2 files changed, 70 insertions(+), 58 deletions(-) diff --git a/lib/pangea/chat_settings/pages/pangea_chat_details.dart b/lib/pangea/chat_settings/pages/pangea_chat_details.dart index 6b142d304..8c30ebecb 100644 --- a/lib/pangea/chat_settings/pages/pangea_chat_details.dart +++ b/lib/pangea/chat_settings/pages/pangea_chat_details.dart @@ -544,7 +544,7 @@ class RoomDetailsButtonRowState extends State { ); } - final button = buttons[index]; + final button = mainViewButtons[index]; return Expanded( child: RoomDetailsButton( mini: mini, @@ -729,66 +729,70 @@ class RoomParticipantsSection extends StatelessWidget { padding: EdgeInsets.all(_padding), child: SizedBox( width: _width, - child: Column( - children: [ - Stack( - alignment: Alignment.center, - children: [ - if (gradient != null) - CircleAvatar( - radius: _width / 2, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - gradient: gradient, - ), - ), - ) - else - SizedBox( - height: _width, - width: _width, - ), - Builder( - builder: (context) { - return MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - onTap: () => showMemberActionsPopupMenu( - context: context, - user: user, + child: Opacity( + opacity: user.membership == Membership.join ? 1.0 : 0.5, + child: Column( + children: [ + Stack( + alignment: Alignment.center, + children: [ + if (gradient != null) + CircleAvatar( + radius: _width / 2, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: gradient, ), - child: Center( - child: Avatar( - mxContent: user.avatarUrl, - name: user.calcDisplayname(), - size: _width - 6.0, - presenceUserId: user.id, - showPresence: false, + ), + ) + else + SizedBox( + height: _width, + width: _width, + ), + Builder( + builder: (context) { + return MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () => showMemberActionsPopupMenu( + context: context, + user: user, + ), + child: Center( + child: Avatar( + mxContent: user.avatarUrl, + name: user.calcDisplayname(), + size: _width - 6.0, + presenceUserId: user.id, + showPresence: false, + ), ), ), - ), - ); - }, - ), - ], - ), - Text( - user.calcDisplayname(), - style: Theme.of(context) - .textTheme - .labelLarge - ?.copyWith( - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, + ); + }, ), - overflow: TextOverflow.ellipsis, - ), - LevelDisplayName( - userId: user.id, - textStyle: Theme.of(context).textTheme.labelSmall, - ), - ], + ], + ), + Text( + user.calcDisplayname(), + style: Theme.of(context) + .textTheme + .labelLarge + ?.copyWith( + color: + Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.ellipsis, + ), + LevelDisplayName( + userId: user.id, + textStyle: Theme.of(context).textTheme.labelSmall, + ), + ], + ), ), ), ); diff --git a/lib/pangea/spaces/utils/load_participants_util.dart b/lib/pangea/spaces/utils/load_participants_util.dart index 5b3d9c24a..c6b176bd8 100644 --- a/lib/pangea/spaces/utils/load_participants_util.dart +++ b/lib/pangea/spaces/utils/load_participants_util.dart @@ -89,6 +89,14 @@ class LoadParticipantsUtilState extends State { return -1; } + if (a.membership != Membership.join && b.membership != Membership.join) { + return a.displayName?.compareTo(b.displayName ?? '') ?? 0; + } else if (a.membership != Membership.join) { + return 1; + } else if (b.membership != Membership.join) { + return -1; + } + final PublicProfileModel? aProfile = _levelsCache[a.id]; final PublicProfileModel? bProfile = _levelsCache[b.id]; @@ -100,7 +108,7 @@ class LoadParticipantsUtilState extends State { Future _cacheLevels() async { for (final user in participants) { - if (_levelsCache[user.id] == null) { + if (_levelsCache[user.id] == null && user.membership == Membership.join) { _levelsCache[user.id] = await MatrixState .pangeaController.userController .getPublicProfile(user.id);