[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 c198a16067.

* Revert "Implement sorting"

This reverts commit 0fac8c1f1c.

* Revert "Revert "Implement sorting""

This reverts commit 0f8ec2381a.

* Revert "Revert "Remove trailing spaces""

This reverts commit c3ef865879.

* xx

* add braces
This commit is contained in:
Pierre-Louis 2021-03-09 16:14:18 +01:00 committed by GitHub
parent 698d438960
commit 948ff0f2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6587 additions and 6575 deletions

View File

@ -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