From ee1bf5e113cd776e9a24c4b3515917cafaa51988 Mon Sep 17 00:00:00 2001 From: Marc Rejohn Castillano Date: Mon, 23 Feb 2026 18:50:31 +0800 Subject: [PATCH] Fix height of chat boxes --- lib/screens/tasks/task_detail_screen.dart | 22 +++--- lib/screens/tickets/ticket_detail_screen.dart | 75 ++++++++++--------- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/lib/screens/tasks/task_detail_screen.dart b/lib/screens/tasks/task_detail_screen.dart index c324092e..f935517d 100644 --- a/lib/screens/tasks/task_detail_screen.dart +++ b/lib/screens/tasks/task_detail_screen.dart @@ -2026,18 +2026,16 @@ class _TaskDetailScreenState extends ConsumerState ); } - // Mobile: make whole detail screen scrollable and give the - // tabbed area a fixed height so it can layout inside the - // scrollable column. - final mobileTabHeight = MediaQuery.of(context).size.height * 0.72; - return SingleChildScrollView( - child: Column( - children: [ - detailsCard, - const SizedBox(height: 12), - SizedBox(height: mobileTabHeight, child: tabbedCard), - ], - ), + // Mobile: avoid two scrollables nested together. detailsCard can + // independently scroll and the tabbed card takes whatever space + // remains so the chat/activity list always receives gestures and + // can never be pushed completely offscreen. + return Column( + children: [ + detailsCard, + const SizedBox(height: 12), + Expanded(child: tabbedCard), + ], ); }, ), diff --git a/lib/screens/tickets/ticket_detail_screen.dart b/lib/screens/tickets/ticket_detail_screen.dart index b9f5b153..80e69440 100644 --- a/lib/screens/tickets/ticket_detail_screen.dart +++ b/lib/screens/tickets/ticket_detail_screen.dart @@ -133,29 +133,39 @@ class _TicketDetailScreenState extends ConsumerState { ], ), const SizedBox(height: 12), - Text(ticket.description), - const SizedBox(height: 12), - _buildTatRow(context, ticket, effectiveRespondedAt), - if (taskForTicket != null) ...[ - const SizedBox(height: 16), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TaskAssignmentSection( - taskId: taskForTicket.id, - canAssign: showAssign, - ), - ), - const SizedBox(width: 8), - IconButton( - tooltip: 'Open task', - onPressed: () => context.go('/tasks/${taskForTicket.id}'), - icon: const Icon(Icons.open_in_new), + // collapse the rest of the details so tall chat areas won't push off-screen + ExpansionTile( + key: const Key('ticket-details-expansion'), + title: const Text('Details'), + initiallyExpanded: true, + childrenPadding: const EdgeInsets.only(top: 8), + children: [ + Text(ticket.description), + const SizedBox(height: 12), + _buildTatRow(context, ticket, effectiveRespondedAt), + if (taskForTicket != null) ...[ + const SizedBox(height: 16), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TaskAssignmentSection( + taskId: taskForTicket.id, + canAssign: showAssign, + ), + ), + const SizedBox(width: 8), + IconButton( + tooltip: 'Open task', + onPressed: () => + context.go('/tasks/${taskForTicket.id}'), + icon: const Icon(Icons.open_in_new), + ), + ], ), ], - ), - ], + ], + ), ], ); @@ -410,19 +420,16 @@ class _TicketDetailScreenState extends ConsumerState { ); } - // Mobile: make entire detail screen scrollable and give the - // messages area a fixed height so it can layout inside the - // scrollable column. - final mobileMessagesHeight = - MediaQuery.of(context).size.height * 0.72; - return SingleChildScrollView( - child: Column( - children: [ - detailsCard, - const SizedBox(height: 12), - SizedBox(height: mobileMessagesHeight, child: messagesCard), - ], - ), + // Mobile: avoid nesting scrollables. detailsCard itself is + // scrollable if it grows tall, and the messages area takes the + // remaining space so the chat list can always receive touch + // gestures and never end up offscreen. + return Column( + children: [ + detailsCard, + const SizedBox(height: 12), + Expanded(child: messagesCard), + ], ); }, ),