Skip to content

Commit 0d7e679

Browse files
authored
[Fonts] Use exact matching for icon identifier rewrites (flutter#86464)
* Fix sorting * Update icons.dart * [Fonts] Use instead matching instead of prefix * Add new
1 parent b549e82 commit 0d7e679

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

dev/tools/update_icons.dart

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,28 @@ const Map<String, List<String>> _platformAdaptiveIdentifiers = <String, List<Str
3535
'share': <String>['share', 'ios_share'],
3636
};
3737

38-
// Rewrite certain Flutter IDs (reserved keywords, numbers) using prefix matching.
38+
// Rewrite certain Flutter IDs (reserved keywords, numbers) using exact matching.
3939
const Map<String, String> identifierRewrites = <String, String>{
4040
'1x': 'one_x',
41+
'1x_mobiledata': 'one_x_mobiledata',
4142
'360': 'threesixty',
4243
'2d': 'twod',
4344
'3d': 'threed',
45+
'3d_rotation': 'threed_rotation',
4446
'3p': 'three_p',
4547
'6_ft': 'six_ft',
48+
'6_ft_apart': 'six_ft_apart',
4649
'3g': 'three_g',
50+
'3g_mobiledata': 'three_g_mobiledata',
4751
'4g': 'four_g',
52+
'4g_mobiledata': 'four_g_mobiledata',
53+
'4g_plus': 'four_g_plus',
54+
'4g_plus_mobiledata': 'four_g_plus_mobiledata',
4855
'5g': 'five_g',
4956
'30fps': 'thirty_fps',
57+
'30fps_select': 'thirty_fps_select',
5058
'60fps': 'sixty_fps',
59+
'60fps_select': 'sixty_fps_select',
5160
'1k': 'one_k',
5261
'2k': 'two_k',
5362
'3k': 'three_k',
@@ -58,6 +67,15 @@ const Map<String, String> identifierRewrites = <String, String>{
5867
'8k': 'eight_k',
5968
'9k': 'nine_k',
6069
'10k': 'ten_k',
70+
'1k_plus': 'one_k_plus',
71+
'2k_plus': 'two_k_plus',
72+
'3k_plus': 'three_k_plus',
73+
'4k_plus': 'four_k_plus',
74+
'5k_plus': 'five_k_plus',
75+
'6k_plus': 'six_k_plus',
76+
'7k_plus': 'seven_k_plus',
77+
'8k_plus': 'eight_k_plus',
78+
'9k_plus': 'nine_k_plus',
6179
'1mp': 'one_mp',
6280
'2mp': 'two_mp',
6381
'3mp': 'three_mp',
@@ -83,6 +101,8 @@ const Map<String, String> identifierRewrites = <String, String>{
83101
'23mp': 'twenty_three_mp',
84102
'24mp': 'twenty_four_mp',
85103
'class': 'class_',
104+
'new': 'new_',
105+
'switch': 'switch_',
86106
'try': 'try_sms_star',
87107
};
88108

@@ -346,7 +366,7 @@ class _Icon {
346366

347367
flutterId = id;
348368
for (final MapEntry<String, String> rewritePair in identifierRewrites.entries) {
349-
if (id.startsWith(rewritePair.key)) {
369+
if (shortId == rewritePair.key) {
350370
flutterId = id.replaceFirst(rewritePair.key, identifierRewrites[rewritePair.key]!);
351371
}
352372
}

0 commit comments

Comments
 (0)