From 033feed6b1fc06ab272a6b61c74d42689dd34f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 16 Jun 2025 18:11:49 +0200 Subject: [PATCH] refactor: New message context menu --- lib/config/app_config.dart | 2 + lib/l10n/intl_en.arb | 3 +- lib/pages/chat/chat.dart | 73 +- lib/pages/chat/chat_event_list.dart | 4 + lib/pages/chat/chat_input_row.dart | 491 ++++++------ lib/pages/chat/chat_view.dart | 8 - lib/pages/chat/events/message.dart | 1051 ++++++++++++++++---------- lib/pages/chat/input_bar.dart | 1 + lib/pages/chat/reactions_picker.dart | 104 --- lib/utils/show_scaffold_dialog.dart | 4 +- 10 files changed, 872 insertions(+), 869 deletions(-) delete mode 100644 lib/pages/chat/reactions_picker.dart diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index b5e10985d..8f9bf7a1b 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -24,6 +24,8 @@ abstract class AppConfig { static String _privacyUrl = 'https://github.com/krille-chan/fluffychat/blob/main/PRIVACY.md'; + static const Set defaultReactions = {'👍', '❤️', '😊'}; + static String get privacyUrl => _privacyUrl; static const String website = 'https://fluffychat.im'; static const String enablePushTutorial = diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 82c45c1ba..52d2c76f0 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -3239,5 +3239,6 @@ "pleaseWaitUntilInvited": "Please wait now, until someone from the room invites you.", "commandHint_logout": "Logout your current device", "commandHint_logoutall": "Logout all active devices", - "displayNavigationRail": "Show navigation rail on mobile" + "displayNavigationRail": "Show navigation rail on mobile", + "customReaction": "Custom reaction" } \ No newline at end of file diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index e82620509..98d2384f2 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -192,8 +192,6 @@ class ChatController extends State context.go('/rooms'); } - EmojiPickerType emojiPickerType = EmojiPickerType.keyboard; - void requestHistory([_]) async { Logs().v('Requesting history...'); await timeline?.requestHistory(historyCount: _loadHistoryCount); @@ -708,13 +706,11 @@ class ChatController extends State } else { inputFocus.unfocus(); } - emojiPickerType = EmojiPickerType.keyboard; setState(() => showEmojiPicker = !showEmojiPicker); } void _inputFocusListener() { if (showEmojiPicker && inputFocus.hasFocus) { - emojiPickerType = EmojiPickerType.keyboard; setState(() => showEmojiPicker = false); } } @@ -895,16 +891,6 @@ class ChatController extends State return true; } - bool get canEditSelectedEvents { - if (isArchived || - selectedEvents.length != 1 || - !selectedEvents.first.status.isSent) { - return false; - } - return currentRoomBundle - .any((cl) => selectedEvents.first.senderId == cl!.userID); - } - void forwardEventsAction() async { if (selectedEvents.isEmpty) return; await showScaffoldDialog( @@ -998,27 +984,8 @@ class ChatController extends State } void onEmojiSelected(_, Emoji? emoji) { - switch (emojiPickerType) { - case EmojiPickerType.reaction: - senEmojiReaction(emoji); - break; - case EmojiPickerType.keyboard: - typeEmoji(emoji); - onInputBarChanged(sendController.text); - break; - } - } - - void senEmojiReaction(Emoji? emoji) { - setState(() => showEmojiPicker = false); - if (emoji == null) return; - // make sure we don't send the same emoji twice - if (_allReactionEvents.any( - (e) => e.content.tryGetMap('m.relates_to')?['key'] == emoji.emoji, - )) { - return; - } - return sendEmojiAction(emoji.emoji); + typeEmoji(emoji); + onInputBarChanged(sendController.text); } void typeEmoji(Emoji? emoji) { @@ -1037,38 +1004,12 @@ class ChatController extends State ); } - late Iterable _allReactionEvents; - void emojiPickerBackspace() { - switch (emojiPickerType) { - case EmojiPickerType.reaction: - setState(() => showEmojiPicker = false); - break; - case EmojiPickerType.keyboard: - sendController - ..text = sendController.text.characters.skipLast(1).toString() - ..selection = TextSelection.fromPosition( - TextPosition(offset: sendController.text.length), - ); - break; - } - } - - void pickEmojiReactionAction(Iterable allReactionEvents) async { - _allReactionEvents = allReactionEvents; - emojiPickerType = EmojiPickerType.reaction; - setState(() => showEmojiPicker = true); - } - - void sendEmojiAction(String? emoji) async { - final events = List.from(selectedEvents); - setState(() => selectedEvents.clear()); - for (final event in events) { - await room.sendReaction( - event.eventId, - emoji!, + sendController + ..text = sendController.text.characters.skipLast(1).toString() + ..selection = TextSelection.fromPosition( + TextPosition(offset: sendController.text.length), ); - } } void clearSelectedEvents() => setState(() { @@ -1391,5 +1332,3 @@ class ChatController extends State ); } } - -enum EmojiPickerType { reaction, keyboard } diff --git a/lib/pages/chat/chat_event_list.dart b/lib/pages/chat/chat_event_list.dart index b95811ece..50a1c262a 100644 --- a/lib/pages/chat/chat_event_list.dart +++ b/lib/pages/chat/chat_event_list.dart @@ -141,6 +141,10 @@ class ChatEventList extends StatelessWidget { longPressSelect: controller.selectedEvents.isNotEmpty, selected: controller.selectedEvents .any((e) => e.eventId == event.eventId), + singleSelected: + controller.selectedEvents.singleOrNull?.eventId == + event.eventId, + onEdit: () => controller.editSelectedEventAction(), timeline: timeline, displayReadMarker: i > 0 && controller.readMarkerEventId == event.eventId, diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 6a673bded..4cbd00921 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -21,10 +21,6 @@ class ChatInputRow extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); - if (controller.showEmojiPicker && - controller.emojiPickerType == EmojiPickerType.reaction) { - return const SizedBox.shrink(); - } const height = 48.0; if (!controller.room.otherPartyCanReceiveMessages) { @@ -43,290 +39,231 @@ class ChatInputRow extends StatelessWidget { return Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: controller.selectMode - ? [ - if (controller.selectedEvents - .every((event) => event.status == EventStatus.error)) - SizedBox( - height: height, - child: TextButton( - style: TextButton.styleFrom( - foregroundColor: theme.colorScheme.error, - ), - onPressed: controller.deleteErrorEventsAction, - child: Row( - children: [ - const Icon(Icons.delete), - Text(L10n.of(context).delete), - ], - ), - ), - ) - else - SizedBox( - height: height, - child: TextButton( - onPressed: controller.forwardEventsAction, - child: Row( - children: [ - const Icon(Icons.keyboard_arrow_left_outlined), - Text(L10n.of(context).forward), - ], - ), - ), - ), - controller.selectedEvents.length == 1 - ? controller.selectedEvents.first - .getDisplayEvent(controller.timeline!) - .status - .isSent - ? SizedBox( - height: height, - child: TextButton( - onPressed: controller.replyAction, - child: Row( - children: [ - Text(L10n.of(context).reply), - const Icon(Icons.keyboard_arrow_right), - ], - ), - ), - ) - : SizedBox( - height: height, - child: TextButton( - onPressed: controller.sendAgainAction, - child: Row( - children: [ - Text(L10n.of(context).tryToSendAgain), - const SizedBox(width: 4), - const Icon(Icons.send_outlined, size: 16), - ], - ), - ), - ) - : const SizedBox.shrink(), - ] - : [ - const SizedBox(width: 4), - AnimatedContainer( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - width: controller.sendController.text.isNotEmpty ? 0 : height, - height: height, - alignment: Alignment.center, - decoration: const BoxDecoration(), - clipBehavior: Clip.hardEdge, - child: PopupMenuButton( - useRootNavigator: true, - icon: const Icon(Icons.add_circle_outline), - iconColor: theme.colorScheme.onPrimaryContainer, - onSelected: controller.onAddPopupMenuButtonSelected, - itemBuilder: (BuildContext context) => - >[ - if (PlatformInfos.isMobile) - PopupMenuItem( - value: 'location', - child: ListTile( - leading: CircleAvatar( - backgroundColor: - theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.gps_fixed_outlined), - ), - title: Text(L10n.of(context).shareLocation), - contentPadding: const EdgeInsets.all(0), - ), - ), - PopupMenuItem( - value: 'image', - child: ListTile( - leading: CircleAvatar( - backgroundColor: theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.photo_outlined), - ), - title: Text(L10n.of(context).sendImage), - contentPadding: const EdgeInsets.all(0), - ), - ), - PopupMenuItem( - value: 'video', - child: ListTile( - leading: CircleAvatar( - backgroundColor: theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.video_camera_back_outlined), - ), - title: Text(L10n.of(context).sendVideo), - contentPadding: const EdgeInsets.all(0), - ), - ), - PopupMenuItem( - value: 'file', - child: ListTile( - leading: CircleAvatar( - backgroundColor: theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.attachment_outlined), - ), - title: Text(L10n.of(context).sendFile), - contentPadding: const EdgeInsets.all(0), - ), - ), - ], - ), - ), + children: [ + const SizedBox(width: 4), + AnimatedContainer( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + width: controller.sendController.text.isNotEmpty ? 0 : height, + height: height, + alignment: Alignment.center, + decoration: const BoxDecoration(), + clipBehavior: Clip.hardEdge, + child: PopupMenuButton( + useRootNavigator: true, + enabled: !controller.selectMode, + icon: const Icon(Icons.add_circle_outline), + iconColor: theme.colorScheme.onPrimaryContainer, + onSelected: controller.onAddPopupMenuButtonSelected, + itemBuilder: (BuildContext context) => >[ if (PlatformInfos.isMobile) - AnimatedContainer( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - width: controller.sendController.text.isNotEmpty ? 0 : height, - height: height, - alignment: Alignment.center, - decoration: const BoxDecoration(), - clipBehavior: Clip.hardEdge, - child: PopupMenuButton( - useRootNavigator: true, - icon: const Icon(Icons.camera_alt_outlined), - onSelected: controller.onAddPopupMenuButtonSelected, - iconColor: theme.colorScheme.onPrimaryContainer, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'camera-video', - child: ListTile( - leading: CircleAvatar( - backgroundColor: - theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.videocam_outlined), - ), - title: Text(L10n.of(context).recordAVideo), - contentPadding: const EdgeInsets.all(0), - ), - ), - PopupMenuItem( - value: 'camera', - child: ListTile( - leading: CircleAvatar( - backgroundColor: - theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.camera_alt_outlined), - ), - title: Text(L10n.of(context).takeAPhoto), - contentPadding: const EdgeInsets.all(0), - ), - ), - ], + PopupMenuItem( + value: 'location', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.gps_fixed_outlined), + ), + title: Text(L10n.of(context).shareLocation), + contentPadding: const EdgeInsets.all(0), ), ), - Container( - height: height, - width: height, - alignment: Alignment.center, - child: IconButton( - tooltip: L10n.of(context).emojis, - color: theme.colorScheme.onPrimaryContainer, - icon: PageTransitionSwitcher( - transitionBuilder: ( - Widget child, - Animation primaryAnimation, - Animation secondaryAnimation, - ) { - return SharedAxisTransition( - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - transitionType: SharedAxisTransitionType.scaled, - fillColor: Colors.transparent, - child: child, - ); - }, - child: Icon( - controller.showEmojiPicker - ? Icons.keyboard - : Icons.add_reaction_outlined, - key: ValueKey(controller.showEmojiPicker), - ), + PopupMenuItem( + value: 'image', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.photo_outlined), ), - onPressed: controller.emojiPickerAction, + title: Text(L10n.of(context).sendImage), + contentPadding: const EdgeInsets.all(0), ), ), - if (Matrix.of(context).isMultiAccount && - Matrix.of(context).hasComplexBundles && - Matrix.of(context).currentBundle!.length > 1) - Container( - width: height, - height: height, - alignment: Alignment.center, - child: _ChatAccountPicker(controller), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0), - child: InputBar( - room: controller.room, - minLines: 1, - maxLines: 8, - autofocus: !PlatformInfos.isMobile, - keyboardType: TextInputType.multiline, - textInputAction: - AppConfig.sendOnEnter == true && PlatformInfos.isMobile - ? TextInputAction.send - : null, - onSubmitted: controller.onInputBarSubmitted, - onSubmitImage: controller.sendImageFromClipBoard, - focusNode: controller.inputFocus, - controller: controller.sendController, - decoration: InputDecoration( - contentPadding: const EdgeInsets.only( - left: 6.0, - right: 6.0, - bottom: 6.0, - top: 3.0, - ), - hintText: L10n.of(context).writeAMessage, - hintMaxLines: 1, - border: InputBorder.none, - enabledBorder: InputBorder.none, - filled: false, - ), - onChanged: controller.onInputBarChanged, + PopupMenuItem( + value: 'video', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.video_camera_back_outlined), ), + title: Text(L10n.of(context).sendVideo), + contentPadding: const EdgeInsets.all(0), ), ), - Container( - height: height, - width: height, - alignment: Alignment.center, - child: PlatformInfos.platformCanRecord && - controller.sendController.text.isEmpty - ? FloatingActionButton.small( - tooltip: L10n.of(context).voiceMessage, - onPressed: controller.voiceMessageAction, - elevation: 0, - heroTag: null, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(height), - ), - backgroundColor: theme.bubbleColor, - foregroundColor: theme.onBubbleColor, - child: const Icon(Icons.mic_none_outlined), - ) - : FloatingActionButton.small( - tooltip: L10n.of(context).send, - onPressed: controller.send, - elevation: 0, - heroTag: null, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(height), - ), - backgroundColor: theme.bubbleColor, - foregroundColor: theme.onBubbleColor, - child: const Icon(Icons.send_outlined), - ), + PopupMenuItem( + value: 'file', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.attachment_outlined), + ), + title: Text(L10n.of(context).sendFile), + contentPadding: const EdgeInsets.all(0), + ), ), ], + ), + ), + if (PlatformInfos.isMobile) + AnimatedContainer( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + width: controller.sendController.text.isNotEmpty ? 0 : height, + height: height, + alignment: Alignment.center, + decoration: const BoxDecoration(), + clipBehavior: Clip.hardEdge, + child: PopupMenuButton( + enabled: !controller.selectMode, + useRootNavigator: true, + icon: const Icon(Icons.camera_alt_outlined), + onSelected: controller.onAddPopupMenuButtonSelected, + iconColor: theme.colorScheme.onPrimaryContainer, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'camera-video', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.videocam_outlined), + ), + title: Text(L10n.of(context).recordAVideo), + contentPadding: const EdgeInsets.all(0), + ), + ), + PopupMenuItem( + value: 'camera', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.camera_alt_outlined), + ), + title: Text(L10n.of(context).takeAPhoto), + contentPadding: const EdgeInsets.all(0), + ), + ), + ], + ), + ), + Container( + height: height, + width: height, + alignment: Alignment.center, + child: IconButton( + tooltip: L10n.of(context).emojis, + color: theme.colorScheme.onPrimaryContainer, + icon: PageTransitionSwitcher( + transitionBuilder: ( + Widget child, + Animation primaryAnimation, + Animation secondaryAnimation, + ) { + return SharedAxisTransition( + animation: primaryAnimation, + secondaryAnimation: secondaryAnimation, + transitionType: SharedAxisTransitionType.scaled, + fillColor: Colors.transparent, + child: child, + ); + }, + child: Icon( + controller.showEmojiPicker + ? Icons.keyboard + : Icons.add_reaction_outlined, + key: ValueKey(controller.showEmojiPicker), + ), + ), + onPressed: + controller.selectMode ? null : controller.emojiPickerAction, + ), + ), + if (Matrix.of(context).isMultiAccount && + Matrix.of(context).hasComplexBundles && + Matrix.of(context).currentBundle!.length > 1) + Container( + width: height, + height: height, + alignment: Alignment.center, + child: _ChatAccountPicker(controller), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 0.0), + child: InputBar( + room: controller.room, + minLines: 1, + readOnly: controller.selectMode, + maxLines: 8, + autofocus: !PlatformInfos.isMobile, + keyboardType: TextInputType.multiline, + textInputAction: + AppConfig.sendOnEnter == true && PlatformInfos.isMobile + ? TextInputAction.send + : null, + onSubmitted: controller.onInputBarSubmitted, + onSubmitImage: controller.sendImageFromClipBoard, + focusNode: controller.inputFocus, + controller: controller.sendController, + decoration: InputDecoration( + contentPadding: const EdgeInsets.only( + left: 6.0, + right: 6.0, + bottom: 6.0, + top: 3.0, + ), + hintText: L10n.of(context).writeAMessage, + hintMaxLines: 1, + border: InputBorder.none, + enabledBorder: InputBorder.none, + filled: false, + ), + onChanged: controller.onInputBarChanged, + ), + ), + ), + Opacity( + opacity: controller.selectMode ? 0.66 : 1, + child: Container( + height: height, + width: height, + alignment: Alignment.center, + child: PlatformInfos.platformCanRecord && + controller.sendController.text.isEmpty + ? FloatingActionButton.small( + tooltip: L10n.of(context).voiceMessage, + onPressed: controller.selectMode + ? null + : controller.voiceMessageAction, + elevation: 0, + heroTag: null, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(height), + ), + backgroundColor: theme.bubbleColor, + foregroundColor: theme.onBubbleColor, + child: const Icon(Icons.mic_none_outlined), + ) + : FloatingActionButton.small( + tooltip: L10n.of(context).send, + onPressed: controller.selectMode ? null : controller.send, + elevation: 0, + heroTag: null, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(height), + ), + backgroundColor: theme.bubbleColor, + foregroundColor: theme.onBubbleColor, + child: const Icon(Icons.send_outlined), + ), + ), + ), + ], ); } } diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index beee6fc3f..1ff98a7b3 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -15,7 +15,6 @@ import 'package:fluffychat/pages/chat/chat_app_bar_title.dart'; import 'package:fluffychat/pages/chat/chat_event_list.dart'; import 'package:fluffychat/pages/chat/encryption_button.dart'; import 'package:fluffychat/pages/chat/pinned_events.dart'; -import 'package:fluffychat/pages/chat/reactions_picker.dart'; import 'package:fluffychat/pages/chat/reply_display.dart'; import 'package:fluffychat/utils/account_config.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart'; @@ -38,12 +37,6 @@ class ChatView extends StatelessWidget { List _appBarActions(BuildContext context) { if (controller.selectMode) { return [ - if (controller.canEditSelectedEvents) - IconButton( - icon: const Icon(Icons.edit_outlined), - tooltip: L10n.of(context).edit, - onPressed: controller.editSelectedEventAction, - ), IconButton( icon: const Icon(Icons.copy_outlined), tooltip: L10n.of(context).copy, @@ -353,7 +346,6 @@ class ChatView extends StatelessWidget { : Column( mainAxisSize: MainAxisSize.min, children: [ - ReactionsPicker(controller), ReplyDisplay(controller), ChatInputRow(controller), ChatEmojiPicker(controller), diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 4be9de869..906a3fe64 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -3,6 +3,7 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; import 'package:matrix/matrix.dart'; import 'package:swipe_to_action/swipe_to_action.dart'; @@ -31,8 +32,10 @@ class Message extends StatelessWidget { final void Function(String) scrollToEventId; final void Function() onSwipe; final void Function() onMention; + final void Function() onEdit; final bool longPressSelect; final bool selected; + final bool singleSelected; final Timeline timeline; final bool highlightMarker; final bool animateIn; @@ -52,6 +55,8 @@ class Message extends StatelessWidget { required this.scrollToEventId, required this.onSwipe, this.selected = false, + required this.onEdit, + required this.singleSelected, required this.timeline, this.highlightMarker = false, this.animateIn = false, @@ -157,417 +162,30 @@ class Message extends StatelessWidget { final resetAnimateIn = this.resetAnimateIn; var animateIn = this.animateIn; - final row = StatefulBuilder( - builder: (context, setState) { - if (animateIn && resetAnimateIn != null) { - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - animateIn = false; - setState(resetAnimateIn); - }); - } - return AnimatedSize( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - clipBehavior: Clip.none, - alignment: ownMessage ? Alignment.bottomRight : Alignment.bottomLeft, - child: animateIn - ? const SizedBox(height: 0, width: double.infinity) - : Stack( - children: [ - Positioned( - top: 0, - bottom: 0, - left: 0, - right: 0, - child: InkWell( - onTap: () => onSelect(event), - onLongPress: () => onSelect(event), - borderRadius: - BorderRadius.circular(AppConfig.borderRadius / 2), - child: Material( - borderRadius: - BorderRadius.circular(AppConfig.borderRadius / 2), - color: selected || highlightMarker - ? theme.colorScheme.secondaryContainer - .withAlpha(128) - : Colors.transparent, - ), - ), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: rowMainAxisAlignment, - children: [ - if (longPressSelect) - SizedBox( - height: 32, - width: Avatar.defaultSize, - child: Checkbox.adaptive( - value: selected, - shape: const CircleBorder(), - onChanged: (_) => onSelect(event), - ), - ) - else if (nextEventSameSender || ownMessage) - SizedBox( - width: Avatar.defaultSize, - child: Center( - child: SizedBox( - width: 16, - height: 16, - child: event.status == EventStatus.error - ? const Icon(Icons.error, color: Colors.red) - : event.fileSendingStatus != null - ? const CircularProgressIndicator - .adaptive( - strokeWidth: 1, - ) - : null, - ), - ), - ) - else - FutureBuilder( - future: event.fetchSenderUser(), - builder: (context, snapshot) { - final user = snapshot.data ?? - event.senderFromMemoryOrFallback; - return Avatar( - mxContent: user.avatarUrl, - name: user.calcDisplayname(), - onTap: () => showMemberActionsPopupMenu( - context: context, - user: user, - onMention: onMention, - ), - presenceUserId: user.stateKey, - presenceBackgroundColor: - wallpaperMode ? Colors.transparent : null, - ); - }, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - if (!nextEventSameSender) - Padding( - padding: const EdgeInsets.only( - left: 8.0, - bottom: 4, - ), - child: ownMessage || event.room.isDirectChat - ? const SizedBox(height: 12) - : FutureBuilder( - future: event.fetchSenderUser(), - builder: (context, snapshot) { - final displayname = snapshot.data - ?.calcDisplayname() ?? - event.senderFromMemoryOrFallback - .calcDisplayname(); - return Text( - displayname, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.bold, - color: (theme.brightness == - Brightness.light - ? displayname.color - : displayname - .lightColorText), - shadows: !wallpaperMode - ? null - : [ - const Shadow( - offset: Offset( - 0.0, - 0.0, - ), - blurRadius: 3, - color: Colors.black, - ), - ], - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ); - }, - ), - ), - Container( - alignment: alignment, - padding: const EdgeInsets.only(left: 8), - child: GestureDetector( - onLongPress: longPressSelect - ? null - : () { - HapticFeedback.heavyImpact(); - onSelect(event); - }, - child: AnimatedOpacity( - opacity: animateIn - ? 0 - : event.messageType == - MessageTypes.BadEncrypted || - event.status.isSending - ? 0.5 - : 1, - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - child: Container( - decoration: BoxDecoration( - color: noBubble - ? Colors.transparent - : color, - borderRadius: borderRadius, - ), - clipBehavior: Clip.antiAlias, - child: BubbleBackground( - colors: colors, - ignore: noBubble || !ownMessage, - scrollController: scrollController, - child: Container( - 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( - future: event - .getReplyEvent(timeline), - builder: ( - BuildContext context, - snapshot, - ) { - final replyEvent = snapshot - .hasData - ? snapshot.data! - : Event( - eventId: event - .relationshipEventId!, - content: { - 'msgtype': - 'm.text', - 'body': '...', - }, - senderId: - event.senderId, - type: - 'm.room.message', - room: event.room, - status: EventStatus - .sent, - originServerTs: - DateTime.now(), - ); - 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, - ), - 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, - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ); - }, - ); - Widget container; + final sentReactions = {}; + if (singleSelected) { + sentReactions.addAll( + event + .aggregatedEvents( + timeline, + RelationshipTypes.reaction, + ) + .where( + (event) => + event.senderId == event.room.client.userID && + event.type == 'm.reaction', + ) + .map( + (event) => event.content + .tryGetMap('m.relates_to') + ?.tryGet('key'), + ) + .whereType(), + ); + } + final showReceiptsRow = event.hasAggregatedEvents(timeline, RelationshipTypes.reaction); - if (showReceiptsRow || displayTime || selected || displayReadMarker) { - container = Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - ownMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start, - children: [ - if (displayTime || selected) - Padding( - padding: displayTime - ? const EdgeInsets.symmetric(vertical: 8.0) - : EdgeInsets.zero, - child: Center( - child: Padding( - padding: const EdgeInsets.only(top: 4.0), - child: Material( - borderRadius: - BorderRadius.circular(AppConfig.borderRadius * 2), - color: theme.colorScheme.surface.withAlpha(128), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0, - vertical: 2.0, - ), - child: Text( - event.originServerTs.localizedTime(context), - style: TextStyle( - fontSize: 12 * AppConfig.fontSizeFactor, - fontWeight: FontWeight.bold, - color: theme.colorScheme.secondary, - ), - ), - ), - ), - ), - ), - ), - row, - AnimatedSize( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - child: !showReceiptsRow - ? const SizedBox.shrink() - : Padding( - padding: EdgeInsets.only( - top: 4.0, - left: (ownMessage ? 0 : Avatar.defaultSize) + 12.0, - right: ownMessage ? 0 : 12.0, - ), - child: MessageReactions(event, timeline), - ), - ), - if (displayReadMarker) - Row( - children: [ - Expanded( - child: - Divider(color: theme.colorScheme.surfaceContainerHighest), - ), - Container( - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 16.0, - ), - padding: const EdgeInsets.symmetric( - horizontal: 8, - vertical: 2, - ), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(AppConfig.borderRadius / 3), - color: theme.colorScheme.surface.withAlpha(128), - ), - child: Text( - L10n.of(context).readUpToHere, - style: TextStyle( - fontSize: 12 * AppConfig.fontSizeFactor, - ), - ), - ), - Expanded( - child: - Divider(color: theme.colorScheme.surfaceContainerHighest), - ), - ], - ), - ], - ); - } else { - container = row; - } return Center( child: Swipeable( @@ -592,7 +210,620 @@ class Message extends StatelessWidget { top: nextEventSameSender ? 1.0 : 4.0, bottom: previousEventSameSender ? 1.0 : 4.0, ), - child: container, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + ownMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start, + children: [ + if (displayTime || selected) + Padding( + padding: displayTime + ? const EdgeInsets.symmetric(vertical: 8.0) + : EdgeInsets.zero, + child: Center( + child: Padding( + padding: const EdgeInsets.only(top: 4.0), + child: Material( + borderRadius: + BorderRadius.circular(AppConfig.borderRadius * 2), + color: theme.colorScheme.surface.withAlpha(128), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0, + vertical: 2.0, + ), + child: Text( + event.originServerTs.localizedTime(context), + style: TextStyle( + fontSize: 12 * AppConfig.fontSizeFactor, + fontWeight: FontWeight.bold, + color: theme.colorScheme.secondary, + ), + ), + ), + ), + ), + ), + ), + StatefulBuilder( + builder: (context, setState) { + if (animateIn && resetAnimateIn != null) { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + animateIn = false; + setState(resetAnimateIn); + }); + } + return AnimatedSize( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + clipBehavior: Clip.none, + alignment: ownMessage + ? Alignment.bottomRight + : Alignment.bottomLeft, + child: animateIn + ? const SizedBox(height: 0, width: double.infinity) + : Stack( + children: [ + Positioned( + top: 0, + bottom: 0, + left: 0, + right: 0, + child: InkWell( + onTap: () => onSelect(event), + onLongPress: () => onSelect(event), + borderRadius: BorderRadius.circular( + AppConfig.borderRadius / 2, + ), + child: Material( + borderRadius: BorderRadius.circular( + AppConfig.borderRadius / 2, + ), + color: selected || highlightMarker + ? theme.colorScheme.secondaryContainer + .withAlpha(128) + : Colors.transparent, + ), + ), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: rowMainAxisAlignment, + children: [ + if (longPressSelect) + SizedBox( + height: 32, + width: Avatar.defaultSize, + child: IconButton( + padding: EdgeInsets.zero, + icon: Icon( + selected + ? Icons.check_circle + : Icons.circle_outlined, + ), + onPressed: () => onSelect(event), + ), + ) + else if (nextEventSameSender || ownMessage) + SizedBox( + width: Avatar.defaultSize, + child: Center( + child: SizedBox( + width: 16, + height: 16, + child: event.status == + EventStatus.error + ? const Icon( + Icons.error, + color: Colors.red, + ) + : event.fileSendingStatus != null + ? const CircularProgressIndicator + .adaptive( + strokeWidth: 1, + ) + : null, + ), + ), + ) + else + FutureBuilder( + future: event.fetchSenderUser(), + builder: (context, snapshot) { + final user = snapshot.data ?? + event.senderFromMemoryOrFallback; + return Avatar( + mxContent: user.avatarUrl, + name: user.calcDisplayname(), + onTap: () => + showMemberActionsPopupMenu( + context: context, + user: user, + onMention: onMention, + ), + presenceUserId: user.stateKey, + presenceBackgroundColor: wallpaperMode + ? Colors.transparent + : null, + ); + }, + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (!nextEventSameSender) + Padding( + padding: const EdgeInsets.only( + left: 8.0, + bottom: 4, + ), + child: ownMessage || + event.room.isDirectChat + ? const SizedBox(height: 12) + : FutureBuilder( + future: + event.fetchSenderUser(), + builder: + (context, snapshot) { + final displayname = snapshot + .data + ?.calcDisplayname() ?? + event + .senderFromMemoryOrFallback + .calcDisplayname(); + return Text( + displayname, + style: TextStyle( + fontSize: 11, + fontWeight: + FontWeight.bold, + color: (theme.brightness == + Brightness + .light + ? displayname + .color + : displayname + .lightColorText), + shadows: + !wallpaperMode + ? null + : [ + const Shadow( + offset: + Offset( + 0.0, + 0.0, + ), + blurRadius: + 3, + color: Colors + .black, + ), + ], + ), + maxLines: 1, + overflow: TextOverflow + .ellipsis, + ); + }, + ), + ), + Container( + alignment: alignment, + padding: + const EdgeInsets.only(left: 8), + child: GestureDetector( + onLongPress: longPressSelect + ? null + : () { + HapticFeedback + .heavyImpact(); + onSelect(event); + }, + child: AnimatedOpacity( + opacity: animateIn + ? 0 + : event.messageType == + MessageTypes + .BadEncrypted || + event.status.isSending + ? 0.5 + : 1, + duration: FluffyThemes + .animationDuration, + curve: + FluffyThemes.animationCurve, + child: Container( + decoration: BoxDecoration( + color: noBubble + ? Colors.transparent + : color, + borderRadius: borderRadius, + ), + clipBehavior: Clip.antiAlias, + child: BubbleBackground( + colors: colors, + ignore: + noBubble || !ownMessage, + scrollController: + scrollController, + child: Container( + 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( + future: event + .getReplyEvent( + timeline, + ), + builder: ( + BuildContext + context, + snapshot, + ) { + final replyEvent = + snapshot + .hasData + ? snapshot + .data! + : Event( + eventId: + event.relationshipEventId!, + content: { + 'msgtype': + 'm.text', + 'body': + '...', + }, + senderId: + event.senderId, + type: + 'm.room.message', + room: + event.room, + status: + EventStatus.sent, + originServerTs: + DateTime.now(), + ); + 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, + ), + 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, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ); + }, + ), + Padding( + padding: const EdgeInsets.only(left: Avatar.defaultSize + 8.0), + child: AnimatedSize( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + alignment: Alignment.bottomCenter, + child: singleSelected && event.room.canSendDefaultMessages + ? Padding( + padding: const EdgeInsets.only(bottom: 4.0), + child: Material( + elevation: 4, + borderRadius: + BorderRadius.circular(AppConfig.borderRadius), + shadowColor: theme.appBarTheme.shadowColor, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.reply_outlined), + tooltip: L10n.of(context).reply, + onPressed: onSwipe, + ), + if (ownMessage) + IconButton( + icon: const Icon(Icons.edit_outlined), + tooltip: L10n.of(context).edit, + onPressed: onEdit, + ), + IconButton( + icon: const Icon(Icons.add_reaction_outlined), + tooltip: L10n.of(context).customReaction, + onPressed: () async { + final emoji = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: Row( + mainAxisSize: MainAxisSize.min, + spacing: 4, + children: [ + CloseButton( + onPressed: () => + Navigator.of(context) + .pop(null), + ), + Text( + L10n.of(context).customReaction, + ), + ], + ), + titlePadding: const EdgeInsets.all(8), + contentPadding: const EdgeInsets.all(0), + clipBehavior: Clip.hardEdge, + content: SizedBox( + width: 350, + height: 350, + child: EmojiPicker( + onEmojiSelected: (_, emoji) => + Navigator.of(context) + .pop(emoji.emoji), + config: Config( + emojiViewConfig: + const EmojiViewConfig( + backgroundColor: + Colors.transparent, + ), + bottomActionBarConfig: + const BottomActionBarConfig( + enabled: false, + ), + categoryViewConfig: + CategoryViewConfig( + initCategory: Category.SMILEYS, + backspaceColor: + theme.colorScheme.primary, + iconColor: theme + .colorScheme.primary + .withAlpha(128), + iconColorSelected: + theme.colorScheme.primary, + indicatorColor: + theme.colorScheme.primary, + backgroundColor: + theme.colorScheme.surface, + ), + skinToneConfig: SkinToneConfig( + dialogBackgroundColor: + Color.lerp( + theme.colorScheme.surface, + theme.colorScheme + .primaryContainer, + 0.75, + )!, + indicatorColor: + theme.colorScheme.onSurface, + ), + ), + ), + ), + ), + ); + if (emoji == null) return; + if (sentReactions.contains(emoji)) return; + + await event.room.sendReaction( + event.eventId, + emoji, + ); + }, + ), + ...AppConfig.defaultReactions.map( + (emoji) => IconButton( + padding: EdgeInsets.zero, + icon: Center( + child: Opacity( + opacity: sentReactions.contains(emoji) + ? 0.33 + : 1, + child: Text( + emoji, + style: const TextStyle(fontSize: 20), + textAlign: TextAlign.center, + ), + ), + ), + onPressed: sentReactions.contains(emoji) + ? null + : () { + onSelect(event); + event.room.sendReaction( + event.eventId, + emoji, + ); + }, + ), + ), + ], + ), + ), + ) + : const SizedBox.shrink(), + ), + ), + AnimatedSize( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + child: !showReceiptsRow + ? const SizedBox.shrink() + : Padding( + padding: EdgeInsets.only( + top: 4.0, + left: (ownMessage ? 0 : Avatar.defaultSize) + 12.0, + right: ownMessage ? 0 : 12.0, + ), + child: MessageReactions(event, timeline), + ), + ), + if (displayReadMarker) + Row( + children: [ + Expanded( + child: Divider( + color: theme.colorScheme.surfaceContainerHighest, + ), + ), + Container( + margin: const EdgeInsets.symmetric( + horizontal: 4, + vertical: 16.0, + ), + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 2, + ), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(AppConfig.borderRadius / 3), + color: theme.colorScheme.surface.withAlpha(128), + ), + child: Text( + L10n.of(context).readUpToHere, + style: TextStyle( + fontSize: 12 * AppConfig.fontSizeFactor, + ), + ), + ), + Expanded( + child: Divider( + color: theme.colorScheme.surfaceContainerHighest, + ), + ), + ], + ), + ], + ), ), ), ); diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index ed23ffd30..5ec4c98a9 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -406,6 +406,7 @@ class InputBar extends StatelessWidget { builder: (context, controller, focusNode) => TextField( controller: controller, focusNode: focusNode, + readOnly: readOnly, contextMenuBuilder: (c, e) => markdownContextBuilder(c, e, controller), contentInsertionConfiguration: ContentInsertionConfiguration( onContentInserted: (KeyboardInsertedContent content) { diff --git a/lib/pages/chat/reactions_picker.dart b/lib/pages/chat/reactions_picker.dart deleted file mode 100644 index 2610a0d50..000000000 --- a/lib/pages/chat/reactions_picker.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:matrix/matrix.dart'; - -import 'package:fluffychat/config/app_config.dart'; -import 'package:fluffychat/config/app_emojis.dart'; -import 'package:fluffychat/pages/chat/chat.dart'; -import '../../config/themes.dart'; - -class ReactionsPicker extends StatelessWidget { - final ChatController controller; - - const ReactionsPicker(this.controller, {super.key}); - - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - - if (controller.showEmojiPicker) return const SizedBox.shrink(); - final display = controller.editEvent == null && - controller.replyEvent == null && - controller.room.canSendDefaultMessages && - controller.selectedEvents.isNotEmpty; - return AnimatedContainer( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - height: (display) ? 56 : 0, - child: Material( - color: Colors.transparent, - child: Builder( - builder: (context) { - if (!display) { - return const SizedBox.shrink(); - } - final emojis = List.from(AppEmojis.emojis); - final allReactionEvents = controller.selectedEvents.first - .aggregatedEvents( - controller.timeline!, - RelationshipTypes.reaction, - ) - .where( - (event) => - event.senderId == event.room.client.userID && - event.type == 'm.reaction', - ); - - for (final event in allReactionEvents) { - try { - emojis.remove(event.content.tryGetMap('m.relates_to')!['key']); - } catch (_) {} - } - return Row( - children: [ - Expanded( - child: Container( - decoration: BoxDecoration( - color: theme.colorScheme.onInverseSurface, - borderRadius: const BorderRadius.only( - bottomRight: Radius.circular(AppConfig.borderRadius), - ), - ), - padding: const EdgeInsets.only(right: 1), - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: emojis.length, - itemBuilder: (c, i) => InkWell( - borderRadius: BorderRadius.circular(8), - onTap: () => controller.sendEmojiAction(emojis[i]), - child: Container( - width: 56, - height: 56, - alignment: Alignment.center, - child: Text( - emojis[i], - style: const TextStyle(fontSize: 30), - ), - ), - ), - ), - ), - ), - InkWell( - borderRadius: BorderRadius.circular(8), - child: Container( - margin: const EdgeInsets.symmetric(horizontal: 8), - width: 36, - height: 56, - decoration: BoxDecoration( - color: theme.colorScheme.onInverseSurface, - shape: BoxShape.circle, - ), - child: const Icon(Icons.add_outlined), - ), - onTap: () => - controller.pickEmojiReactionAction(allReactionEvents), - ), - ], - ); - }, - ), - ), - ); - } -} diff --git a/lib/utils/show_scaffold_dialog.dart b/lib/utils/show_scaffold_dialog.dart index 0c09a7037..9a0a0c610 100644 --- a/lib/utils/show_scaffold_dialog.dart +++ b/lib/utils/show_scaffold_dialog.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/themes.dart'; -Future showScaffoldDialog({ +Future showScaffoldDialog({ required BuildContext context, Color? barrierColor, Color? containerColor, @@ -11,7 +11,7 @@ Future showScaffoldDialog({ double maxHeight = 720, required Widget Function(BuildContext context) builder, }) => - showDialog( + showDialog( context: context, useSafeArea: false, builder: FluffyThemes.isColumnMode(context)