Index: samples/swarm/swarm_ui_lib/layout/GridLayout.dart |
diff --git a/samples/swarm/swarm_ui_lib/layout/GridLayout.dart b/samples/swarm/swarm_ui_lib/layout/GridLayout.dart |
index e70179f677d44b80645564c63a62dd0f2952fd92..10526205733be992aa8ad54b6e2cf2c1cdf0b145 100644 |
--- a/samples/swarm/swarm_ui_lib/layout/GridLayout.dart |
+++ b/samples/swarm/swarm_ui_lib/layout/GridLayout.dart |
@@ -154,7 +154,9 @@ class GridLayout extends ViewLayout { |
void _computeUsedBreadthOfTracks(List<GridTrack> tracks) { |
// TODO(jmesserly): as a performance optimization we could cache this |
- final items = CollectionUtils.map(view.childViews, (view_) => view_.layout); |
+ final items = view.childViews |
+ .mappedBy((view_) => view_.layout) |
+ .toList(); |
CollectionUtils.sortBy(items, (item) => _getSpanCount(item)); |
// 1. Initialize per Grid Track variables |
@@ -254,7 +256,7 @@ class GridLayout extends ViewLayout { |
*/ |
num _calcNormalizedFractionBreadth(List<GridTrack> tracks) { |
- final fractionTracks = tracks.filter((t) => t.maxSizing.isFraction); |
+ final fractionTracks = tracks.where((t) => t.maxSizing.isFraction).toList(); |
// Note: the spec has various bugs in this function, such as mismatched |
// identifiers and names that aren't defined. For the most part it's |
@@ -340,8 +342,8 @@ class GridLayout extends ViewLayout { |
void _distributeSpaceBySpanCount(List<ViewLayout> items, |
ContentSizeMode sizeMode, _BreadthAccumulator breadth) { |
- items = items.filter((item) => |
- _hasContentSizedTracks(_getTracks(item), sizeMode, breadth)); |
+ items = items.where((item) => |
+ _hasContentSizedTracks(_getTracks(item), sizeMode, breadth)).toList(); |
var tracks = []; |
@@ -387,7 +389,7 @@ class GridLayout extends ViewLayout { |
sizeMode == ContentSizeMode.MIN && fn.isContentSized) { |
// Make sure we don't cross a fractional track |
- return tracks.length == 1 || !tracks.some((t_) => t_.isFractional); |
+ return tracks.length == 1 || !tracks.any((t_) => t_.isFractional); |
} |
} |
return false; |
@@ -420,7 +422,7 @@ class GridLayout extends ViewLayout { |
* run before the track sizing algorithm. |
*/ |
void _ensureAllTracks() { |
- final items = CollectionUtils.map(view.childViews, (view_) => view_.layout); |
+ final items = view.childViews.mappedBy((view_) => view_.layout); |
for (final child in items) { |
if (child.layoutParams == null) { |
@@ -437,7 +439,7 @@ class GridLayout extends ViewLayout { |
* Given the track sizes that were computed, position children in the grid. |
*/ |
void _setBoundsOfChildren() { |
- final items = CollectionUtils.map(view.childViews, (view_) => view_.layout); |
+ final items = view.childViews.mappedBy((view_) => view_.layout); |
for (final item in items) { |
GridLayoutParams childLayout = item.layoutParams; |
@@ -504,7 +506,7 @@ class GridLayout extends ViewLayout { |
assert(start >= 0 && span >= 1); |
- final result = new List<GridTrack>(span); |
+ final result = new List<GridTrack>.fixedLength(span); |
for (int i = 0; i < span; i++) { |
result[i] = tracks[start + i]; |
} |