fix(app): chat conversation bar leads, outside the transcript scroller
This commit is contained in:
@@ -291,7 +291,8 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
/// The runner for this session's `/new`, `/close` and `/rename`, rebuilt per
|
||||
/// build so an adopted row's directory and title are the current ones.
|
||||
ChatCommandActions _commandActions() {
|
||||
final session = widget.session ?? {'id': widget.sessionId, 'title': widget.title};
|
||||
final session =
|
||||
widget.session ?? {'id': widget.sessionId, 'title': widget.title};
|
||||
final onCreated = widget.onCreatedSession;
|
||||
return ChatCommandActions(
|
||||
repository: ChatRepository(widget.gateway),
|
||||
@@ -299,8 +300,8 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
directory: '${session['directory'] ?? ''}'.trim(),
|
||||
showNotice: _showCommandNotice,
|
||||
confirmClose: () => confirmCloseChat(context, session),
|
||||
openCreatedSession: onCreated ??
|
||||
(created, notice) => _showCommandNotice(notice),
|
||||
openCreatedSession:
|
||||
onCreated ?? (created, notice) => _showCommandNotice(notice),
|
||||
onRenamed: widget.onSessionRenamed,
|
||||
onClosed: widget.onSessionClosed,
|
||||
newOperationId: widget.newOperationId,
|
||||
@@ -552,8 +553,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
/// table's horizontal scroll bubbles through this listener too and must not
|
||||
/// release the conversation's follow intent.
|
||||
bool _onScrollNotification(ScrollNotification notification) {
|
||||
if (notification.depth != 0 ||
|
||||
notification.metrics.axis != Axis.vertical) {
|
||||
if (notification.depth != 0 || notification.metrics.axis != Axis.vertical) {
|
||||
return false;
|
||||
}
|
||||
if (notification is UserScrollNotification) {
|
||||
@@ -662,6 +662,70 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
_scheduleFollow();
|
||||
return Column(
|
||||
children: [
|
||||
// The conversation's own bar first, outside the transcript's scroller,
|
||||
// as on the web (chat-bar, then background tasks, then transcript).
|
||||
Padding(
|
||||
key: const Key('chat-thread-header'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(4, 8, 4, 4),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final title = widget.title.trim();
|
||||
final session = widget.session;
|
||||
final hasModel =
|
||||
session != null &&
|
||||
supportsChatModels('${session['backend'] ?? ''}');
|
||||
// One compact row, as on the web: back, the conversation's
|
||||
// name, its model and the information action. The title
|
||||
// takes the remaining width and ellipsises; the model keeps
|
||||
// a bounded share so neither control is pushed off a narrow
|
||||
// 2x phone and the header never wraps onto a second line.
|
||||
return Row(
|
||||
children: [
|
||||
_backButton(cupertino),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 4),
|
||||
child: title.isEmpty
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: cupertino
|
||||
? CupertinoTheme.of(
|
||||
context,
|
||||
).textTheme.navTitleTextStyle
|
||||
: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasModel)
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth * 0.4,
|
||||
),
|
||||
child: ChatModelControl(
|
||||
key: ValueKey<String>(
|
||||
'chat-model-${widget.sessionId}',
|
||||
),
|
||||
gateway: widget.gateway,
|
||||
sessionId: widget.sessionId,
|
||||
session: session,
|
||||
onChanged: widget.onModelChanged,
|
||||
),
|
||||
),
|
||||
ChatBarAction(
|
||||
key: const Key('chat-info'),
|
||||
label: 'Chat information',
|
||||
onPressed: _openInfo,
|
||||
materialIcon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// The session's still-running background tasks, above the transcript
|
||||
// and outside its scroller (web C11). It removes itself when the last
|
||||
// task exits and never draws a finished task.
|
||||
@@ -683,72 +747,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
controller: _scroll,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
children: [
|
||||
Padding(
|
||||
key: const Key('chat-thread-header'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(4, 0, 4, 4),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final title = widget.title.trim();
|
||||
final session = widget.session;
|
||||
final hasModel =
|
||||
session != null &&
|
||||
supportsChatModels('${session['backend'] ?? ''}');
|
||||
// One compact row, as on the web: back, the conversation's
|
||||
// name, its model and the information action. The title
|
||||
// takes the remaining width and ellipsises; the model keeps
|
||||
// a bounded share so neither control is pushed off a narrow
|
||||
// 2x phone and the header never wraps onto a second line.
|
||||
return Row(
|
||||
children: [
|
||||
_backButton(cupertino),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: 4,
|
||||
),
|
||||
child: title.isEmpty
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: cupertino
|
||||
? CupertinoTheme.of(
|
||||
context,
|
||||
).textTheme.navTitleTextStyle
|
||||
: Theme.of(
|
||||
context,
|
||||
).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasModel)
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth * 0.4,
|
||||
),
|
||||
child: ChatModelControl(
|
||||
key: ValueKey<String>(
|
||||
'chat-model-${widget.sessionId}',
|
||||
),
|
||||
gateway: widget.gateway,
|
||||
sessionId: widget.sessionId,
|
||||
session: session,
|
||||
onChanged: widget.onModelChanged,
|
||||
),
|
||||
),
|
||||
ChatBarAction(
|
||||
key: const Key('chat-info'),
|
||||
label: 'Chat information',
|
||||
onPressed: _openInfo,
|
||||
materialIcon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
if (initialLoad)
|
||||
Padding(
|
||||
key: const Key('chat-thread-loading'),
|
||||
@@ -813,7 +811,9 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
rows[index],
|
||||
onDismissCompaction:
|
||||
compactionNotice != null &&
|
||||
chatNoticeActivityCondition(rows[index]) ==
|
||||
chatNoticeActivityCondition(
|
||||
rows[index],
|
||||
) ==
|
||||
compactionNotice.condition
|
||||
? () => _dismiss(compactionNotice)
|
||||
: null,
|
||||
@@ -840,17 +840,17 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (showJump)
|
||||
PositionedDirectional(
|
||||
end: 16,
|
||||
bottom: 16,
|
||||
child: _ChatJumpToLatest(
|
||||
key: const Key('chat-jump-to-latest'),
|
||||
label: chatJumpToLatestLabel(newMessages),
|
||||
cupertino: cupertino,
|
||||
onPressed: _followLatest,
|
||||
if (showJump)
|
||||
PositionedDirectional(
|
||||
end: 16,
|
||||
bottom: 16,
|
||||
child: _ChatJumpToLatest(
|
||||
key: const Key('chat-jump-to-latest'),
|
||||
label: chatJumpToLatestLabel(newMessages),
|
||||
cupertino: cupertino,
|
||||
onPressed: _followLatest,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user