From 42ced399aa10c58e80b89a078daead3fa2b3db51 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Fri, 26 Jul 2024 11:36:36 -0400 Subject: [PATCH] some simplifications of input bar stack --- lib/pages/chat/chat_emoji_picker.dart | 163 +++++++++++--------------- lib/pages/chat/chat_view.dart | 17 +-- lib/pages/chat/reply_display.dart | 34 ++---- 3 files changed, 85 insertions(+), 129 deletions(-) diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index a59bba609..f38243b84 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -14,9 +14,6 @@ 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, @@ -26,103 +23,79 @@ class ChatEmojiPicker extends StatelessWidget { ? MediaQuery.of(context).size.height / 2 : 0, child: controller.showEmojiPicker - ? - // #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, - ), - ), + ? 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, ), - StickerPickerDialog( - room: controller.room, - onSelected: (sticker) { - controller.room.sendEvent( - { - 'body': sticker.body, - 'info': sticker.info ?? {}, - 'url': sticker.url.toString(), - }, - type: EventTypes.Sticker, - ); - controller.hideEmojiPicker(); + 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(); + }, ), - ), - ], + ], + ), ), - ), - // #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, - ), - ), - ], + // #Pangea + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: FloatingActionButton( + onPressed: controller.hideEmojiPicker, + shape: const CircleBorder(), + mini: true, + child: const Icon(Icons.close), + ), ), - ), - // Pangea# - ], + // Pangea# + ], + ), ) : null, ); diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index 25e990c32..ff4ba7015 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -446,17 +446,17 @@ class ChatView extends StatelessWidget { Positioned( left: 0, right: 0, - bottom: 13, + bottom: 16, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ if (!controller.selectMode) Container( - margin: const EdgeInsets.only( - bottom: 7, - left: 11, - right: 11, + margin: EdgeInsets.only( + bottom: 10, + left: bottomSheetPadding, + right: bottomSheetPadding, ), constraints: const BoxConstraints( maxWidth: FluffyThemes.columnWidth * 2.4, @@ -500,6 +500,7 @@ class ChatView extends StatelessWidget { ReactionsPicker(controller), ReplyDisplay(controller), ChatInputRow(controller), + ChatEmojiPicker(controller), ], ), ), @@ -507,12 +508,6 @@ class ChatView extends StatelessWidget { ], ), ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: ChatEmojiPicker(controller), - ), // Pangea# ], ), diff --git a/lib/pages/chat/reply_display.dart b/lib/pages/chat/reply_display.dart index f05c749a2..e2bacac83 100644 --- a/lib/pages/chat/reply_display.dart +++ b/lib/pages/chat/reply_display.dart @@ -21,9 +21,6 @@ class ReplyDisplay extends StatelessWidget { : 0, clipBehavior: Clip.hardEdge, decoration: BoxDecoration( - // #Pangea - borderRadius: const BorderRadius.all(Radius.circular(28.0)), - // Pangea# color: Theme.of(context).colorScheme.onInverseSurface, ), child: Row( @@ -67,28 +64,19 @@ class _EditContent extends StatelessWidget { Icons.edit, color: Theme.of(context).colorScheme.primary, ), - // #Pangea - // Container(width: 15.0), - Container(width: 8.0), - Flexible( - child: - // Pangea# - Text( - event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - withSenderNamePrefix: false, - hideReply: true, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: Theme.of(context).textTheme.bodyMedium!.color, - ), + Container(width: 15.0), + Text( + event.calcLocalizedBodyFallback( + MatrixLocals(L10n.of(context)!), + withSenderNamePrefix: false, + hideReply: true, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Theme.of(context).textTheme.bodyMedium!.color, ), ), - // #Pangea - Container(width: 10.0), - // Pangea# ], ); }