echoAllStyleClass function
Implementation
String echoAllStyleClass(List<StyleElement> list) {
var map = <int, List<_StyleElementWithPathName>>{};
var resultList = _getAllStyleElementWithPathName(list);
resultList
.where((element) => element.styleElement.width != null)
.toList()
.forEach((element) {
element.styleElement.width?.keys.forEach((width) {
if (!map.containsKey(width)) {
map[width] = <_StyleElementWithPathName>[];
}
map[width]!.add(element);
});
});
var keys = map.keys.toList();
keys.sort();
// ,
return [
_mergeEchoStyle(
resultList.where((e) => e.styleElement.style != null).toList(),
),
keys.reversed
.map(
(width) => [
'@media screen and (max-width: ${width}px) {\n',
_mergeEchoStyle(map[width]!, width),
'}\n',
].join(),
)
.toList()
.join('\n'),
].join('\n');
}