flutter_social_textfield
library
Classes
-
DefaultSocialTextFieldController
-
DefaultSocialTextFieldController widget for wrapping the content inside a for automatically showing the relevant content for detected type. (i.e showing mention/user list when cursor is on the @mention/#hashtag text)
focusNode required and also needs also to be attached to the TextField used by the SocialTextEditingController
textEditingController required and needs also to be attached to the same TextField
scrollController optional, used for determining the visiblility of main content when userlist / mentionlist / etc.. appeared
child required, must contain a TextField with the same textEditingController
detectionBuilders builders for relevant DetectedType. nothing is shown if a type does not have a builder
willResizeChild the efault value is true. changes the main content size when detection content has been shown.
detectionPresentationMode Default value is "DetectionPresentationMode.split_screen".
-
MatchSearchResult
-
Used internally by SocialTextSpanBuilder
textStyle matched textstyle, return default if no matches fonud
type detected type. returns DetectedType.plain_text by default.
text returns text within range. returns empty string if no matches found.
-
SocialContentDetection
-
Detection Content
type DetectedType
range Range of detection
text substring content created by using range value.
-
SocialTextEditingController
-
An improved TextEditingController for using with any widget that accepts TextEditingController.
It uses SocialTextSpanBuilder for rendering the content.
_detectionStream
returns content of the current cursor position. Positions are calculated by the cyrrent location of the word
Configuration is made by calling setter functions.
example:
_textEditingController = SocialTextEditingController()
..setTextStyle(DetectedType.mention, TextStyle(color: Colors.purple,backgroundColor: Colors.purple.withAlpha(50)))
..setTextStyle(DetectedType.url, TextStyle(color: Colors.blue, decoration: TextDecoration.underline))
..setTextStyle(DetectedType.hashtag, TextStyle(color: Colors.blue, fontWeight: FontWeight.w600))
..setRegexp(DetectedType.mention, Regexp("your_custom_regex_pattern");
-
SocialTextSpanBuilder
-
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.