Skip to content

Commit

Permalink
new: add support for flag emoji in proxy names
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Mar 7, 2024
1 parent d16d013 commit 141faa4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
Binary file added assets/fonts/Emoji.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions assets/fonts/emoji_source.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/googlefonts/noto-emoji/
3 changes: 2 additions & 1 deletion lib/features/profile/widget/profile_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
Expand Down
3 changes: 3 additions & 0 deletions lib/features/proxy/widget/proxy_tile.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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),
Expand Down
9 changes: 9 additions & 0 deletions lib/utils/text_utils.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,3 +29,10 @@ extension TextEditingControllerX on TextEditingController {
return text.textDirection;
}
}

String getEmojiFont4Desktop() {
if (Platform.isLinux || Platform.isWindows) {
return FontFamily.emoji;
}
return "";
}
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit 141faa4

Please sign in to comment.