From bb1c1f455d042513e52cf60f6583326027a7f597 Mon Sep 17 00:00:00 2001 From: Janez T Date: Sat, 7 Mar 2026 08:31:09 +0100 Subject: [PATCH] Refine message composer layout --- lib/screens/messages_tab.dart | 46 ++++++++++++--------- lib/widgets/messages/messages_composer.dart | 2 +- lib/widgets/messages/messages_content.dart | 11 ++++- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/lib/screens/messages_tab.dart b/lib/screens/messages_tab.dart index bac5a64..39742ed 100644 --- a/lib/screens/messages_tab.dart +++ b/lib/screens/messages_tab.dart @@ -49,6 +49,7 @@ class MessagesTab extends StatefulWidget { class _MessagesTabState extends State { static const int _maxContactMessageBytes = 156; static const int _maxChannelMessageBytes = 127; + static const double _composerOverlayHeight = 148; final TextEditingController _textController = TextEditingController(); final FocusNode _focusNode = FocusNode(); @@ -1546,35 +1547,42 @@ class _MessagesTabState extends State { return GestureDetector( behavior: HitTestBehavior.translucent, onTap: () => FocusScope.of(context).unfocus(), - child: Column( + child: Stack( children: [ - Expanded( + Positioned.fill( child: MessagesContent( messages: messages, scrollController: _scrollController, highlightedMessageId: _highlightedMessageId, + bottomContentPadding: + _composerOverlayHeight + composerBottomPadding, onRefresh: _handleRefresh, onNavigateToMap: widget.onNavigateToMap, onMessageTap: _handleMessageTap, ), ), - MessagesComposer( - textController: _textController, - focusNode: _focusNode, - messageByteLimiter: _messageByteLimiter, - messageByteCount: _messageByteCount, - maxMessageBytes: _maxMessageBytes, - isRecording: _isRecording, - isSendingVoice: _isSendingVoice, - voiceSupported: _voiceSupported, - bottomPadding: composerBottomPadding, - destinationLabel: _getDestinationLabel(), - destinationAvatar: _buildDestinationAvatar(context), - onShowComposerActions: _showComposerActions, - onShowRecipientSelector: _showRecipientSelector, - onStartVoiceRecording: _startVoiceRecording, - onStopAndSendVoice: _stopAndSendVoice, - onSendMessage: _sendMessage, + Positioned( + left: 0, + right: 0, + bottom: 0, + child: MessagesComposer( + textController: _textController, + focusNode: _focusNode, + messageByteLimiter: _messageByteLimiter, + messageByteCount: _messageByteCount, + maxMessageBytes: _maxMessageBytes, + isRecording: _isRecording, + isSendingVoice: _isSendingVoice, + voiceSupported: _voiceSupported, + bottomPadding: composerBottomPadding, + destinationLabel: _getDestinationLabel(), + destinationAvatar: _buildDestinationAvatar(context), + onShowComposerActions: _showComposerActions, + onShowRecipientSelector: _showRecipientSelector, + onStartVoiceRecording: _startVoiceRecording, + onStopAndSendVoice: _stopAndSendVoice, + onSendMessage: _sendMessage, + ), ), ], ), diff --git a/lib/widgets/messages/messages_composer.dart b/lib/widgets/messages/messages_composer.dart index 0ba321c..7a3ad16 100644 --- a/lib/widgets/messages/messages_composer.dart +++ b/lib/widgets/messages/messages_composer.dart @@ -44,7 +44,7 @@ class MessagesComposer extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - decoration: BoxDecoration(color: Theme.of(context).colorScheme.surface), + decoration: const BoxDecoration(color: Colors.transparent), child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/widgets/messages/messages_content.dart b/lib/widgets/messages/messages_content.dart index 73573bd..80e1315 100644 --- a/lib/widgets/messages/messages_content.dart +++ b/lib/widgets/messages/messages_content.dart @@ -5,9 +5,12 @@ import '../../models/message.dart'; import '../../widgets/messages/message_bubble.dart'; class MessagesContent extends StatelessWidget { + static const double defaultPadding = 8; + final List messages; final ScrollController scrollController; final String? highlightedMessageId; + final double bottomContentPadding; final Future Function() onRefresh; final VoidCallback? onNavigateToMap; final ValueChanged? onMessageTap; @@ -17,6 +20,7 @@ class MessagesContent extends StatelessWidget { required this.messages, required this.scrollController, required this.highlightedMessageId, + this.bottomContentPadding = 0, required this.onRefresh, this.onNavigateToMap, this.onMessageTap, @@ -64,7 +68,12 @@ class MessagesContent extends StatelessWidget { controller: scrollController, keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag, reverse: true, - padding: const EdgeInsets.all(8), + padding: EdgeInsets.fromLTRB( + defaultPadding, + defaultPadding, + defaultPadding, + defaultPadding + bottomContentPadding, + ), itemCount: messages.length, itemBuilder: (context, index) { final message = messages[index];