diff --git a/assets/fonts/Emoji.ttf b/assets/fonts/Emoji.ttf new file mode 100644 index 000000000..f40a13bfd Binary files /dev/null and b/assets/fonts/Emoji.ttf differ diff --git a/assets/fonts/emoji_source.txt b/assets/fonts/emoji_source.txt new file mode 100644 index 000000000..90639d10b --- /dev/null +++ b/assets/fonts/emoji_source.txt @@ -0,0 +1 @@ +https://github.com/googlefonts/noto-emoji/ \ No newline at end of file diff --git a/lib/features/profile/widget/profile_tile.dart b/lib/features/profile/widget/profile_tile.dart index 93b5a9cc6..055534049 100644 --- a/lib/features/profile/widget/profile_tile.dart +++ b/lib/features/profile/widget/profile_tile.dart @@ -391,7 +391,8 @@ class ProfileSubscriptionInfo extends HookConsumerWidget { consumed: subInfo.consumption.sizeGB(), total: subInfo.total.sizeGB(), ), - style: theme.textTheme.bodySmall, + style: theme.textTheme.bodySmall + ?.copyWith(fontFamily: getEmojiFont4Desktop()), overflow: TextOverflow.ellipsis, ), ), diff --git a/lib/features/proxy/widget/proxy_tile.dart b/lib/features/proxy/widget/proxy_tile.dart index 7e305d614..c891dbd32 100644 --- a/lib/features/proxy/widget/proxy_tile.dart +++ b/lib/features/proxy/widget/proxy_tile.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:hiddify/gen/fonts.gen.dart'; import 'package:hiddify/features/proxy/model/proxy_entity.dart'; import 'package:hiddify/utils/custom_loggers.dart'; +import 'package:hiddify/utils/text_utils.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class ProxyTile extends HookConsumerWidget with PresLogger { @@ -24,6 +26,7 @@ class ProxyTile extends HookConsumerWidget with PresLogger { title: Text( proxy.name, overflow: TextOverflow.ellipsis, + style: TextStyle(fontFamily: getEmojiFont4Desktop()), ), leading: Padding( padding: const EdgeInsets.symmetric(vertical: 8), diff --git a/lib/utils/text_utils.dart b/lib/utils/text_utils.dart index a7660f226..4c7decc9b 100644 --- a/lib/utils/text_utils.dart +++ b/lib/utils/text_utils.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:hiddify/gen/fonts.gen.dart'; import 'package:intl/intl.dart' as intl; +import 'dart:io'; extension TextAlignX on BuildContext { bool get isRtl => Directionality.of(this) == TextDirection.rtl; @@ -27,3 +29,10 @@ extension TextEditingControllerX on TextEditingController { return text.textDirection; } } + +String getEmojiFont4Desktop() { + if (Platform.isLinux || Platform.isWindows) { + return FontFamily.emoji; + } + return ""; +} diff --git a/pubspec.yaml b/pubspec.yaml index 2dc27de15..cc13b1f61 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -113,6 +113,9 @@ flutter: - family: Shabnam fonts: - asset: assets/fonts/Shabnam.ttf + - family: Emoji + fonts: + - asset: assets/fonts/Emoji.ttf flutter_gen: output: lib/gen/