diff --git a/lib/models/irc.dart b/lib/models/irc.dart index 07273c35..f1847db8 100644 --- a/lib/models/irc.dart +++ b/lib/models/irc.dart @@ -110,13 +110,13 @@ class IRCMessage { /// Returns an [InlineSpan] list that corresponds to the badges, username, words, and emotes of the given [IRCMessage]. List generateSpan( BuildContext context, { - required TextStyle? style, + TextStyle? style, required ChatAssetsStore assetsStore, required double badgeScale, required double emoteScale, required bool isLightTheme, required bool launchExternal, - required void Function()? onTapName, + void Function()? onTapName, bool showMessage = true, bool useReadableColors = false, TimestampType timestamp = TimestampType.disabled, diff --git a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart index b34eae98..14b3cd39 100644 --- a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart +++ b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart @@ -61,6 +61,40 @@ class ChatBottomBar extends StatelessWidget { return Column( children: [ + if (chatStore.replyingToMessage != null) ...[ + const Divider(), + ListTile( + contentPadding: const EdgeInsets.only(left: 16), + leading: const Icon(Icons.reply), + title: Text.rich( + TextSpan( + children: chatStore.replyingToMessage!.generateSpan( + context, + assetsStore: chatStore.assetsStore, + emoteScale: chatStore.settings.emoteScale, + badgeScale: chatStore.settings.badgeScale, + useReadableColors: chatStore.settings.useReadableColors, + isLightTheme: + Theme.of(context).brightness == Brightness.light, + launchExternal: chatStore.settings.launchUrlExternal, + timestamp: chatStore.settings.timestampType, + ), + ), + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: DefaultTextStyle.of(context) + .style + .copyWith(fontSize: chatStore.settings.fontSize), + ), + trailing: IconButton( + tooltip: 'Cancel reply', + onPressed: () { + chatStore.replyingToMessage = null; + }, + icon: const Icon(Icons.close), + ), + ), + ], if (chatStore.settings.autocomplete && chatStore.showEmoteAutocomplete && matchingEmotes.isNotEmpty) ...[ @@ -132,51 +166,6 @@ class ChatBottomBar extends StatelessWidget { padding: const EdgeInsets.fromLTRB(12, 12, 0, 12), child: Column( children: [ - if (chatStore.replyingToMessage != null) - Padding( - padding: const EdgeInsets.only(bottom: 12), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.reply), - Expanded( - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 12), - child: Text.rich( - TextSpan( - children: - chatStore.replyingToMessage!.generateSpan( - context, - assetsStore: chatStore.assetsStore, - emoteScale: chatStore.settings.emoteScale, - badgeScale: chatStore.settings.badgeScale, - useReadableColors: - chatStore.settings.useReadableColors, - isLightTheme: - Theme.of(context).brightness == - Brightness.light, - launchExternal: - chatStore.settings.launchUrlExternal, - timestamp: chatStore.settings.timestampType, - style: null, - onTapName: null, - ), - ), - maxLines: 5, - overflow: TextOverflow.ellipsis, - ), - ), - ), - IconButton( - onPressed: () { - chatStore.replyingToMessage = null; - }, - icon: const Icon(Icons.close), - ), - ], - ), - ), Row( children: [ if (!chatStore.expandChat && diff --git a/lib/screens/channel/chat/widgets/chat_message.dart b/lib/screens/channel/chat/widgets/chat_message.dart index fd2b320b..c69afcef 100644 --- a/lib/screens/channel/chat/widgets/chat_message.dart +++ b/lib/screens/channel/chat/widgets/chat_message.dart @@ -49,6 +49,8 @@ class ChatMessage extends StatelessWidget { chatStore.updateNotification('Message copied'); } + final defaultTextStyle = DefaultTextStyle.of(context).style; + void onLongPressMessage() { if (ircMessage.command != Command.privateMessage && ircMessage.command != Command.userState) { @@ -75,9 +77,8 @@ class ChatMessage extends StatelessWidget { Theme.of(context).brightness == Brightness.light, launchExternal: chatStore.settings.launchUrlExternal, timestamp: chatStore.settings.timestampType, - style: null, - onTapName: null, ), + style: defaultTextStyle, ), ), ), @@ -113,8 +114,6 @@ class ChatMessage extends StatelessWidget { ); } - final defaultTextStyle = DefaultTextStyle.of(context).style; - return Observer( builder: (context) { Color? color;