-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
all lottie json files are added into lib folder
all emoji available at noto emoji website were added and updated.
/// 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, | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
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';
...
}