51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../core/api_gateway.dart';
|
|
import 'chat_adaptive.dart';
|
|
import 'chat_create_fields.dart';
|
|
|
|
/// Harness identity, independent of favorite/activity state. Native icon sizing
|
|
/// and foreground color keep bundled monochrome marks readable on both hosts.
|
|
class SessionHarnessIcon extends StatelessWidget {
|
|
const SessionHarnessIcon({super.key, required this.session, this.color});
|
|
|
|
final JsonMap session;
|
|
final Color? color;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final value = '${session['backend'] ?? ''}'.trim();
|
|
final backend = value.isEmpty ? 'opencode' : value;
|
|
final cupertino =
|
|
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
|
final Widget mark = switch (backend) {
|
|
'opencode' || 'claude' => ImageIcon(
|
|
AssetImage('assets/harnesses/$backend.png'),
|
|
color: color,
|
|
),
|
|
'codex' => Icon(
|
|
cupertino
|
|
? CupertinoIcons.chevron_left_slash_chevron_right
|
|
: Icons.code,
|
|
color: color,
|
|
),
|
|
'pi' => Icon(
|
|
cupertino ? CupertinoIcons.function : Icons.functions,
|
|
color: color,
|
|
),
|
|
_ => Icon(
|
|
cupertino
|
|
? CupertinoIcons.chevron_left_slash_chevron_right
|
|
: Icons.terminal,
|
|
color: color,
|
|
),
|
|
};
|
|
return Semantics(
|
|
label: '${chatBackendLabel(backend)} harness',
|
|
image: true,
|
|
child: ExcludeSemantics(child: mark),
|
|
);
|
|
}
|
|
}
|