EmojiSelector class

A widget that wraps a child and displays an emoji selector overlay.

The emoji selector appears above or below the child widget when triggered, allowing users to select from a list of emoji reactions.

Example:

EmojiSelector(
  emojis: [
    EmojiItem.asset('like', 'assets/emojis/like.png'),
    EmojiItem.asset('love', 'assets/emojis/love.png'),
    EmojiItem.asset('haha', 'assets/emojis/haha.gif'),
  ],
  onEmojiSelected: (emoji) => print('Selected: ${emoji.id}'),
  child: IconButton(
    icon: Icon(Icons.thumb_up_outlined),
    onPressed: () {},
  ),
)
Inheritance

Constructors

EmojiSelector({Key? key, required List<EmojiItem> emojis, required Widget child, ValueChanged<EmojiItem>? onEmojiSelected, VoidCallback? onShow, VoidCallback? onHide, EmojiSelectorController? controller, EmojiSelectorStyle style = const EmojiSelectorStyle(), EmojiSelectorTrigger trigger = EmojiSelectorTrigger.longPress, Duration longPressDuration = const Duration(milliseconds: 500), bool dismissOnTapOutside = true, bool dismissOnSelection = true, bool enabled = true})
Creates an EmojiSelector widget.
const

Properties

child Widget
The child widget to wrap (trigger for the selector).
final
controller EmojiSelectorController?
Optional controller for programmatic control.
final
dismissOnSelection bool
Whether to dismiss after an emoji is selected.
final
dismissOnTapOutside bool
Whether to dismiss when tapping outside the selector.
final
emojis List<EmojiItem>
List of emojis to display in the selector.
final
enabled bool
Whether the selector is enabled.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
longPressDuration Duration
Duration of long press to trigger (when trigger is longPress).
final
onEmojiSelected ValueChanged<EmojiItem>?
Called when an emoji is selected.
final
onHide VoidCallback?
Called when the selector is hidden.
final
onShow VoidCallback?
Called when the selector is shown.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style EmojiSelectorStyle
Style configuration for the selector.
final
trigger EmojiSelectorTrigger
How to trigger the selector.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<EmojiSelector>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited