v_chat_mention_controller 1.0.0 copy "v_chat_mention_controller: ^1.0.0" to clipboard
v_chat_mention_controller: ^1.0.0 copied to clipboard

flutter mention or mentions tage textfiled to deleted the @ or tags while user write

image

  • use this package to detect mentions in text filed
  • '@'
  • support all language
  • support custom widgets
  • only you need to create the controller in your state

final controller = VChatTextMentionController(
  debounce: 500,

  ///set custom style
  mentionStyle: const TextStyle(
    color: Colors.deepPurple,
    fontWeight: FontWeight.w800,
  ),
);
  • make sure to call dispose after exit from the screen!
  • Listen to on search detect
  @override
void initState() {
  super.initState();
  controller.onSearch = (str) async {
    users.clear();
    if (str != null) {
      //  print("search by $str");
      _isSearchCanView = true;
      if (str.isEmpty) {
        users.addAll(_fakeUsersDataServer);
      }
      //send request
      for (var element in _fakeUsersDataServer) {
        if (element.startsWith(str)) {
          users.add(element);
        }
      }
    } else {
      //stop request
      _isSearchCanView = false;
    }
    setState(() {});
  };
}

  • once you want to add new mention just call
  controller.addMention(
        MentionData(
          id: "User id",
          display: "USER NAME",
        ),
      );
  • once you want to get the data as makeup text call
controller.markupText
3
likes
140
pub points
63%
popularity

Publisher

unverified uploader

flutter mention or mentions tage textfiled to deleted the @ or tags while user write

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on v_chat_mention_controller