From 6c53ddb82699b383ad6f32cb358a4cacc0d80fb1 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 8 May 2022 23:38:56 +0300 Subject: [PATCH] feat: add softWrap support --- lib/substring_highlight.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/substring_highlight.dart b/lib/substring_highlight.dart index c7d50ab..bf974e3 100644 --- a/lib/substring_highlight.dart +++ b/lib/substring_highlight.dart @@ -10,6 +10,7 @@ class SubstringHighlight extends StatelessWidget { {this.caseSensitive = false, this.maxLines, this.overflow = TextOverflow.clip, + this.softWrap = true, this.term, this.terms, required this.text, @@ -33,6 +34,11 @@ class SubstringHighlight extends StatelessWidget { /// How visual overflow should be handled. final TextOverflow overflow; + /// Whether the text should break at soft line breaks. + /// + /// If false, the glyphs in the text will be positioned as if there was unlimited horizontal space. + final bool softWrap; + /// An optional maximum number of lines for the text to span, wrapping if necessary. /// If the text exceeds the given number of lines, it will be truncated according /// to [overflow]. @@ -161,6 +167,7 @@ class SubstringHighlight extends StatelessWidget { return RichText( maxLines: maxLines, overflow: overflow, + softWrap: softWrap, text: TextSpan(children: children, style: textStyle), textAlign: textAlign, textScaleFactor: MediaQuery.of(context).textScaleFactor);