refactor: Nicer popupmenus

This commit is contained in:
Christian Kußowski 2025-06-16 18:21:10 +02:00
commit 37d313c271
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
3 changed files with 41 additions and 31 deletions

View file

@ -56,7 +56,7 @@ abstract class FluffyThemes {
: colorScheme.surfaceContainer, : colorScheme.surfaceContainer,
popupMenuTheme: PopupMenuThemeData( popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
), ),
), ),
segmentedButtonTheme: SegmentedButtonThemeData( segmentedButtonTheme: SegmentedButtonThemeData(

View file

@ -550,17 +550,21 @@ class ChatListController extends State<ChatList>
value: ChatContextAction.open, value: ChatContextAction.open,
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 12.0,
children: [ children: [
Avatar( Avatar(
mxContent: room.avatar, mxContent: room.avatar,
size: Avatar.defaultSize / 2,
name: displayname, name: displayname,
), ),
const SizedBox(width: 12), ConstrainedBox(
Text( constraints: const BoxConstraints(maxWidth: 128),
displayname, child: Text(
style: displayname,
TextStyle(color: Theme.of(context).colorScheme.onSurface), style:
TextStyle(color: Theme.of(context).colorScheme.onSurface),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
), ),
], ],
), ),

View file

@ -40,36 +40,42 @@ void showMemberActionsPopupMenu({
items: <PopupMenuEntry<_MemberActions>>[ items: <PopupMenuEntry<_MemberActions>>[
PopupMenuItem( PopupMenuItem(
value: _MemberActions.info, value: _MemberActions.info,
child: Padding( child: Row(
padding: const EdgeInsets.symmetric(vertical: 8.0), spacing: 12.0,
child: Center( children: [
child: Column( Avatar(
name: displayname,
mxContent: user.avatarUrl,
presenceUserId: user.id,
presenceBackgroundColor: theme.colorScheme.surfaceContainer,
),
Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Avatar( ConstrainedBox(
name: displayname, constraints: const BoxConstraints(maxWidth: 128),
mxContent: user.avatarUrl, child: Text(
presenceUserId: user.id, displayname,
presenceBackgroundColor: theme.colorScheme.surfaceContainer, textAlign: TextAlign.center,
style: theme.textTheme.labelLarge,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
), ),
const SizedBox(height: 8), ConstrainedBox(
Text( constraints: const BoxConstraints(maxWidth: 128),
displayname, child: Text(
textAlign: TextAlign.center, user.id,
style: theme.textTheme.labelLarge, textAlign: TextAlign.center,
maxLines: 1, style: const TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis, maxLines: 1,
), overflow: TextOverflow.ellipsis,
Text( ),
user.id,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 10),
maxLines: 1,
overflow: TextOverflow.ellipsis,
), ),
], ],
), ),
), ],
), ),
), ),
const PopupMenuDivider(), const PopupMenuDivider(),