transition EmojiPicker to use a primary constructor

This commit is contained in:
Henry Hiles 2026-10-23 20:29:31 -04:00
commit f9a39e6fc7
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -9,36 +9,25 @@ import "package:material_emoji_picker/src/controllers/emoji.dart";
import "package:material_emoji_picker/src/models/emoji.dart"; import "package:material_emoji_picker/src/models/emoji.dart";
import "package:material_emoji_picker/src/models/emoji_category.dart"; import "package:material_emoji_picker/src/models/emoji_category.dart";
class EmojiPicker extends HookConsumerWidget { class const EmojiPicker({
const EmojiPicker({ final IList<EmojiCategory> prependCategories = const .empty(),
this.prependCategories = const IList.empty(), final IList<EmojiCategory> appendCategories = const .empty(),
this.appendCategories = const IList.empty(),
required this.onSelection,
this.onFreeText,
this.includeDefaultEmoji = true,
this.itemSize = 56,
this.searchHint = "Search emoji",
super.key,
});
final IList<EmojiCategory> prependCategories;
final IList<EmojiCategory> appendCategories;
/// Called with the emoji that was selected. /// Called with the emoji that was selected.
final FutureOr<void> Function(Emoji emoji) onSelection; required final FutureOr<void> Function(Emoji emoji) onSelection,
/// If set, the search text can be submitted as is, calling this with it. /// If set, the search text can be submitted as is, calling this with it.
final FutureOr<void> Function(String text)? onFreeText; final FutureOr<void> Function(String text)? onFreeText,
/// Whether to show the default unicode emoji after [prependCategories], /// Whether to show the default unicode emoji after [prependCategories],
/// e.g. false for a sticker picker of only custom categories. /// e.g. false for a sticker picker of only custom categories.
final bool includeDefaultEmoji; final bool includeDefaultEmoji = true,
/// The width and height of each item in the grid. /// The width and height of each item in the grid.
final double itemSize; final double itemSize = 56,
final String searchHint = "Search emoji",
final String searchHint; super.key,
}) extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final selectedCategory = useState<int>(0); final selectedCategory = useState<int>(0);