Expose horizontal chat overflow with native scrollbars and keyboard controls

This commit is contained in:
2026-11-07 20:35:13 +00:00
parent 5ddd52f817
commit 004979ccd0
6 changed files with 432 additions and 4 deletions
@@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter/rendering.dart';
import '../../../../ui/adaptive/host.dart';
import '../../../../ui/layout/wheel_scroll_forwarding.dart';
import 'chat_horizontal_viewport.dart';
/// The selection controller shared by all link spans in one transcript.
///
@@ -114,8 +114,13 @@ class _ChatTranscriptSelectionAreaState
/// mean after, not before. Give the vertical position priority outside its
/// height, while keeping normal horizontal selection and scrolling inside.
class ChatTranscriptHorizontalScrollView extends StatefulWidget {
const ChatTranscriptHorizontalScrollView({super.key, required this.child});
const ChatTranscriptHorizontalScrollView({
super.key,
required this.child,
this.label = 'content',
});
final Widget child;
final String label;
@override
State<ChatTranscriptHorizontalScrollView> createState() =>
@@ -134,7 +139,10 @@ class _ChatTranscriptHorizontalScrollViewState
@override
Widget build(BuildContext context) {
final view = HorizontalScrollView(child: widget.child);
final view = ChatHorizontalViewport(
label: widget.label,
child: widget.child,
);
if (ChatTranscriptSelectionScope.maybeOf(context) == null) return view;
return SelectionContainer(delegate: _delegate, child: view);
}