From 5d898aaca04ac5f93e617ab5342d8309a685da76 Mon Sep 17 00:00:00 2001 From: cogwheel0 <172976095+cogwheel0@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:19:41 +0530 Subject: [PATCH] refactor: improve composer layout and constrain height the modern chat input composer layout to better handle vertical space and alignment. Change the row crossAxisAlignment from center to end so controls align to the input bottom. Wrap the animated container with a ConstrainedBox that limits the composer max height to 25% of the screen, preventing excessive growth on tall displays. Reorder and clean up the AnimatedContainer/decoration block, extracting the composer radius constant and preserving styling (background color, border color/width). Move the text field and inline mic into the same row structure under the constrained container and retain the isActive flag and padding. These changes prevent layout overflow, ensure a consistent border radius, and improve visual alignment of controls. --- .../chat/widgets/modern_chat_input.dart | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/lib/features/chat/widgets/modern_chat_input.dart b/lib/features/chat/widgets/modern_chat_input.dart index d1a1632..e002d47 100644 --- a/lib/features/chat/widgets/modern_chat_input.dart +++ b/lib/features/chat/widgets/modern_chat_input.dart @@ -786,7 +786,7 @@ class _ModernChatInputState extends ConsumerState Spacing.sm, ), child: Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, children: [ _buildOverflowButton( tooltip: AppLocalizations.of(context)!.more, @@ -796,42 +796,47 @@ class _ModernChatInputState extends ConsumerState ), const SizedBox(width: Spacing.sm), Expanded( - child: AnimatedContainer( - duration: const Duration(milliseconds: 180), - curve: Curves.easeOutCubic, - padding: const EdgeInsets.symmetric(horizontal: Spacing.md), - constraints: const BoxConstraints( - minHeight: TouchTarget.input, + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.25, ), - decoration: BoxDecoration( - color: composerSurface.withValues( - alpha: brightness == Brightness.dark ? 0.9 : 0.2, + child: AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeOutCubic, + padding: const EdgeInsets.symmetric(horizontal: Spacing.md), + constraints: const BoxConstraints( + minHeight: TouchTarget.input, ), - borderRadius: BorderRadius.circular(AppBorderRadius.round), - border: Border.all( - color: outlineColor.withValues( - alpha: brightness == Brightness.dark ? 0.32 : 0.2, + decoration: BoxDecoration( + color: composerSurface.withValues( + alpha: brightness == Brightness.dark ? 0.9 : 0.2, ), - width: BorderWidth.micro, - ), - ), - child: Row( - children: [ - Expanded( - child: _buildComposerTextField( - brightness: brightness, - sendOnEnter: sendOnEnter, - placeholderBase: placeholderBase, - placeholderFocused: placeholderFocused, - contentPadding: const EdgeInsets.symmetric( - vertical: Spacing.xs, - ), - isActive: isActive, + borderRadius: BorderRadius.circular(_composerRadius), + border: Border.all( + color: outlineColor.withValues( + alpha: brightness == Brightness.dark ? 0.32 : 0.2, ), + width: BorderWidth.micro, ), - if (!_hasText && voiceAvailable && !isGenerating) - _buildInlineMicIcon(voiceAvailable), - ], + ), + child: Row( + children: [ + Expanded( + child: _buildComposerTextField( + brightness: brightness, + sendOnEnter: sendOnEnter, + placeholderBase: placeholderBase, + placeholderFocused: placeholderFocused, + contentPadding: const EdgeInsets.symmetric( + vertical: Spacing.xs, + ), + isActive: isActive, + ), + ), + if (!_hasText && voiceAvailable && !isGenerating) + _buildInlineMicIcon(voiceAvailable), + ], + ), ), ), ),