fayeed / flutter_mentions

A simple flutter input widget to add @ mentions functionality to your app
MIT License
107 stars 122 forks source link

When typed full display name after @ No results appear for user mentions. #30

Closed nirajjoshi closed 3 years ago

nirajjoshi commented 4 years ago

Normally it is working fine. Like right after typing initial letters from display name after @ it starts showing mention results to select. On tapping on mention suggestions it is added to textfield with highlighted color as well.

However there is some issue when we type full display name after @. Like if the display name is John then till typing @Joh it shows mention result suggestions. Right after we type @John suggestions disappear & there is no way to tag (mention) that user. Please refer screenshots for more reference. They are right from the sample app.

IMG_6495 IMG_6496 IMG_6497

Please do the needful.

mlars84 commented 4 years ago

That is because you have an exact match, which adds that suggestion. If you style the Mention widget, it will be a more clear user experience that once you've typed "@jhon" completely or selected it from the suggestions, it has been added. Example:

mentions: [
    Mention(
      trigger: "@",
      data: <YOUR DATA LIST>,
      style: TextStyle(
        color: Theme.of(context).primaryColor,
        fontFamily: "Karla",
        fontSize: 16.0
      ),
     ),
   ]
nirajjoshi commented 4 years ago

@mlars84 Thanks for reply. This user experience does makes sense but issue is even after typing full name & moving ahead it doesn't get highlighted like it gets highlighted even though john is there in data list, when we select from suggestions list.

fayeed commented 4 years ago

@nirajjoshi The way to get around this issue is to store all the list items you query in a temp variable and keep pushing new items to the list, this will keep the mentions working, the reason for not highlighting the typed out mention is that the list won't contain the item

nirajjoshi commented 4 years ago

@fayeed Thanks. I will do that.

Abacaxi-Nelson commented 3 years ago

@fayeed Thanks. I will do that.

Hey could you share what you have done ? Im not understanding what @fayeed advice

nirajjoshi commented 3 years ago

@Abacaxi-Nelson As @fayeed already explained all we need to do is make items available in the list we provide (_allMentionList in below example code).

mentions: [
        Mention(
          trigger: '@',
          data: _allMentionList,  // Just make sure your data items are present here to identify mentioned item.
          matchAll: false,
          suggestionBuilder: _buildSuggessionBuilderUI, 
          markupBuilder: (trigger, mention, value) {            
            return '[mentionId:$mention]<end>';
          },
        ),
      ],

Closing this as I was able to resolve issue using @fayeed 's comments.