9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
70 lines
2.3 KiB
Dart
70 lines
2.3 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../../../ui/layout/section_heading.dart';
|
|
import '../domain/search_controller.dart';
|
|
import '../domain/search_models.dart';
|
|
import 'search_bounds_note.dart';
|
|
import 'search_result_row.dart';
|
|
|
|
const searchChatsSectionKey = ValueKey<String>('search.section.chats');
|
|
const searchOthersSectionKey = ValueKey<String>('search.section.others');
|
|
const searchChatsNoteKey = ValueKey<String>('search.chats.note');
|
|
|
|
/// The results body shared by both hosts. With every kind searched, chat hits
|
|
/// lead as their own "Chats" group above the pipeline/run/artifact hits; with
|
|
/// Chats selected alone they are the list. A run search with no hits still
|
|
/// says so under the Chats group.
|
|
List<Widget> searchResultSlivers({
|
|
required OmniSearchController controller,
|
|
required String query,
|
|
required ValueChanged<JsonMap> onOpen,
|
|
required Widget Function(String message) message,
|
|
}) {
|
|
final chats = controller.shownChats;
|
|
final others = controller.shownResults;
|
|
final grouped = controller.showsChatSection;
|
|
final note = controller.chatsNote;
|
|
Widget rows(List<JsonMap> hits) => SliverList.builder(
|
|
itemCount: hits.length,
|
|
itemBuilder: (context, index) => SearchResultRow(
|
|
hit: hits[index],
|
|
query: query,
|
|
onOpen: onOpen,
|
|
divider: index < hits.length - 1,
|
|
),
|
|
);
|
|
final empty = controller.emptyMessage;
|
|
return [
|
|
if (grouped)
|
|
SliverToBoxAdapter(
|
|
child: SectionHeading(
|
|
key: searchChatsSectionKey,
|
|
title: chats.isEmpty ? 'Chats' : 'Chats (${chats.length})',
|
|
header: true,
|
|
),
|
|
),
|
|
if (chats.isNotEmpty) rows(chats),
|
|
if (note != null)
|
|
SliverToBoxAdapter(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
child: SearchBoundsNote(key: searchChatsNoteKey, text: note),
|
|
),
|
|
),
|
|
if (grouped && others.isNotEmpty)
|
|
const SliverToBoxAdapter(
|
|
child: SectionHeading(
|
|
key: searchOthersSectionKey,
|
|
title: 'Pipelines and runs',
|
|
header: true,
|
|
),
|
|
),
|
|
if (others.isNotEmpty) rows(others),
|
|
if (others.isEmpty &&
|
|
controller.parsed.kind != SearchKind.chat &&
|
|
empty != null)
|
|
SliverToBoxAdapter(child: message(empty)),
|
|
];
|
|
}
|