diff --git a/lib/screens/tasks/task_detail_screen.dart b/lib/screens/tasks/task_detail_screen.dart index 7ada4220..06979a0d 100644 --- a/lib/screens/tasks/task_detail_screen.dart +++ b/lib/screens/tasks/task_detail_screen.dart @@ -2400,7 +2400,21 @@ class _TaskDetailScreenState extends ConsumerState final detailsCard = Card( child: Padding( padding: const EdgeInsets.all(20), - child: SingleChildScrollView(child: detailsContent), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topLeft, + child: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.of(context).pop(), + ), + ), + detailsContent, + ], + ), + ), ), ); @@ -2605,67 +2619,67 @@ class _TaskDetailScreenState extends ConsumerState ), ); - if (isWide) { - return Row( - children: [ - Expanded(flex: 2, child: detailsCard), - const SizedBox(width: 16), - Expanded(flex: 3, child: tabbedCard), - ], - ); - } - - // Mobile/tablet: allow vertical scrolling of detail card while - // keeping the chat/activity panel filling the remaining viewport - // (and scrolling internally). Use a CustomScrollView to provide a - // bounded height for the tabbed card via SliverFillRemaining. - return Stack( - children: [ - CustomScrollView( - slivers: [ - SliverToBoxAdapter(child: detailsCard), - const SliverToBoxAdapter(child: SizedBox(height: 12)), - SliverFillRemaining(hasScrollBody: true, child: tabbedCard), - ], - ), - if (isRetrieving) - Positioned.fill( - child: AbsorbPointer( - absorbing: true, - child: Container( - color: Theme.of( - context, - ).colorScheme.surface.withAlpha((0.35 * 255).round()), - alignment: Alignment.topCenter, - padding: const EdgeInsets.only(top: 36), - child: SizedBox( - width: 280, - child: Card( - elevation: 4, - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - mainAxisSize: MainAxisSize.min, - children: const [ - SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator( - strokeWidth: 2, + final mainContent = isWide + ? Row( + children: [ + Expanded(flex: 2, child: detailsCard), + const SizedBox(width: 16), + Expanded(flex: 3, child: tabbedCard), + ], + ) + : Stack( + children: [ + CustomScrollView( + slivers: [ + SliverToBoxAdapter(child: detailsCard), + const SliverToBoxAdapter(child: SizedBox(height: 12)), + SliverFillRemaining( + hasScrollBody: true, + child: tabbedCard, + ), + ], + ), + if (isRetrieving) + Positioned.fill( + child: AbsorbPointer( + absorbing: true, + child: Container( + color: Theme.of(context).colorScheme.surface + .withAlpha((0.35 * 255).round()), + alignment: Alignment.topCenter, + padding: const EdgeInsets.only(top: 36), + child: SizedBox( + width: 280, + child: Card( + elevation: 4, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisSize: MainAxisSize.min, + children: const [ + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + ), + ), + SizedBox(width: 12), + Expanded( + child: Text('Retrieving updates…'), + ), + ], ), ), - SizedBox(width: 12), - Expanded(child: Text('Retrieving updates…')), - ], + ), ), ), ), ), - ), - ), - ), - ], - ); + ], + ); + + return mainContent; }, ), ), diff --git a/lib/screens/tickets/ticket_detail_screen.dart b/lib/screens/tickets/ticket_detail_screen.dart index df05d8b1..6019c4fc 100644 --- a/lib/screens/tickets/ticket_detail_screen.dart +++ b/lib/screens/tickets/ticket_detail_screen.dart @@ -199,7 +199,21 @@ class _TicketDetailScreenState extends ConsumerState { final detailsCard = Card( child: Padding( padding: const EdgeInsets.all(20), - child: SingleChildScrollView(child: detailsContent), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topLeft, + child: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.of(context).pop(), + ), + ), + detailsContent, + ], + ), + ), ), ); @@ -437,27 +451,23 @@ class _TicketDetailScreenState extends ConsumerState { ), ); - if (isWide) { - return Row( - children: [ - Expanded(flex: 2, child: detailsCard), - const SizedBox(width: 16), - Expanded(flex: 3, child: messagesCard), - ], - ); - } + final mainContent = isWide + ? Row( + children: [ + Expanded(flex: 2, child: detailsCard), + const SizedBox(width: 16), + Expanded(flex: 3, child: messagesCard), + ], + ) + : Column( + children: [ + detailsCard, + const SizedBox(height: 12), + Expanded(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), - ], - ); + return mainContent; }, ), );