SocialTextSpanBuilder class
Builds TextSpan with the provided regular expression, stles and text. defaultTextStyle Optional default textstyle. used for detection types that has not been initialied detectionTextStyles required, used for setting up text styles for types found in DetectedType enum regularExpressions required, used for detecting DetectedType content. default regular expressions can be found in the plugin onTapDetection optional. When set, it assings TapGestureRecognizer to formatted content. It returns SocialContentDetection as response ignoredTextStyle optional. When set, content matched with "ignoreCases" of build function will return this text style, returns default text style if null.
Constructors
-
SocialTextSpanBuilder({required Map<
DetectedType, RegExp> regularExpressions, required TextStyle? defaultTextStyle, Map<DetectedType, TextStyle> detectionTextStyles = const {}, dynamic onTapDetection(SocialContentDetection detection)?, TextStyle? ignoredTextStyle})
Properties
-
allMatches
↔ Map<
DetectedType, List< RegExpMatch> ?> -
getter/setter pair
- defaultTextStyle → TextStyle?
-
final
-
detectionTextStyles
→ Map<
DetectedType, TextStyle> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- ignoredTextStyle → TextStyle?
-
final
- onTapDetection → dynamic Function(SocialContentDetection detection)?
-
final
-
regularExpressions
→ Map<
DetectedType, RegExp> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
String text, {List< String> ? ignoreCases, List<String> ? includeOnlyCases}) → TextSpan -
returns TextSpan containing all formatted content.
text
Text ContentignoreCases
optional, when set, string values written in ignoreCases will be treated as Plain TextincludeOnlyCases
optional, when set, only values found in this array will be detected, other values be treated as Plain Text -
getTextSpan(
TextSpan? root, String text, TextStyle style, {TapGestureRecognizer? tapRecognizer}) → TextSpan -
Wraps text with style inside the root.
root
optional, return TextSpan(text, style:style) if nulltext
main content textstyle
TextStyletapRecognizer
optional, tap action for detected content -
getTextStyleForRange(
int start, int end, {List< String> ? ignoreCases, List<String> ? includeOnlyCases}) → MatchSearchResult -
Gets Text Style for
start,end
range. return TextStyle() style if nothing found. -
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