forked from firka/flutter
[Fonts] Sort material icons (#76691)
* Update update_icons.dart * Merge and simplify identifier rewrites * Update update_icons.dart * Update update_icons.dart * Update update_icons.dart * Add newline * remove whitespace * Copy instead of moving * Fix typo * Clean up code Introduce fullFlutterId and fix a small dartdoc bug * Update update_icons.dart * Implement sorting * Remove trailing spaces * Revert "Remove trailing spaces" This reverts commit c198a160678f636add30966a016383657ea76972. * Revert "Implement sorting" This reverts commit 0fac8c1f1c8ba1ce867f5d5205e3d6f751c08a89. * Revert "Revert "Implement sorting"" This reverts commit 0f8ec2381ac87b44f43554d267783a5cc2375172. * Revert "Revert "Remove trailing spaces"" This reverts commit c3ef8658799e4f7aab851ff830d62ca2bb9aba94. * xx * add braces
This commit is contained in:
@@ -244,7 +244,9 @@ Map<String, String> stringToTokenPairMap(String codepointData) {
|
||||
}
|
||||
|
||||
String regenerateIconsFile(String iconData, Map<String, String> tokenPairMap) {
|
||||
final Iterable<_Icon> newIcons = tokenPairMap.entries.map((MapEntry<String, String> entry) => _Icon(entry));
|
||||
final List<_Icon> newIcons = tokenPairMap.entries.map((MapEntry<String, String> entry) => _Icon(entry)).toList();
|
||||
newIcons.sort((_Icon a, _Icon b) => a._compareTo(b));
|
||||
|
||||
final StringBuffer buf = StringBuffer();
|
||||
bool generating = false;
|
||||
|
||||
@@ -388,6 +390,16 @@ class _Icon {
|
||||
@override
|
||||
String toString() => id;
|
||||
|
||||
/// Analogous to [String.compareTo]
|
||||
int _compareTo(_Icon b) {
|
||||
// Sort a regular icon before its variants.
|
||||
if (shortId == b.shortId) {
|
||||
return id.length - b.id.length;
|
||||
} else {
|
||||
return flutterId.compareTo(b.flutterId);
|
||||
}
|
||||
}
|
||||
|
||||
String _replaceLast(String string, String toReplace) {
|
||||
return string.replaceAll(RegExp('$toReplace\$'), '');
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user