chat search now lists local and server-side hits like the file search, and jumping to old messages pages in history with a progress banner and keeps the hit marked

This commit is contained in:
MineTec committed 2026-10-28 22:40:21 +01:00
1 parent fcfd21bb4d
commit b9cb6a8af1
13 files changed
+926 -322

No files matched your search

@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import '../data/chat_message_matcher.dart';
import 'chat_search_controller.dart';
import 'chat_search_results.dart';
/// Search inside one chat, built like `FilesSearchDelegate`. Closes with the
/// tapped hit so the chat can jump there.
class ChatSearchDelegate extends SearchDelegate<ChatSearchHit?> {
final ChatSearchController _controller;
ChatSearchDelegate(this._controller)
: super(searchFieldLabel: 'In Chat suchen');
/// Must be called by the host widget after `showSearch` returns so the
/// controller's listeners and pending debounce timers are released.
void disposeController() => _controller.dispose();
@override
List<Widget>? buildActions(BuildContext context) => [
if (query.isNotEmpty)
IconButton(
tooltip: 'Suche leeren',
icon: const Icon(Icons.clear),
onPressed: () {
query = '';
},
),
];
@override
Widget? buildLeading(BuildContext context) => IconButton(
icon: const Icon(Icons.arrow_back),
tooltip: 'Zurück',
onPressed: () => close(context, null),
);
@override
Widget buildResults(BuildContext context) => buildSuggestions(context);
@override
Widget buildSuggestions(BuildContext context) {
_controller.setQuery(query);
return ChatSearchResults(
controller: _controller,
onResultTap: (hit) => close(context, hit),
);
}
}