Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
* change Emojis() class API to static -> Generally `Emojis()` becomes simply `Emojis` (without brackets at the end)

* change  `Emojis().get` to `Emojis.all`:

* remove `any`, `replaceEach`, `hasAny`, `hasEach` and `everyOf`

* introduce new `Emoji()` constructor that takes single emoji as parameter

* add shortcut methods and getters from  package collection

* export package collection

* add topics and small logo

* update CHANGELOG

* update README

* bump version to 1.0.0
  • Loading branch information
Nikoro authored Apr 8, 2024
1 parent 78f2dac commit d240af7
Show file tree
Hide file tree
Showing 59 changed files with 12,560 additions and 6,961 deletions.
418 changes: 418 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2,213 changes: 1,832 additions & 381 deletions README.md

Large diffs are not rendered by default.

200 changes: 101 additions & 99 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,54 +1,29 @@
import 'package:emoji_extension/emoji_extension.dart';

void main() {
final emojis = Emojis().get;
// print(emojis);
/* Emoji(
value: 😀,
unicode: 1F600,
name: Grinning Face,
appleName: Grinning Face,
alsoKnownAs: [Happy Face, Smiley Face],
group: Smileys & Emotion,
subgroup: face-smiling,
version: 8.0,
status: fully-qualified,
shortcodes: [
Shortcode(
platform: Default,
values: [grinning_face]
),
Shortcode(
platform: CLDR,
values: [grinning_face]
),
Shortcode(
platform: Discord,
values: [grinning]
),
Shortcode(
platform: Github,
values: [grinning]
),
Shortcode(
platform: Slack,
values: [grinning]
)]
),
Emoji(
value: 😃,
unicode: 1F603,
name: Grinning Face with Big Eyes,
appleName: Grinning Face with Big Eyes
alsoKnownAs: [Grinning Face, Happy Face, Happy, Smiley Face],
group: Smileys & Emotion,
subgroup: face-smiling,
version: 6.0,
status: fully-qualified
shortcodes: [...]
)
...
] */
final shortcode = Emoji('❤️').shortcode;
// print(shortcode); // :red_heart:

final hasSkinTone = Emoji('👍🏻').hasSkinTone;
// print(hasSkinTone); // true

final isMultiPerson = Emoji('👪').isMultiPerson;
// print(isMultiPerson); // true

final isV13_0 = Emoji('🥷').isV13_0;
// print(isV13_0); // true

final isAnimal = Emoji('🦊').isAnimal;
// print(isAnimal); // true

final hasFace = Emoji('😃').hasFace;
// print(hasFace); // true

final hasColor = Emoji('🩵').hasColor;
// print(hasColor); // true

final emojis = Emojis.all;
// print(emojis); // [Emoji(value: 😀, ...), Emoji(value: 😃, ...), ...]

final values = emojis.values;
// print(values); // [😀, 😃, 😄, 😁, 😆, 😅, 🤣, 😂, 🙂, 🙃, 🫠, 😉, 😊, 😇, 🥰, 😍, ...]
Expand Down Expand Up @@ -96,61 +71,84 @@ void main() {
// print(statuses); // [Status.fullyQualified, Status.fullyQualified, ...]
// print(statuses.values); // [fully-qualified, fully-qualified, ...]

final availableVersions = Emojis().versions;
final availableVersions = Emojis.versions;
// print(availableVersions); // [Version.v6_0, Version.v7_0, Version.v8_0, Version.v9_0, ...]
// print(availableVersions.values); // [6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 12.1, 13.0, ...]

final availableStatuses = Emojis().statuses;
final availableStatuses = Emojis.statuses;
// print(availableStatuses); // [Status.fullyQualified, Status.minimallyQualified, ...]
// print(availableStatuses.values); // [fully-qualified, minimally-qualified, unqualified, ...]

final availableGroups = Emojis().groups;
final availableColors = Emojis.colors;
// print(availableColors); // [Color.red, Color.pink, Color.orange, Color.yellow, ...]
// print(availableColors.values); // [red, pink, orange, yellow, green, blue, light blue, ...]

final availableHairStyles = Emojis.hairStyles;
// print(availableHairStyles); // [HairStyle.blond, HairStyle.red, HairStyle.curly, ...]
// print(availableHairStyles.values); // [1F471, 1F9B0, 1F9B1, 1F9B3, 1F9B2]

final availableSkinTones = Emojis.skinTones;
// print(availableSkinTones); // [SkinTone.light, SkinTone.mediumLight, ...]
// print(availableSkinTones.values); // [1F3FB, 1F3FC, 1F3FD, 1F3FE, 1F3FF]

final availableGroups = Emojis.groups;
// print(availableGroups); // [Group.smileysAndEmotion, Group.peopleAndBody, Group.component, ...]
// print(availableGroups.values); // [Smileys & Emotion, People & Body, Component, Animals & Nature, ...]

final availableSubgroups = Emojis().subgroups;
final availableSubgroups = Emojis.subgroups;
// print(availableSubgroups); // [Subgroup.faceSmiling, Subgroup.faceAffection, Subgroup.faceTongue, ...]
// print(availableSubgroups.values); // face-smiling, face-affection, face-tongue, face-hand, ...]

final groupsWithSubgroups = Emojis().groupsWithSubgroups;
final groupsWithSubgroups = Emojis.groupsWithSubgroups;
// print(groupsWithSubgroups); // {Group.smileysAndEmotion: [Subgroup.faceSmiling, ...], ...}

final groupsWithSubgroupsValues = Emojis().groupsWithSubgroupsValues;
final groupsWithSubgroupsValues = Emojis.groupsWithSubgroupsValues;
// print(groupsWithSubgroupsValues); // {Smileys & Emotion: [face-smiling, ...], ...}

final shortcodePlatforms = Emojis().shortcodePlatforms;
final shortcodePlatforms = Emojis.shortcodePlatforms;
// print(shortcodePlatforms); // [Default, CLDR, Discord, Github, Slack]

final name = Emojis().getOne('😀').name;
final name = Emojis.getOne('😀').name;
// print(name); // Grinning face

final nameOrNull = Emojis().getOneOrNull('some unknown value')?.name;
final nameOrNull = Emojis.getOneOrNull('some unknown value')?.name;
// print(nameOrNull); // null

final smileysAndEmotion = Emojis().smileysAndEmotion;
final smileysAndEmotion = Emojis.smileysAndEmotion;
// print(smileysAndEmotion); // [Emoji(value: 😀, ...), Emoji(value: 😃, ...), ...]

final faceSmiling = Emojis().faceSmiling;
final faceSmiling = Emojis.faceSmiling;
// print(faceSmiling); // [Emoji(value: 😀, ...), Emoji(value: 😃, ...), ...]

final contains = '😀text😀'.emojis.contains;
// print(contains); // true

final only = '😀text😀'.emojis.only;
final only = '😀 😀'.emojis.only;
// print(only); // true

final onlyOne = '😀text😀'.emojis.onlyOne;
final onlyOne = '😀'.emojis.onlyOne;
// print(onlyOne); // true

final count = '😀text😀'.emojis.count;
// print(count); // 3
// print(count); // 2

final countWhere = '😀text🔴text😀'.emojis.countWhere((e) => e.hasFace);
// print(countWhere); // 2

final remove = '😀text😀'.emojis.remove;
// print(remove); // text text text
// print(remove); // text

final removeWhere =
'😀text👍🏻text😀'.emojis.removeWhere((e) => e.hasSkinTone);
// print(removeWhere); // 😀texttext😀

final split = '😀text😀'.emojis.split;
// print(split); // [text, text]

final splitWhere =
'😀text👍🏻text😀'.emojis.splitWhere((e) => e.value == '👍🏻');
// print(splitWhere); // [😀text, text😀]

final extract = '👍️te👍🏻xt👍🏼te👍🏽xt👍🏾te👍🏿xt'.emojis.extract;
// print(extract); // [👍, 👍🏻, 👍🏼, 👍🏽, 👍🏾, 👍🏿]
// print(extract.first); // 👍
Expand All @@ -163,46 +161,11 @@ void main() {
// print(extract.last); // 👍🏿

final emoji = '😀text'.emojis.get;
// print(emoji);
/* [Emoji(
value: 😀,
unicode: 1F600,
name: Grinning Face,
appleName: Grinning Face,
alsoKnownAs: [Happy Face, Smiley Face],
group: Smileys & Emotion,
subgroup: face-smiling,
version: 8.0,
status: fully-qualified,
shortcodes: [
Shortcode(
platform: Default,
values: [grinning_face]
),
Shortcode(
platform: CLDR,
values: [grinning_face]
),
Shortcode(
platform: Discord,
values: [grinning]
),
Shortcode(
platform: Github,
values: [grinning]
),
Shortcode(
platform: Slack,
values: [grinning]
)]
)] */
// print(emoji); Emoji(value: 😀, ...)

final anyOf = '👍️text'.emojis.anyOf(['👍']);
// print(anyOf); // true

final everyOf = '👍️text'.emojis.everyOf(['👍']);
// print(everyOf); // true

final splitMapJoin = 'text😀text'.emojis.splitMapJoin(
onMatch: (_) => '_emoji_',
onNonMatch: (s) => s.toUpperCase(),
Expand Down Expand Up @@ -239,4 +202,43 @@ void main() {
final fromShortcodes =
'text:woman_facepalming_tone4:text'.emojis.fromShortcodes();
// print(fromShortcodes); // text🤦🏾‍♀️text

final take = '😀text🤦🏾‍♀️'.emojis.take(1);
// print(take); // Emoji(value: 😀, ...)

final takeLast = '😀text🤦🏾‍♀️'.emojis.takeLast(1);
// print(takeLast); // Emoji(value: 🤦🏾‍♀️, ...)

final first = '😀text🤦🏾‍♀️'.emojis.first;
// print(first); // Emoji(value: 😀, ...)

final penultimate = '😀text🤦🏾‍♀️'.emojis.penultimate;
// print(penultimate); // Emoji(value: 😀, ...)

final second = '😀text🤦🏾‍♀️'.emojis.second;
// print(second); // Emoji(value: 🤦🏾‍♀️, ...)

final last = '😀text🤦🏾‍♀️'.emojis.last;
// print(last); // Emoji(value: 🤦🏾‍♀️, ...)

final thirdOrNull = '😀text🤦🏾‍♀️'.emojis.thirdOrNull;
// print(thirdOrNull); // null

final removeFirst = '😀text🤦🏾‍♀️'.emojis.removeFirst;
// print(removeFirst); // text🤦🏾‍♀️

final removePenultimate = '😀text🤦🏾‍♀️'.emojis.removePenultimate;
// print(removePenultimate); // text🤦🏾‍♀️

final removeSecond = '😀text🤦🏾‍♀️'.emojis.removeSecond;
// print(removeSecond); // 😀text

final removeLast = '😀text🤦🏾‍♀️'.emojis.removeLast;
// print(removeLast); // 😀text

final removeThird = '😀text🤦🏾‍♀️'.emojis.removeThird;
// print(removeThird); // 😀text🤦🏾‍♀️

final any = '😀text🤦🏾‍♀️'.emojis.any((e) => e.value == '😀');
// print(any); // true
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.0"
version: "1.0.0"
sdks:
dart: ">=2.19.6 <4.0.0"
10 changes: 8 additions & 2 deletions lib/emoji_extension.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
library emoji_extension;

import 'package:emoji_extension/src/emojis/emoji_parser.dart';
import 'package:emoji_extension/src/emojis/emoji_parser/emoji_parser.dart';

export 'src/emojis/emoji.dart';
export 'package:collection/collection.dart';

export 'src/emojis/color.dart';
export 'src/emojis/emoji_parser/emoji_parser.dart';
export 'src/emojis/emojis.dart';
export 'src/emojis/group.dart';
export 'src/emojis/hair_style.dart';
export 'src/emojis/platform.dart';
export 'src/emojis/shortcode.dart';
export 'src/emojis/skin_tone.dart';
export 'src/emojis/status.dart';
export 'src/emojis/subgroup.dart';
export 'src/emojis/version.dart';
Expand Down
51 changes: 51 additions & 0 deletions lib/src/emojis/color.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/// Enum representing the color of an emoji.
enum Color {
/// Red color of emoji.
red('red'),

/// Pink color of emoji.
pink('pink'),

/// Orange color of emoji.
orange('orange'),

/// Yellow color of emoji.
yellow('yellow'),

/// Green color of emoji.
green('green'),

/// Blue color of emoji.
blue('blue'),

/// Light blue color of emoji.
lightBlue('light blue'),

/// Purple color of emoji.
purple('purple'),

/// Brown color of emoji.
brown('brown'),

/// Black color of emoji.
black('black'),

/// Grey color of emoji.
grey('grey'),

/// White color of emoji.
white('white');

/// Creates a new Color object with the given String value.
const Color(this.value);

/// Returns the Color enum value that matches the given [value].
///
/// If no match is found, this method throws a [StateError].
factory Color.from(String value) {
return values.firstWhere((v) => v.value == value);
}

/// The String value of the color.
final String value;
}
Loading

0 comments on commit d240af7

Please sign in to comment.