Skip to content

Commit

Permalink
fixup! TF-3236 Display SearchSnippet in search result
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Nov 15, 2024
1 parent a2ba572 commit ba3ea25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/lib/presentation/views/text/rich_text_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class _RichTextBuilderState extends State<RichTextBuilder> with AutomaticKeepAli

if (!widget.ensureHighlightVisible) return text;

if (noHighlightAvailable) return text;

WidgetsBinding.instance.addPostFrameCallback((_) {
scrollDebounceListener();
});
Expand All @@ -82,6 +84,12 @@ class _RichTextBuilderState extends State<RichTextBuilder> with AutomaticKeepAli
);
}

bool get noHighlightAvailable {
return widget.preMarkedText == null
&& widget.wordToStyle.isNotEmpty
&& !widget.textOrigin.toLowerCase().contains(widget.wordToStyle.toLowerCase());
}

List<InlineSpan> _getSpans({
required String text,
required String word,
Expand Down

0 comments on commit ba3ea25

Please sign in to comment.