hashtagable 0.0.2 copy "hashtagable: ^0.0.2" to clipboard
hashtagable: ^0.0.2 copied to clipboard

outdated

Widget and function to implement hashtag-decorated EditableText and RichText. Decorate the words which start with `#`

Widget and function to implement hashtag-decorated EditableText and RichText. It decorates the words start with #

result

Usage #

  • editableText

If you want to decorate input text, HashTagEditableText will help you.

    HashTagEditableText(
      controller: _textEditingController,
      cursorColor: Theme.of(context).cursorColor,
      basicStyle: TextStyle(fontSize: 14,color:Colors.black),
      focusNode: FocusNode(),
      onChanged: (_) {},
      onSubmitted: (_) {},
      decoratedStyle: TextStyle(fontSize: 14,color:Colors.red),
    ),

decoratedStyle is the textStyle of tagged text. basicStyle is the one of untagged text

  • RichText

If you want to decorate the text only to display, getHashTagTextSpan() will help you. All you need is just putting this function in RichText.

    RichText(
      text: getHashTagTextSpan(
          decoratedStyle: TextStyle(fontSize: 14,color:Colors.red),
          basicStyle: TextStyle(fontSize: 14,color:Colors.black),
          source: "#Hello world. Hello #world",
          onTap: (text) {
            print(text);
          },
      ),
    ),

The argument onTap(String) is called when user tapped tagged text.

Decoration rules #

The rules are almost same as twitter. It stop decorating if the tag contains emoji or symbol. It needs space before # to decorate.

134
likes
0
pub points
87%
popularity

Publisher

verified publisherbookm.me

Widget and function to implement hashtag-decorated EditableText and RichText. Decorate the words which start with `#`

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on hashtagable