diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index cc31f0278..7a8aa67d1 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -207,53 +207,57 @@ class ChatDetailsView extends StatelessWidget { ), ], ), - Divider(color: theme.dividerColor), - ListTile( - title: Text( - L10n.of(context).chatDescription, - style: TextStyle( - color: theme.colorScheme.secondary, - fontWeight: FontWeight.bold, + if (room.canChangeStateEvent(EventTypes.RoomTopic) || + room.topic.isNotEmpty) ...[ + Divider(color: theme.dividerColor), + ListTile( + title: Text( + L10n.of(context).chatDescription, + style: TextStyle( + color: theme.colorScheme.secondary, + fontWeight: FontWeight.bold, + ), + ), + trailing: + room.canChangeStateEvent(EventTypes.RoomTopic) + ? IconButton( + onPressed: controller.setTopicAction, + tooltip: + L10n.of(context).setChatDescription, + icon: const Icon(Icons.edit_outlined), + ) + : null, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + ), + child: SelectableLinkify( + text: room.topic.isEmpty + ? L10n.of(context).noChatDescriptionYet + : room.topic, + textScaleFactor: + MediaQuery.textScalerOf(context).scale(1), + options: const LinkifyOptions(humanize: false), + linkStyle: const TextStyle( + color: Colors.blueAccent, + decorationColor: Colors.blueAccent, + ), + style: TextStyle( + fontSize: 14, + fontStyle: room.topic.isEmpty + ? FontStyle.italic + : FontStyle.normal, + color: theme.textTheme.bodyMedium!.color, + decorationColor: + theme.textTheme.bodyMedium!.color, + ), + onOpen: (url) => + UrlLauncher(context, url.url).launchUrl(), ), ), - trailing: room - .canChangeStateEvent(EventTypes.RoomTopic) - ? IconButton( - onPressed: controller.setTopicAction, - tooltip: L10n.of(context).setChatDescription, - icon: const Icon(Icons.edit_outlined), - ) - : null, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, - ), - child: SelectableLinkify( - text: room.topic.isEmpty - ? L10n.of(context).noChatDescriptionYet - : room.topic, - textScaleFactor: - MediaQuery.textScalerOf(context).scale(1), - options: const LinkifyOptions(humanize: false), - linkStyle: const TextStyle( - color: Colors.blueAccent, - decorationColor: Colors.blueAccent, - ), - style: TextStyle( - fontSize: 14, - fontStyle: room.topic.isEmpty - ? FontStyle.italic - : FontStyle.normal, - color: theme.textTheme.bodyMedium!.color, - decorationColor: - theme.textTheme.bodyMedium!.color, - ), - onOpen: (url) => - UrlLauncher(context, url.url).launchUrl(), - ), - ), - const SizedBox(height: 16), + const SizedBox(height: 16), + ], Divider(color: theme.dividerColor), ListTile( leading: CircleAvatar(