refactor: simplify chat input and drawer layout

This commit is contained in:
cogwheel0
2025-08-24 21:41:18 +05:30
parent 5bc67b7287
commit e1ee94f2f3
2 changed files with 323 additions and 332 deletions

View File

@@ -217,9 +217,6 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
// Main input area with unified 2-row design // Main input area with unified 2-row design
Container( Container(
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: context.conduitTheme.inputBackground, color: context.conduitTheme.inputBackground,
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
@@ -243,14 +240,16 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
boxShadow: ConduitShadows.input, boxShadow: ConduitShadows.input,
), ),
width: double.infinity, width: double.infinity,
child: SafeArea(
top: false,
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
// cap the input area to 40% of screen height to avoid bottom overflow // cap the input area to 40% of screen height to avoid bottom overflow
maxHeight: MediaQuery.of(context).size.height * 0.4, maxHeight: MediaQuery.of(context).size.height * 0.4,
), ),
child: AnimatedSize( child: AnimatedSize(
duration: duration: AnimationDuration
AnimationDuration.fast, // Faster for better responsiveness .fast, // Faster for better responsiveness
curve: Curves.fastOutSlowIn, // More efficient curve curve: Curves.fastOutSlowIn, // More efficient curve
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: SingleChildScrollView( child: SingleChildScrollView(
@@ -307,8 +306,9 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
context, context,
)!.messageHintText, )!.messageHintText,
hintStyle: TextStyle( hintStyle: TextStyle(
color: color: context
context.conduitTheme.inputPlaceholder, .conduitTheme
.inputPlaceholder,
fontSize: AppTypography.bodyLarge, fontSize: AppTypography.bodyLarge,
fontWeight: _isRecording fontWeight: _isRecording
? FontWeight.w500 ? FontWeight.w500
@@ -444,7 +444,9 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
onTap: widget.enabled onTap: widget.enabled
? _showUnifiedToolsModal ? _showUnifiedToolsModal
: null, : null,
tooltip: AppLocalizations.of(context)!.tools, tooltip: AppLocalizations.of(
context,
)!.tools,
isActive: isActive:
ref ref
.watch(selectedToolIdsProvider) .watch(selectedToolIdsProvider)
@@ -484,6 +486,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
), ),
), ),
), ),
),
], ],
), ),
); );

View File

@@ -65,8 +65,7 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
// Bottom section now only shows navigation actions // Bottom section now only shows navigation actions
final theme = context.conduitTheme; final theme = context.conduitTheme;
return SafeArea( return Container(
child: Container(
color: theme.surfaceBackground, color: theme.surfaceBackground,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -101,7 +100,6 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
_buildBottomSection(context), _buildBottomSection(context),
], ],
), ),
),
); );
} }
@@ -1118,15 +1116,8 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
Widget _buildBottomSection(BuildContext context) { Widget _buildBottomSection(BuildContext context) {
final theme = context.conduitTheme; final theme = context.conduitTheme;
final user = ref.watch(authUserProvider); final user = ref.watch(authUserProvider);
return SafeArea( return Padding(
top: false, padding: const EdgeInsets.fromLTRB(Spacing.sm, 0, Spacing.sm, Spacing.sm),
child: Padding(
padding: const EdgeInsets.fromLTRB(
Spacing.sm,
0,
Spacing.sm,
Spacing.sm,
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -1190,9 +1181,7 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
onPressed: () { onPressed: () {
Navigator.of(context).maybePop(); Navigator.of(context).maybePop();
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(builder: (_) => const ProfilePage()),
builder: (_) => const ProfilePage(),
),
); );
}, },
child: Text(AppLocalizations.of(context)!.manage), child: Text(AppLocalizations.of(context)!.manage),
@@ -1203,7 +1192,6 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
], ],
], ],
), ),
),
); );
} }