fetch emoji list from gemoji for a more complete emoji list
This commit is contained in:
parent
b93f4c979c
commit
313dc377ec
4 changed files with 131 additions and 19 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import "package:emoji_text_field/emoji_text_field.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:nexus/controllers/emoji_controller.dart";
|
||||
|
||||
class EmojiPickerButton extends HookWidget {
|
||||
class EmojiPickerButton extends HookConsumerWidget {
|
||||
final TextEditingController? controller;
|
||||
final void Function(String emoji)? onSelection;
|
||||
final VoidCallback? onPressed;
|
||||
|
|
@ -16,25 +17,31 @@ class EmojiPickerButton extends HookWidget {
|
|||
});
|
||||
|
||||
@override
|
||||
Widget build(_) => IconButton(
|
||||
onPressed: () {
|
||||
Widget build(_, WidgetRef ref) => IconButton(
|
||||
onPressed: () async {
|
||||
onPressed?.call();
|
||||
final controller = this.controller ?? TextEditingController();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => EmojiKeyboardView(
|
||||
config: EmojiViewConfig(
|
||||
showRecentTab: false,
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
height: 600,
|
||||
|
||||
final emojis = await ref.watch(EmojiController.provider.future);
|
||||
if (context.mounted) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => EmojiKeyboardView(
|
||||
config: EmojiViewConfig(
|
||||
showRecentTab: false,
|
||||
customCategories: emojis.$1.unlock,
|
||||
customKeywords: emojis.$2.unlock,
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
height: 600,
|
||||
),
|
||||
textController: controller
|
||||
..addListener(() async {
|
||||
Navigator.of(context).pop();
|
||||
onSelection?.call(controller.text);
|
||||
}),
|
||||
),
|
||||
textController: controller
|
||||
..addListener(() async {
|
||||
Navigator.of(context).pop();
|
||||
onSelection?.call(controller.text);
|
||||
}),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.emoji_emotions),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue