MenuProperties constructor
MenuProperties({
- required String id,
- TextEditingController? textEditingController,
- dynamic onBackSpacePressed()?,
- dynamic onEmojiSelected(
- Category? category,
- Emoji emoji
- dynamic onGifSelected(
- GiphyGif? gif
- bool fromStack = true,
Implementation
MenuProperties(
{required this.id,
this.textEditingController,
this.onBackSpacePressed,
dynamic Function(Category? category, Emoji emoji)? onEmojiSelected,
dynamic Function(GiphyGif? gif)? onGifSelected,
this.fromStack = true}) {
if (textEditingController != null) {
focusNode = FocusNode();
this.onEmojiSelected = (category, emoji) {
if (Platform.I.isDesktop) {
Get.find<MenuStateController>().close();
}
if (onEmojiSelected != null) {
onEmojiSelected(category, emoji);
}
};
this.onGifSelected = (gif) {
if (Platform.I.isDesktop) {
Get.find<MenuStateController>().close();
}
if (onGifSelected != null) {
onGifSelected(gif);
}
};
focusNode!.addListener(() {
if (focusNode!.hasFocus &&
Get.find<MenuStateController>().isOpened &&
Get.find<MenuStateController>().currentMenu!.id != id) {
Get.find<MenuStateController>().close();
}
});
}
}