Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offline use implemented and lottie json files added #3

Merged
merged 7 commits into from
May 30, 2023

Conversation

hsbijarniya
Copy link
Contributor

All lottie json files are added into lib/lottie folder.

To use asset lottie file one have to do following two thing.

1. Update pubspec.yaml
flutter:
assets:
- packages/animated_emoji/lottie/rocket.json
- packages/animated_emoji/lottie/clapDark.json

2. Change lottie loading source
Set loading source value to 'asset' before using AnimatedEmoji

void main() async {
...
AnimatedEmoji.source = 'asset';
...
}

all lottie json files are added into lib folder
@hsbijarniya hsbijarniya mentioned this pull request May 8, 2023
all emoji available at noto emoji website were added and updated.
Comment on lines -1 to -21
/// The skin tone used for emojis
enum SkinTone {
/// 🤙🏻Light skin tone
light,

/// 🤙🏼 Medium Light skin tone
mediumLight,

/// 🤙🏽 Medium skin tone
medium,

/// 🤙🏾 Medium Dark skin tone
mediumDark,

/// 🤙🏿 Dark skin tone
dark,

/// 🤙 Default yellow skin tone.
@Deprecated('Use a value of null instead')
simpson,
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the option to pass on skin tone color is much better as developer/user might store the preferred skin tone and we can just pass on this enum.

Else, we would have to map the preference with emoji skin color from AnimatedEmojis.values and it'll get too much complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but that would come up with one down side while importing json asset in pubspec.yaml

Like developer want to use muscle emoji with dark skin tone in asset json mode then he/she have to import file

packages/animated_emoji/lottie/muscleDark.json

and have to use this in code

AnimatedEmojis.muscle(SkinTone.dark)

but without this SkinTone enum

AnimatedEmojis.muscleDark

that is same as asset file imported

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hsbijarniya, sorry but I didn't understand. Can you please elaborate more?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OutdatedGuy I think he means that it would be more consistent when the name of the emoji in the assets always corresponds to the name used in flutter.

In addition, it would be confusing when importing for example packages/animated_emoji/lottie/muscle.json because this does not allow you to use all variations of AnimatedEmojis.muscle and the names in flutter do not make it clear what the other files should be called that you need to import to use all variations.

You can now configure the source for every AnimatedEmoji widget
///
/// For example: `u1f603` => smileWithBigEyes
static String getCamelCaseName(String id) {
const idToNames = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is missing some ids. For example, when I'm trying to display unicorn emoji, I get a null check error.

@RoundedInfinity RoundedInfinity merged commit 82168a5 into RoundedInfinity:main May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants