Files
pipelines/app/lib/features/search/ui/search_result_view.dart
T
alan 51140cd3b7 feat(app): add native omni-search screen over the search gateway
Pure request/parse/row logic in lib/features/search/domain, a
gateway-backed repository, and Material plus Cupertino bodies.
The header and rows share one scroll view, and the server's
truncation, scan and cap facts stay visible even when a bounded
scan returns no matches.

Tests cover the exact search envelope, token parsing, stale replies,
retry, truncation bounds and platform layouts. A Web-only fixture
and CDP probe support rendered verification; the screen is not yet
registered in the shell.
2026-10-21 16:41:30 +01:00

60 lines
1.8 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../domain/search_row.dart';
/// Kind, recency and read-only affordance for one row. Deliberately unstyled
/// beyond weight so Material and Cupertino inherit their own system typography
/// and colours, including dark mode and text scaling.
Widget searchRowMeta(SearchRowView row) {
final parts = [row.kindLabel, if (row.recency != null) row.recency!];
return Text(
parts.join(' · '),
style: const TextStyle(fontWeight: FontWeight.w600),
);
}
/// The snippet with the first query occurrence emphasised by weight, never by
/// parsing server text as markup or by a bespoke colour.
Widget searchRowSnippet(BuildContext context, SearchRowView row) {
final snippet = row.snippet;
if (snippet == null) {
return row.secondary.isEmpty
? const SizedBox.shrink()
: Text(row.secondary);
}
return Text.rich(
TextSpan(
children: [
for (final span in row.snippetSpans)
TextSpan(
text: span.text,
style: span.matched
? const TextStyle(fontWeight: FontWeight.bold)
: null,
),
],
),
);
}
IconData searchMaterialIcon(String kind) => switch (kind) {
'pipeline' => Icons.account_tree_outlined,
'version' => Icons.layers_outlined,
'run' => Icons.play_circle_outline,
'step' => Icons.arrow_forward,
'field' => Icons.notes,
'artifact' => Icons.attach_file,
_ => Icons.help_outline,
};
IconData searchCupertinoIcon(String kind) => switch (kind) {
'pipeline' => CupertinoIcons.arrow_branch,
'version' => CupertinoIcons.square_stack_3d_up,
'run' => CupertinoIcons.play_circle,
'step' => CupertinoIcons.arrow_right,
'field' => CupertinoIcons.doc_text,
'artifact' => CupertinoIcons.paperclip,
_ => CupertinoIcons.question_circle,
};