Files
pipelines/app/tool/chat_sessions_probe_entry.dart
T
alan 41d30a4280 feat(app): split chat sessions into native Material and Cupertino views
Split the 406-line chat session browser into a controller, body, shared
adaptive primitives and separate standard Material and Cupertino lists and
dialogs. Preserve the existing server directory/backend catalogs,
instructions field, closed/starred grouping, directory headings and
empty/no-match states.

- keep refresh generations so stale replies are discarded
- open a created chat immediately and refresh the list in the background
- disable rename Save while the trimmed name is blank
- label row actions per session, with the id on duplicate titles
- wrap Cupertino empty/no-match/error messages instead of clipping, and
  give them a Cupertino text style under a bare MaterialApp
- allow the Material rename helper to wrap at large text scales
- cover both native branches, lifecycle ordering, create/rename/close/star
  and the Cupertino theme path with widget tests
2026-10-21 17:42:39 +01:00

77 lines
1.9 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/session_screen.dart';
class _FixtureGateway implements ApiGateway {
@override
Stream<JsonMap> get frames => const Stream.empty();
@override
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async {
if (type == 'chat_sessions') {
return {
'chat_sessions': [
{
'id': 'probe-open',
'title': 'Open fixture',
'directory': '/workspace/demo',
'starred': true,
},
{
'id': 'probe-closed',
'title': 'Closed fixture',
'directory': '/workspace/archive',
'closed_at': '2026-01-01',
},
{
'id': 'probe-stream',
'title': 'Streaming fixture',
'directory': '/workspace/demo',
'running': true,
},
],
};
}
if (type == 'chat_directories') {
return {
'chat_directories': ['/workspace/demo', '/workspace/archive'],
};
}
if (type == 'chat_backends') {
return {
'chat_backends': ['opencode', 'codex'],
};
}
if (type == 'chat_create') {
return {
'chat_session': {
'id': 'probe-new',
'title': 'New fixture',
'directory': '/workspace/demo',
},
};
}
return {'chat_session': {}};
}
}
const _probeStyle = String.fromEnvironment(
'CHAT_PROBE_STYLE',
defaultValue: 'material',
);
void main() {
final home = ChatSessionsScreen(gateway: _FixtureGateway(), onOpen: (_) {});
if (_probeStyle == 'cupertino') {
runApp(CupertinoApp(home: home));
return;
}
runApp(
MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: home,
),
);
}