transition EmojiPicker to use a primary constructor
This commit is contained in:
parent
4a9f1ed84a
commit
f9a39e6fc7
1 changed files with 10 additions and 21 deletions
|
|
@ -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_category.dart";
|
||||
|
||||
class EmojiPicker extends HookConsumerWidget {
|
||||
const EmojiPicker({
|
||||
this.prependCategories = const IList.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;
|
||||
class const EmojiPicker({
|
||||
final IList<EmojiCategory> prependCategories = const .empty(),
|
||||
final IList<EmojiCategory> appendCategories = const .empty(),
|
||||
|
||||
/// 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.
|
||||
final FutureOr<void> Function(String text)? onFreeText;
|
||||
final FutureOr<void> Function(String text)? onFreeText,
|
||||
|
||||
/// Whether to show the default unicode emoji after [prependCategories],
|
||||
/// 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.
|
||||
final double itemSize;
|
||||
|
||||
final String searchHint;
|
||||
|
||||
final double itemSize = 56,
|
||||
final String searchHint = "Search emoji",
|
||||
super.key,
|
||||
}) extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selectedCategory = useState<int>(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue