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 Jun 7, 2019
1 parent 73a65c5 commit 360edd9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 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 @@ -28,7 +28,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
5 changes: 3 additions & 2 deletions lib/widgets/theming/smart_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class OBSmartText extends StatelessWidget {
TextStyle textStyle = TextStyle(
color: primaryTextColor,
fontSize: fontSize,
fontFamilyFallback: ['NunitoSans']);
fontFamilyFallback: ['NunitoSans', 'Emoji']);

TextStyle secondaryTextStyle;

Expand All @@ -386,7 +386,7 @@ class OBSmartText extends StatelessWidget {
secondaryTextStyle = TextStyle(
color: secondaryTextColor,
fontSize: fontSize * 0.8,
fontFamilyFallback: ['NunitoSans']);
fontFamilyFallback: ['NunitoSans', 'Emoji']);
}

Color actionsForegroundColor = themeValueParserService
Expand All @@ -397,6 +397,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 @@ -166,6 +166,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 360edd9

Please sign in to comment.