Skip to content

Conversation

@KriseevM
Copy link
Contributor

resolves #547
resolves #546

@KriseevM KriseevM marked this pull request as ready for review November 30, 2025 15:52
@KriseevM KriseevM requested a review from Namxobick November 30, 2025 15:53
Comment on lines +54 to +75
suggestionsBuilder: (context, controller) async {
final suggService =
Injector.appInstance.get<DialogSearchService>();
if (controller.text.length < 3) {
final history = await suggService.getHistory();
return history
?.where((e) => e.title.contains(controller.text))
.map(
(e) =>
searchItemTile(context, e, controller, model),
) ??
[];
}
final sugg = await suggService.search(controller.text);
final data = sugg
?.map(
(e) =>
searchItemTile(context, e, controller, model),
)
.toList() ??
[];
return data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как тебе такое?

suggestionsBuilder: (context, controller) async {
  final suggService = Injector.appInstance.get<DialogSearchService>();

  if (controller.text.length < 3) {
    final history = await suggService.getHistory();
    return [
      for (final e in history ?? const <PreviewDialog>[])
        if (e.title.contains(controller.text))
          searchItemTile(context, e, controller, model),
    ];
  }

  final results = await suggService.search(controller.text);
  return [
    for (final e in results ?? const <PreviewDialog>[])
      searchItemTile(context, e, controller, model),
  ];
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Поиск диалогов. UI Поиск диалогов. ViewModel

4 participants