emoji_picker_flutter
a flutter package that provides an emoji picker widget with 1500+ emojis in 8 categories
key features
- lightweight package
- faster loading
- null-safety
- completely customizable
- material design and cupertino mode
- emojis that cannot be displayed are filtered out (android only)
- optional recently used emoji tab
getting started
emojipicker(
onemojiselected: (category, emoji) {
// do something when emoji is tapped
},
onbackspacepressed: () {
// backspace-button tapped logic
// remove this line to also remove the button in the ui
},
config: config(
columns: 7,
emojisizemax: 32.0,
verticalspacing: 0,
horizontalspacing: 0,
initcategory: category.recent,
bgcolor: color(0xfff2f2f2),
indicatorcolor: colors.blue,
iconcolor: colors.grey,
iconcolorselected: colors.blue,
progressindicatorcolor: colors.blue,
showrecentstab: true,
recentslimit: 28,
norecentstext: "no recents",
norecentsstyle:
const textstyle(fontsize: 20, color: colors.black26),
categoryicons: const categoryicons(),
buttonmode: buttonmode.material
),
)
see the demo for more detailed sample project.
config
property | description | default |
---|---|---|
columns | number of emojis per row | 7 |
emojisizemax | width and height the emoji will be maximal displayed | 32.0 |
verticalspacing | verical spacing between emojis | toastgravity.bottom |
horizontalspacing | horizontal spacing between emojis | 0 |
initcategory | the initial category that will be selected | category.recent |
bgcolor | the background color of the widget | color(0xfff2f2f2) |
indicatorcolor | the color of the category indicator | colors.blue |
iconcolor | the color of the category icons | colors.grey |
iconcolorselected | the color of the category icon when selected | colors.blue |
progressindicatorcolor | the color of the loading indicator during initalization | colors.blue |
backspacecolor | the color of the backspace icon button | colors.blue |
showrecentstab | show extra tab with recently used emoji | true |
recentslimit | limit of recently used emoji that will be saved | 28 |
norecentstext | the text to be displayed if no recent emojis to display | “no recents” |
norecentsstyle | the text style for [norecentstext] | textstyle(fontsize: 20, color: colors.black26) |
categoryicons | determines the icon to display for each category. you can change icons by setting them in the constructor. | categoryicons() |
buttonmode | choose between material and cupertino button style | buttonmode.material |
backspace-button
you can add an backspace-button to the end category list by adding the callback method onbackspacepressed: () { }
to the emojipicker-widget. this will make it easier for your user to remove an added emoji without showing the keyboard. check out the example for more details about usage.
custom view
the appearance is completely customizable by setting customwidget
property. if properties in config are not enough you can inherit from emojipickerbuilder
(recommended but not necessary) to make further adjustments.
class customview extends emojipickerbuilder {
customview(config config, emojiviewstate state) : super(config, state);
@override
_customviewstate createstate() => _customviewstate();
}
class _customviewstate extends state<customview> {
@override
widget build(buildcontext context) {
// todo: implement build
// access widget.config and widget.state
return container();
}
}
emojipicker(
onemojiselected: (category, emoji) { /* ...*/ },
config: config( /* ...*/ ),
customwidget: (config, state) => customview(config, state),
)
Comments are closed.