From e236cdf85f64b6512f124e182d792ecdb12472ce Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Sun, 20 Mar 2022 15:22:27 +0100 Subject: [PATCH] design: Make pinned events use less vertical space --- lib/pages/chat/pinned_events.dart | 75 +++++++++++++++++++------------ 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/lib/pages/chat/pinned_events.dart b/lib/pages/chat/pinned_events.dart index 8e8ee39c..8594afec 100644 --- a/lib/pages/chat/pinned_events.dart +++ b/lib/pages/chat/pinned_events.dart @@ -67,39 +67,56 @@ class PinnedEvents extends StatelessWidget { color: Theme.of(context).appBarTheme.backgroundColor, elevation: Theme.of(context).appBarTheme.elevation ?? 10, shadowColor: Theme.of(context).appBarTheme.shadowColor, - child: ListTile( - tileColor: Colors.transparent, + child: InkWell( onTap: () => _displayPinnedEventsDialog( context, pinnedEvents, ), - leading: IconButton( - icon: const Icon(Icons.close), - tooltip: L10n.of(context)!.unpin, - onPressed: () => controller.unpinEvent(event.eventId), - ), - title: LinkText( - text: event.getLocalizedBody( - MatrixLocals(L10n.of(context)!), - withSenderNamePrefix: true, - hideReply: true, - ), - maxLines: 3, - textStyle: TextStyle( - fontSize: fontSize, - decoration: - event.redacted ? TextDecoration.lineThrough : null, - ), - linkStyle: TextStyle( - color: Theme.of(context) - .textTheme - .bodyText1 - ?.color - ?.withAlpha(150), - fontSize: fontSize, - decoration: TextDecoration.underline, - ), - onLinkTap: (url) => UrlLauncher(context, url).launchUrl(), + child: Row( + children: [ + IconButton( + splashRadius: 20, + iconSize: 20, + icon: const Icon(Icons.push_pin), + tooltip: L10n.of(context)!.unpin, + onPressed: controller.room + ?.canSendEvent(EventTypes.RoomPinnedEvents) ?? + false + ? () => controller.unpinEvent(event.eventId) + : null, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 4.0), + child: LinkText( + text: event.getLocalizedBody( + MatrixLocals(L10n.of(context)!), + withSenderNamePrefix: true, + hideReply: true, + ), + maxLines: 2, + textStyle: TextStyle( + overflow: TextOverflow.ellipsis, + fontSize: fontSize, + decoration: event.redacted + ? TextDecoration.lineThrough + : null, + ), + linkStyle: TextStyle( + color: Theme.of(context) + .textTheme + .bodyText1 + ?.color + ?.withAlpha(150), + fontSize: fontSize, + decoration: TextDecoration.underline, + ), + onLinkTap: (url) => + UrlLauncher(context, url).launchUrl(), + ), + ), + ), + ], ), ), );