Merge: chat colours, Ctrl+1-9, starred chats alphabetical
# Conflicts: # app/lib/features/chat/conversation/chat_thread_view.dart # app/tool/perf/perf_fixture.dart # internal/protocol/chat.go # internal/server/chat_close.go # internal/server/chat_sessions.go
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../domain/chat_colors.dart';
|
||||
import '../ui/sessions/chat_color_palette.dart';
|
||||
|
||||
/// The open chat's colour as a faint wash behind the top of the page: it
|
||||
/// shows through the glass bar and fades out just below it, so even without
|
||||
/// the list beside it the chat carries a gentle reminder of which one it is.
|
||||
/// It sits under the transcript and takes no taps, so text contrast and
|
||||
/// hit-testing are untouched. Nothing is drawn for a chat with no colour.
|
||||
class ChatColorWash extends StatelessWidget {
|
||||
const ChatColorWash({super.key, required this.session});
|
||||
|
||||
final JsonMap? session;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = chatColorShade(context, chatSessionColor(session));
|
||||
if (color == null) return const SizedBox.shrink();
|
||||
final strength = chatColorDarkSurface(context) ? 0.24 : 0.2;
|
||||
// The bar's height arrives as top padding; the wash reaches a little
|
||||
// past it so the fade reads under the bar, not as an edge at it.
|
||||
final height = MediaQuery.paddingOf(context).top + 96;
|
||||
return Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: height,
|
||||
child: IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
key: const Key('chat-color-wash'),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
color.withValues(alpha: strength),
|
||||
color.withValues(alpha: 0),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,10 @@ import '../data/chat_repository.dart';
|
||||
import '../domain/chat_activity_detail.dart';
|
||||
import '../domain/chat_notice.dart';
|
||||
import '../domain/chat_attachment_picker.dart';
|
||||
import '../domain/chat_colors.dart';
|
||||
import '../domain/chat_transcript.dart';
|
||||
import '../ui/sessions/chat_adaptive.dart';
|
||||
import '../ui/sessions/chat_color_picker.dart';
|
||||
import '../ui/sessions/session_actions.dart';
|
||||
import '../ui/transcript/chat_markdown_view.dart';
|
||||
import '../ui/transcript/chat_message_view.dart';
|
||||
@@ -23,6 +25,7 @@ import 'chat_account_usage_section.dart';
|
||||
import 'chat_export_controller.dart';
|
||||
import 'chat_session_section.dart';
|
||||
import 'chat_background_tasks.dart';
|
||||
import 'chat_color_wash.dart';
|
||||
import 'chat_command_actions.dart';
|
||||
import 'chat_composer_bar.dart';
|
||||
import 'chat_composer_controller.dart';
|
||||
@@ -80,9 +83,14 @@ class ChatThreadView extends StatefulWidget {
|
||||
this.onSessionRenamed,
|
||||
this.onSessionClosed,
|
||||
this.fileBridge = const ArtifactFileBridge(),
|
||||
this.onColorSelected,
|
||||
});
|
||||
|
||||
final ApiGateway gateway;
|
||||
|
||||
/// Sets the chat's shared colour (a palette name, null for none) from the
|
||||
/// information sheet; null leaves the sheet without the Colour choice.
|
||||
final ValueChanged<String?>? onColorSelected;
|
||||
final String sessionId;
|
||||
final VoidCallback onBack;
|
||||
|
||||
@@ -370,6 +378,8 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
controller: _controller,
|
||||
handoff: handoff,
|
||||
exporter: exporter,
|
||||
color: chatSessionColor(widget.session),
|
||||
onColorSelected: widget.onColorSelected,
|
||||
);
|
||||
if (cupertino) {
|
||||
await showCupertinoModalPopup<void>(
|
||||
@@ -962,6 +972,8 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
_rowWidgets.prune();
|
||||
return Stack(
|
||||
children: [
|
||||
// Behind everything: the chat's colour under the bar.
|
||||
ChatColorWash(session: widget.session),
|
||||
// At rest the first item starts below the floating bar
|
||||
// and the last one ends above the floating composer.
|
||||
// Bottom-anchored at the split row, the newest rows are
|
||||
@@ -1580,11 +1592,15 @@ class _ChatInfoSheet extends StatelessWidget {
|
||||
required this.controller,
|
||||
required this.handoff,
|
||||
required this.exporter,
|
||||
this.color,
|
||||
this.onColorSelected,
|
||||
});
|
||||
|
||||
final ChatThreadController controller;
|
||||
final ChatSessionHandoff handoff;
|
||||
final ChatExportController exporter;
|
||||
final String? color;
|
||||
final ValueChanged<String?>? onColorSelected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -1603,6 +1619,8 @@ class _ChatInfoSheet extends StatelessWidget {
|
||||
cupertino: cupertino,
|
||||
doneKey: const Key('chat-info-close'),
|
||||
),
|
||||
if (onColorSelected case final onSelected?)
|
||||
ChatColorSection(selected: color, onSelected: onSelected),
|
||||
for (final metric in _chatInfoMetrics(controller.usage))
|
||||
_ChatInfoRow(metric: metric, cupertino: cupertino),
|
||||
ChatAccountUsageSection(
|
||||
|
||||
Reference in New Issue
Block a user