Unverified Commit 0d7e6798 authored by Pierre-Louis's avatar Pierre-Louis Committed by GitHub

[Fonts] Use exact matching for icon identifier rewrites (#86464)

* Fix sorting

* Update icons.dart

* [Fonts] Use instead matching instead of prefix

* Add new
parent b549e829
...@@ -35,19 +35,28 @@ const Map<String, List<String>> _platformAdaptiveIdentifiers = <String, List<Str ...@@ -35,19 +35,28 @@ const Map<String, List<String>> _platformAdaptiveIdentifiers = <String, List<Str
'share': <String>['share', 'ios_share'], 'share': <String>['share', 'ios_share'],
}; };
// Rewrite certain Flutter IDs (reserved keywords, numbers) using prefix matching. // Rewrite certain Flutter IDs (reserved keywords, numbers) using exact matching.
const Map<String, String> identifierRewrites = <String, String>{ const Map<String, String> identifierRewrites = <String, String>{
'1x': 'one_x', '1x': 'one_x',
'1x_mobiledata': 'one_x_mobiledata',
'360': 'threesixty', '360': 'threesixty',
'2d': 'twod', '2d': 'twod',
'3d': 'threed', '3d': 'threed',
'3d_rotation': 'threed_rotation',
'3p': 'three_p', '3p': 'three_p',
'6_ft': 'six_ft', '6_ft': 'six_ft',
'6_ft_apart': 'six_ft_apart',
'3g': 'three_g', '3g': 'three_g',
'3g_mobiledata': 'three_g_mobiledata',
'4g': 'four_g', '4g': 'four_g',
'4g_mobiledata': 'four_g_mobiledata',
'4g_plus': 'four_g_plus',
'4g_plus_mobiledata': 'four_g_plus_mobiledata',
'5g': 'five_g', '5g': 'five_g',
'30fps': 'thirty_fps', '30fps': 'thirty_fps',
'30fps_select': 'thirty_fps_select',
'60fps': 'sixty_fps', '60fps': 'sixty_fps',
'60fps_select': 'sixty_fps_select',
'1k': 'one_k', '1k': 'one_k',
'2k': 'two_k', '2k': 'two_k',
'3k': 'three_k', '3k': 'three_k',
...@@ -58,6 +67,15 @@ const Map<String, String> identifierRewrites = <String, String>{ ...@@ -58,6 +67,15 @@ const Map<String, String> identifierRewrites = <String, String>{
'8k': 'eight_k', '8k': 'eight_k',
'9k': 'nine_k', '9k': 'nine_k',
'10k': 'ten_k', '10k': 'ten_k',
'1k_plus': 'one_k_plus',
'2k_plus': 'two_k_plus',
'3k_plus': 'three_k_plus',
'4k_plus': 'four_k_plus',
'5k_plus': 'five_k_plus',
'6k_plus': 'six_k_plus',
'7k_plus': 'seven_k_plus',
'8k_plus': 'eight_k_plus',
'9k_plus': 'nine_k_plus',
'1mp': 'one_mp', '1mp': 'one_mp',
'2mp': 'two_mp', '2mp': 'two_mp',
'3mp': 'three_mp', '3mp': 'three_mp',
...@@ -83,6 +101,8 @@ const Map<String, String> identifierRewrites = <String, String>{ ...@@ -83,6 +101,8 @@ const Map<String, String> identifierRewrites = <String, String>{
'23mp': 'twenty_three_mp', '23mp': 'twenty_three_mp',
'24mp': 'twenty_four_mp', '24mp': 'twenty_four_mp',
'class': 'class_', 'class': 'class_',
'new': 'new_',
'switch': 'switch_',
'try': 'try_sms_star', 'try': 'try_sms_star',
}; };
...@@ -346,7 +366,7 @@ class _Icon { ...@@ -346,7 +366,7 @@ class _Icon {
flutterId = id; flutterId = id;
for (final MapEntry<String, String> rewritePair in identifierRewrites.entries) { for (final MapEntry<String, String> rewritePair in identifierRewrites.entries) {
if (id.startsWith(rewritePair.key)) { if (shortId == rewritePair.key) {
flutterId = id.replaceFirst(rewritePair.key, identifierRewrites[rewritePair.key]!); flutterId = id.replaceFirst(rewritePair.key, identifierRewrites[rewritePair.key]!);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment