emojis icon indicating copy to clipboard operation
emojis copied to clipboard

Modify API to more closely mirror Flutter's Icon/IconData classes

Open craiglabenz opened this issue 4 years ago • 7 comments

I want to suggest that some of the core classes in this library be slightly restructured to more closely mimic Flutter's Icon and IconData classes.

For example, the current API looks like this:

Emoji womanBlond = Emoji.byChar(Emojis.womanBlondHair);
print(womanBlond)
// 👧

The proposed API would look like:

Emoji womanBlond = Emoji(Emojis.womanBlondHair);

This library would then have 3 core classes:

/// Houses majority of the API that developers touch. All of your existing methods would stay here
/// plus new ones like `emojize` and `demojize`.
class Emoji {}

/// Empty class but for its many constants representing all of the emojis. This would be most similar
/// to your existing `_emojis` list.
class Emojis {
  ...
  static const womanBlondHair = EmojiData('\u{1F471}\u{200D}\u{2640}\u{FE0F}', shortName: 'blond-haired_woman', emojiGroup: EmojiGroup.peopleBody, emojiSubGroup: EmojiSubGroup.person, keywords: [...])
  ...
}

/// Class to hold instance data for a specific emoji. Thousands of these would exist to populate
/// the `Emojis` container class.
class EmojiData {
  final String code;
  final String shortName;
  final EmojiGroup emojiGroup;
  final EmojiSubGroup emojiSubGroup;
  final List<String> keywords;
}

If this seems reasonable, I would be happy to put together a PR. I have lots of emoji functionality I would love to contribute to your library, but wanted to float my ideas for a refactor before diving right in and making changes.

Thanks again for creating emojis -- you have a lot of very cool functionality here!

craiglabenz avatar Sep 06 '20 16:09 craiglabenz

Awesome, please open a PR

i-Naji avatar Sep 07 '20 22:09 i-Naji

Sounds good!

Another question -- where did you source your list of keywords for each emoji? You have a lot of keywords.

craiglabenz avatar Sep 08 '20 17:09 craiglabenz

emojipedia, emojicodes, uemoji, onemoji ... every where ;)

i-Naji avatar Sep 09 '20 13:09 i-Naji

I've been working on a source generator and just noticed that you seem to have one gitignored. Are you possibly able to share that logic?

craiglabenz avatar Sep 09 '20 14:09 craiglabenz

yes, I can share it with you after my voyage which will end in 4, 5 days.

i-Naji avatar Sep 09 '20 20:09 i-Naji

Is this still worked on?

krjw-eyev avatar Feb 25 '21 16:02 krjw-eyev

Is this still worked on?

2022 🦾, Emoji v14 maybe 🤷‍♂️

i-Naji avatar Nov 19 '21 10:11 i-Naji