1
0
Fork 0
forked from Nexus/nexus

add emoji button to composer

This commit is contained in:
Henry Hiles 2026-04-12 16:46:13 -04:00
commit 6ca974e6fc
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
3 changed files with 52 additions and 23 deletions

View file

@ -0,0 +1,40 @@
import "package:emoji_text_field/emoji_text_field.dart";
import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";
class EmojiPickerButton extends HookWidget {
final TextEditingController? controller;
final void Function(String emoji)? onSelection;
final VoidCallback? onPressed;
final BuildContext context;
const EmojiPickerButton({
this.controller,
this.onPressed,
this.onSelection,
required this.context,
super.key,
});
@override
Widget build(_) => IconButton(
onPressed: () {
onPressed?.call();
final controller = this.controller ?? TextEditingController();
showBottomSheet(
context: context,
builder: (context) => EmojiKeyboardView(
config: EmojiViewConfig(
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
height: 600,
),
textController: controller
..addListener(() async {
Navigator.of(context).pop();
onSelection?.call(controller.text);
}),
),
);
},
icon: Icon(Icons.emoji_emotions),
);
}