Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
155 stars 115 forks source link

On every setState() the emoji picker is redrawn #27

Closed Zverik closed 2 years ago

Zverik commented 2 years ago

I have a regular text field alonside the emoji picker. It has a listener to update the state every time a key is pressed: onChanged: (value) { setState(() {...}); }.

The issue is, on every call to setState() anywhere inside the containing widget, the emoji picker is redrawn from scratch: the tab is changed to the default one, the list of emoji is cleared and then slowly appears, scroll state is reset too.

Is there a way to disable or fix that?

asnbd commented 2 years ago

I have a regular text field alonside the emoji picker. It has a listener to update the state every time a key is pressed: onChanged: (value) { setState(() {...}); }.

The issue is, on every call to setState() anywhere inside the containing widget, the emoji picker is redrawn from scratch: the tab is changed to the default one, the list of emoji is cleared and then slowly appears, scroll state is reset too.

Is there a way to disable or fix that?

I'm also facing the same issue only when I set the custom config.

Zverik commented 2 years ago

Thanks for the tip! Your PR should indeed fix this. Also in the current version it can be resolved by adding const modifier to the config.