diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index 19c8d3503..d154b0839 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -1,11 +1,9 @@ import 'package:flutter/material.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; -import 'package:matrix/matrix.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/l10n/l10n.dart'; -import 'package:fluffychat/pages/chat/sticker_picker_dialog.dart'; import 'chat.dart'; class ChatEmojiPicker extends StatelessWidget { @@ -25,13 +23,18 @@ class ChatEmojiPicker extends StatelessWidget { : 0, child: controller.showEmojiPicker ? DefaultTabController( - length: 2, + // #Pangea + // length: 2, + length: 1, + // Pangea# child: Column( children: [ TabBar( tabs: [ Tab(text: L10n.of(context).emojis), - Tab(text: L10n.of(context).stickers), + // #Pangea + // Tab(text: L10n.of(context).stickers), + // Pangea# ], ), Expanded( @@ -67,20 +70,22 @@ class ChatEmojiPicker extends StatelessWidget { ), ), ), - StickerPickerDialog( - room: controller.room, - onSelected: (sticker) { - controller.room.sendEvent( - { - 'body': sticker.body, - 'info': sticker.info ?? {}, - 'url': sticker.url.toString(), - }, - type: EventTypes.Sticker, - ); - controller.hideEmojiPicker(); - }, - ), + // #Pangea + // StickerPickerDialog( + // room: controller.room, + // onSelected: (sticker) { + // controller.room.sendEvent( + // { + // 'body': sticker.body, + // 'info': sticker.info ?? {}, + // 'url': sticker.url.toString(), + // }, + // type: EventTypes.Sticker, + // ); + // controller.hideEmojiPicker(); + // }, + // ), + // Pangea# ], ), ), diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 33ba9f4b6..24827cb29 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -1021,35 +1021,33 @@ class HtmlMessage extends StatelessWidget { // overflow: TextOverflow.fade, // ); final parsed = parser.parse(_addTokenTags()).body ?? dom.Element.html(''); - return SelectionArea( - child: GestureDetector( - onTap: () { - if (overlayController == null) { - controller.showToolbar( - pangeaMessageEvent?.event ?? event, - pangeaMessageEvent: pangeaMessageEvent, - nextEvent: nextEvent, - prevEvent: prevEvent, - ); - } - }, - child: Text.rich( - textScaler: TextScaler.noScaling, - _renderHtml( - parsed, - context, - TextStyle( - fontSize: fontSize, - color: textColor, - ), - ), - style: TextStyle( + return GestureDetector( + onTap: () { + if (overlayController == null) { + controller.showToolbar( + pangeaMessageEvent?.event ?? event, + pangeaMessageEvent: pangeaMessageEvent, + nextEvent: nextEvent, + prevEvent: prevEvent, + ); + } + }, + child: Text.rich( + textScaler: TextScaler.noScaling, + _renderHtml( + parsed, + context, + TextStyle( fontSize: fontSize, color: textColor, ), - maxLines: limitHeight ? 64 : null, - overflow: TextOverflow.fade, ), + style: TextStyle( + fontSize: fontSize, + color: textColor, + ), + maxLines: limitHeight ? 64 : null, + overflow: TextOverflow.fade, ), ); } diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 8177b3f52..f0bcb5a71 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -564,96 +564,108 @@ class Message extends StatelessWidget { FluffyThemes.animationCurve, child: // #Pangea - PressableButton( - triggerAnimation: controller - .showToolbarStream.stream - .where( - (eventID) => - eventID == event.eventId, - ), - depressed: !isButton, - borderRadius: borderRadius, - onPressed: () { - showToolbar( - pangeaMessageEvent, - ); - }, - color: color, - visible: isButton && !noBubble, - child: - // Pangea# - Container( - decoration: BoxDecoration( - color: noBubble - ? Colors.transparent - : color, - borderRadius: borderRadius, - ), - clipBehavior: Clip.antiAlias, - // #Pangea - child: - CompositedTransformTarget( - link: MatrixState.pAnyState - .layerLinkAndKey( + SelectionContainer.disabled( + child: MouseRegion( + cursor: + SystemMouseCursors.click, + child: PressableButton( + triggerAnimation: controller + .showToolbarStream + .stream + .where( + (eventID) => + eventID == event.eventId, - ) - .link, - // child: BubbleBackground( - // colors: colors, - // ignore: noBubble || !ownMessage, - // scrollController: scrollController, - // Pangea# - child: Container( - // #Pangea - key: MatrixState.pAnyState - .layerLinkAndKey( - event.eventId, - ) - .key, - // Pangea# + ), + depressed: !isButton, + borderRadius: borderRadius, + onPressed: () { + showToolbar( + pangeaMessageEvent, + ); + }, + color: color, + visible: + isButton && !noBubble, + child: + // Pangea# + Container( decoration: BoxDecoration( + color: noBubble + ? Colors.transparent + : color, borderRadius: - BorderRadius - .circular( - AppConfig - .borderRadius, - ), + borderRadius, ), - constraints: - const BoxConstraints( - maxWidth: FluffyThemes - .columnWidth * - 1.5, - ), - child: Column( - mainAxisSize: - MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - if ({ - RelationshipTypes - .reply, - RelationshipTypes - .thread, - }.contains( - event - .relationshipType, - )) - FutureBuilder< - Event?>( - future: event - .getReplyEvent( - timeline, - ), - builder: ( - BuildContext - context, - snapshot, - ) { - final replyEvent = - snapshot + clipBehavior: + Clip.antiAlias, + // #Pangea + child: + CompositedTransformTarget( + link: MatrixState + .pAnyState + .layerLinkAndKey( + event.eventId, + ) + .link, + // child: BubbleBackground( + // colors: colors, + // ignore: noBubble || !ownMessage, + // scrollController: scrollController, + // Pangea# + child: Container( + // #Pangea + key: MatrixState + .pAnyState + .layerLinkAndKey( + event.eventId, + ) + .key, + // Pangea# + decoration: + BoxDecoration( + borderRadius: + BorderRadius + .circular( + AppConfig + .borderRadius, + ), + ), + constraints: + const BoxConstraints( + maxWidth: FluffyThemes + .columnWidth * + 1.5, + ), + child: Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if ({ + RelationshipTypes + .reply, + RelationshipTypes + .thread, + }.contains( + event + .relationshipType, + )) + FutureBuilder< + Event?>( + future: event + .getReplyEvent( + timeline, + ), + builder: ( + BuildContext + context, + snapshot, + ) { + final replyEvent = snapshot .hasData ? snapshot .data! @@ -679,119 +691,122 @@ class Message extends StatelessWidget { originServerTs: DateTime.now(), ); - return Padding( + return Padding( + padding: + const EdgeInsets + .only( + left: + 16, + right: + 16, + top: 8, + ), + child: + Material( + color: Colors + .transparent, + borderRadius: + ReplyContent.borderRadius, + child: + InkWell( + borderRadius: + ReplyContent.borderRadius, + onTap: () => + scrollToEventId( + replyEvent.eventId, + ), + child: + AbsorbPointer( + child: + ReplyContent( + replyEvent, + ownMessage: ownMessage, + timeline: timeline, + ), + ), + ), + ), + ); + }, + ), + MessageContent( + displayEvent, + textColor: + textColor, + linkColor: + linkColor, + onInfoTab: + onInfoTab, + borderRadius: + borderRadius, + timeline: + timeline, + selected: + selected, + // #Pangea + pangeaMessageEvent: + pangeaMessageEvent, + controller: + controller, + nextEvent: + nextEvent, + prevEvent: + previousEvent, + // Pangea# + ), + if (event + .hasAggregatedEvents( + timeline, + RelationshipTypes + .edit, + )) + Padding( padding: const EdgeInsets .only( - left: 16, - right: 16, - top: 8, + bottom: 8.0, + left: 16.0, + right: 16.0, ), - child: - Material( - color: Colors - .transparent, - borderRadius: - ReplyContent - .borderRadius, - child: - InkWell( - borderRadius: - ReplyContent - .borderRadius, - onTap: () => - scrollToEventId( - replyEvent - .eventId, + child: Row( + mainAxisSize: + MainAxisSize + .min, + spacing: + 4.0, + children: [ + Icon( + Icons + .edit_outlined, + color: textColor + .withAlpha( + 164, + ), + size: + 14, ), - child: - AbsorbPointer( - child: - ReplyContent( - replyEvent, - ownMessage: - ownMessage, - timeline: - timeline, + Text( + displayEvent + .originServerTs + .localizedTimeShort( + context, + ), + style: + TextStyle( + color: + textColor.withAlpha( + 164, + ), + fontSize: + 11, ), ), - ), + ], ), - ); - }, - ), - MessageContent( - displayEvent, - textColor: - textColor, - linkColor: - linkColor, - onInfoTab: - onInfoTab, - borderRadius: - borderRadius, - timeline: timeline, - selected: selected, - // #Pangea - pangeaMessageEvent: - pangeaMessageEvent, - controller: - controller, - nextEvent: - nextEvent, - prevEvent: - previousEvent, - // Pangea# + ), + ], ), - if (event - .hasAggregatedEvents( - timeline, - RelationshipTypes - .edit, - )) - Padding( - padding: - const EdgeInsets - .only( - bottom: 8.0, - left: 16.0, - right: 16.0, - ), - child: Row( - mainAxisSize: - MainAxisSize - .min, - spacing: 4.0, - children: [ - Icon( - Icons - .edit_outlined, - color: textColor - .withAlpha( - 164, - ), - size: 14, - ), - Text( - displayEvent - .originServerTs - .localizedTimeShort( - context, - ), - style: - TextStyle( - color: textColor - .withAlpha( - 164, - ), - fontSize: - 11, - ), - ), - ], - ), - ), - ], + ), ), ), ),