mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[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 commitc198a16067
. * Revert "Implement sorting" This reverts commit0fac8c1f1c
. * Revert "Revert "Implement sorting"" This reverts commit0f8ec2381a
. * Revert "Revert "Remove trailing spaces"" This reverts commitc3ef865879
. * xx * add braces
This commit is contained in:
parent
698d438960
commit
948ff0f2b0
@ -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
Loading…
Reference in New Issue
Block a user