santa112358 / hashtagable

Widgets and functions to implement hashTag decorated text.
https://pub.dev/packages/hashtagable
MIT License
30 stars 50 forks source link
hashtag textfield twitter

All Contributors

hashtagable

test pub package License: MIT

Widgets and functions to implement hashTag decorated text.

Detects the words start with # like a Twitter.

RPReplay_Final1599932903

Usage

You can use HashTagTextField to decorate input text.

    HashTagTextField(
    decoratedStyle: TextStyle(fontSize: 14, color: Colors.blue),
    basicStyle: TextStyle(fontSize: 14, color: Colors.black),
    ),

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

Other arguments are basically same as those of material TextField

If you want to decorate the text only to display, HashTagText will help you.

    HashTagText(
        text: "#Welcome to #hashtagable \n This is #ReadOnlyText",
        decoratedStyle: TextStyle(fontSize: 22,color:Colors.red),
        basicStyle: TextStyle(fontSize: 22,color:Colors.black),
        onTap: (text) {
          print(text);
        },
    )

The argument onTap(String) is called when user tapped a hashTag.

You can add some actions in this callback with the tapped hashTag.

Customize with useful functions

- Extract hashTags from text
```dart
   final List<String> hashTags = extractHashTags("#Hello World #Flutter Dart #Thank you");
   // ["#Hello", "#Flutter", "#Thank"]

Tips

If you have any requests or questions, please feel free to ask on github.


Contributors: Santa Takahashi, Matheus Perez, Marcel Schneider, Ho Kim, Burak

Contributors ✨

Thanks goes to these wonderful people (emoji key):

JorisObert
JorisObert

💻

This project follows the all-contributors specification. Contributions of any kind welcome!