TextHighlightParser class
Constructors
- TextHighlightParser({required String data, String urlRegex = kUrlRegEx, TargetTextHighlights? targetTextHighlights, void onTapLink(String url)?, TextStyle? urlTextStyle, ReadMoreState initialState = ReadMoreState.collapsed, TrimMode trimMode = TrimMode.character, int maxCharacters = 240, int maxLines = 2})
-
const
Properties
- data → String
-
The text to be parsed
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialState → ReadMoreState
-
Initial state of the widget when it is created.
ReadMoreState.collapsed by default
final
- maxCharacters → int
-
Used when trimMode is
TrimMode.charactersBy default, it is 240final - maxLines → int
-
Used when trimMode is
TrimMode.linesBy default, it is 2final - onTapLink → void Function(String url)?
-
A function called when a link is clicked. The url should start with http:// or https://.
If the url doesn't start with http:// or https://, or if onTapLink is null the link will open
on the external browser.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- targetTextHighlights → TargetTextHighlights?
-
The target text highlights
final
- trimMode → TrimMode
-
Determines the type of trim.
TrimMode.characterstakes into account the number of characters, whileTrimMode.linestakes into account the number of lines andTrimMode.nonewill show the as many characters as possible in the widget layout. By default, it is TrimMode.characterfinal - urlRegex → String
-
Url pattern in string form which would be detected by the package, like
r'is'.final - urlTextStyle → TextStyle?
-
The url style for the link
final
Methods
-
findTextHighlights(
) → List< TextHighlight> -
findUrlRanges(
) → Iterable< TextRange> -
getSentenceList(
{required int maxShowCharactersLength, required TextStyle effectiveTextStyle, required TextStyle? defaultHighlightStyle, required List< TextHighlight> allTextHighlights, required Iterable<TextRange> allUrlRanges, required Map<int, TargetTextHighlights> allIndexTargetTextHighlightsMap, required void trackActiveTapGesture(TapGestureRecognizer recognizer)}) → List<TextSpan> -
maxCharactersToShow(
{required TextSpan dataTextSpan, required TextSpan suffixTextSpan, required TextPainter textPainter, required bool shouldShowSuffixText, required BoxConstraints constraints, required ReadMoreState readMoreState, required bool shouldShowReadMoreText, required bool shouldShowReadLessText, required TextSpan expandCollapseTextSpan, required TextSpan readMoreDelimiterTextSpan, required TextSpan readLessDelimiterTextSpan}) → int -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
createIndexTargetTextHighlightsMap(
List< TextHighlight> textHighlights) → Map<int, TargetTextHighlights>