Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
✨ Add emoji font and default fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
999eagle committed Mar 28, 2019
1 parent 27f1a33 commit 4653bd9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
Binary file added assets/fonts/emojione.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion lib/widgets/theming/primary_accent_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class OBPrimaryAccentText extends StatelessWidget {
TextStyle themedTextStyle = TextStyle(
foreground: Paint()
..shader = themeValueParserService
.parseGradient(theme.primaryAccentColor).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0)));
.parseGradient(theme.primaryAccentColor).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0)),
fontFamilyFallback: ['NunitoSans', 'Emoji']);

if (finalStyle != null) {
finalStyle = finalStyle.merge(themedTextStyle);
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/theming/secondary_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class OBSecondaryText extends StatelessWidget {
TextStyle finalStyle = style;
TextStyle themedTextStyle = TextStyle(
color:
themeValueParserService.parseColor(theme.secondaryTextColor));
themeValueParserService.parseColor(theme.secondaryTextColor),
fontFamilyFallback: ['NunitoSans', 'Emoji']);

if (finalStyle != null) {
finalStyle = finalStyle.merge(themedTextStyle);
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/theming/smart_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class OBSmartText extends StatelessWidget {
themeValueParserService.parseColor(theme.primaryTextColor);

TextStyle textStyle =
TextStyle(color: primaryTextColor, fontSize: fontSize, fontFamilyFallback: ['NunitoSans']);
TextStyle(color: primaryTextColor, fontSize: fontSize, fontFamilyFallback: ['NunitoSans', 'Emoji']);

Color actionsForegroundColor = themeValueParserService
.parseGradient(theme.primaryAccentColor)
Expand All @@ -273,6 +273,7 @@ class OBSmartText extends StatelessWidget {
color: actionsForegroundColor,
fontSize: fontSize,
fontWeight: FontWeight.bold,
fontFamilyFallback: ['NunitoSans', 'Emoji'],
);

return RichText(
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/theming/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class OBText extends StatelessWidget {

TextStyle themedTextStyle = TextStyle(
color: themeValueParserService.parseColor(theme.primaryTextColor),
fontFamilyFallback: ['NunitoSans'],
fontFamilyFallback: ['NunitoSans', 'Emoji'],
fontSize: (style != null && style.fontSize != null)
? style.fontSize
: fontSize);
Expand Down
5 changes: 5 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ flutter:
style: normal
- asset: assets/fonts/VisbyRoundCF-Bold.otf
style: italic
# Generic name to allow changing the emoji font later on
- family: Emoji
fonts:
- asset: assets/fonts/emojione.ttf
style: normal
- family: ''
fonts:
- asset: assets/fonts/NunitoSans-Regular.ttf
Expand Down

0 comments on commit 4653bd9

Please sign in to comment.