diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index ea14cc600..f978330c1 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -378,13 +378,6 @@ class ChatController extends State setState(() {}); } - // #Pangea - void closeEmojiPicker() { - showEmojiPicker = false; - updateView(); - } - // Pangea# - Future? loadTimelineFuture; int? animateInEventIndex; diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index 3f424ab37..a59bba609 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -14,6 +14,9 @@ class ChatEmojiPicker extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); + // #Pangea + final bool lightMode = Theme.of(context).brightness == Brightness.light; + // Pangea# return AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, @@ -23,68 +26,103 @@ class ChatEmojiPicker extends StatelessWidget { ? MediaQuery.of(context).size.height / 2 : 0, child: controller.showEmojiPicker - ? DefaultTabController( - length: 2, - child: Column( - children: [ - TabBar( - tabs: [ - Tab(text: L10n.of(context)!.emojis), - Tab(text: L10n.of(context)!.stickers), + ? + // #Pangea + Stack( + children: [ + // Pangea# + DefaultTabController( + length: 2, + child: Column( + children: [ + TabBar( + tabs: [ + Tab(text: L10n.of(context)!.emojis), + Tab(text: L10n.of(context)!.stickers), + ], + ), + Expanded( + child: TabBarView( + children: [ + EmojiPicker( + onEmojiSelected: controller.onEmojiSelected, + onBackspacePressed: + controller.emojiPickerBackspace, + config: Config( + emojiViewConfig: EmojiViewConfig( + noRecents: const NoRecent(), + backgroundColor: Theme.of(context) + .colorScheme + .onInverseSurface, + ), + bottomActionBarConfig: + const BottomActionBarConfig( + enabled: false, + ), + categoryViewConfig: CategoryViewConfig( + backspaceColor: theme.colorScheme.primary, + iconColor: theme.colorScheme.primary + .withOpacity(0.5), + iconColorSelected: theme.colorScheme.primary, + indicatorColor: theme.colorScheme.primary, + ), + skinToneConfig: SkinToneConfig( + dialogBackgroundColor: Color.lerp( + theme.colorScheme.surface, + theme.colorScheme.primaryContainer, + 0.75, + )!, + indicatorColor: theme.colorScheme.onSurface, + ), + ), + ), + StickerPickerDialog( + room: controller.room, + onSelected: (sticker) { + controller.room.sendEvent( + { + 'body': sticker.body, + 'info': sticker.info ?? {}, + 'url': sticker.url.toString(), + }, + type: EventTypes.Sticker, + ); + controller.hideEmojiPicker(); + }, + ), + ], + ), + ), ], ), - Expanded( - child: TabBarView( - children: [ - EmojiPicker( - onEmojiSelected: controller.onEmojiSelected, - onBackspacePressed: controller.emojiPickerBackspace, - config: Config( - emojiViewConfig: EmojiViewConfig( - noRecents: const NoRecent(), - backgroundColor: Theme.of(context) - .colorScheme - .onInverseSurface, - ), - bottomActionBarConfig: const BottomActionBarConfig( - enabled: false, - ), - categoryViewConfig: CategoryViewConfig( - backspaceColor: theme.colorScheme.primary, - iconColor: - theme.colorScheme.primary.withOpacity(0.5), - iconColorSelected: theme.colorScheme.primary, - indicatorColor: theme.colorScheme.primary, - ), - skinToneConfig: SkinToneConfig( - dialogBackgroundColor: Color.lerp( - theme.colorScheme.surface, - theme.colorScheme.primaryContainer, - 0.75, - )!, - indicatorColor: theme.colorScheme.onSurface, - ), - ), + ), + // #Pangea + // Close button placed at bottom of emoji picker + Positioned( + left: 0, + right: 0, + bottom: 5, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FloatingActionButton( + onPressed: controller.hideEmojiPicker, + backgroundColor: lightMode + ? const Color.fromARGB(255, 211, 211, 211) + : Colors.black, + shape: const CircleBorder(), + heroTag: null, + mini: true, + child: const Icon( + Icons.close, + size: 20, ), - 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# + ], ) : null, ); diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index 0b03441d1..64d70b60e 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -350,7 +350,16 @@ class ChatView extends StatelessWidget { ITBar( choreographer: controller.choreographer, ), - ReplyDisplay(controller), + Row( + // crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + ReplyDisplay(controller), + ], + ), ], ), ), @@ -481,29 +490,6 @@ class ChatView extends StatelessWidget { right: 0, child: ChatEmojiPicker(controller), ), - // Close button placed at bottom of emoji picker - if (controller.showEmojiPicker) - Positioned( - left: 0, - right: 0, - bottom: 5, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FloatingActionButton( - onPressed: controller.closeEmojiPicker, - backgroundColor: Colors.black, - shape: const CircleBorder(), - heroTag: null, - mini: true, - child: const Icon( - Icons.close, - size: 20, - ), - ), - ], - ), - ), // Pangea# ], ), diff --git a/lib/pages/chat/events/reply_content.dart b/lib/pages/chat/events/reply_content.dart index 945ae22ac..b48f16cd9 100644 --- a/lib/pages/chat/events/reply_content.dart +++ b/lib/pages/chat/events/reply_content.dart @@ -1,9 +1,8 @@ +import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:flutter/material.dart'; - import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:matrix/matrix.dart'; -import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import '../../../config/app_config.dart'; class ReplyContent extends StatelessWidget { diff --git a/lib/pages/chat/reply_display.dart b/lib/pages/chat/reply_display.dart index b2b7ca0bb..a6bec6bbb 100644 --- a/lib/pages/chat/reply_display.dart +++ b/lib/pages/chat/reply_display.dart @@ -13,35 +13,40 @@ class ReplyDisplay extends StatelessWidget { @override Widget build(BuildContext context) { - return AnimatedContainer( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - height: controller.editEvent != null || controller.replyEvent != null - ? 56 - : 0, - clipBehavior: Clip.hardEdge, - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.onInverseSurface, - ), - child: Row( - children: [ - IconButton( - tooltip: L10n.of(context)!.close, - icon: const Icon(Icons.close), - onPressed: controller.cancelReplyEventAction, - ), - Expanded( - child: controller.replyEvent != null - ? ReplyContent( - controller.replyEvent!, - timeline: controller.timeline!, - backgroundColor: Colors.transparent, - ) - : _EditContent( - controller.editEvent?.getDisplayEvent(controller.timeline!), - ), - ), - ], + return Padding( + padding: const EdgeInsets.all(8.0), + child: AnimatedContainer( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + height: controller.editEvent != null || controller.replyEvent != null + ? 56 + : 0, + clipBehavior: Clip.hardEdge, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(28.0)), + color: Theme.of(context).colorScheme.onInverseSurface, + ), + child: Row( + children: [ + IconButton( + tooltip: L10n.of(context)!.close, + icon: const Icon(Icons.close), + onPressed: controller.cancelReplyEventAction, + ), + Expanded( + child: controller.replyEvent != null + ? ReplyContent( + controller.replyEvent!, + timeline: controller.timeline!, + backgroundColor: Colors.transparent, + ) + : _EditContent( + controller.editEvent + ?.getDisplayEvent(controller.timeline!), + ), + ), + ], + ), ), ); }