Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: samples/swarm/swarm_ui_lib/layout/GridLayout.dart

Issue 11414069: Make mappedBy lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e20d2d8138d0c0c4090ca8781b86ab786b8ac7ab..41ec8f38a989e81b61a84b56241dc25c10f6a496 100644
--- a/samples/swarm/swarm_ui_lib/layout/GridLayout.dart
+++ b/samples/swarm/swarm_ui_lib/layout/GridLayout.dart
@@ -152,7 +152,9 @@ class GridLayout extends ViewLayout {
void _computeUsedBreadthOfTracks(List<GridTrack> tracks) {
// TODO(jmesserly): as a performance optimization we could cache this
- final items = CollectionUtils.mappedBy(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
@@ -418,7 +420,7 @@ class GridLayout extends ViewLayout {
* run before the track sizing algorithm.
*/
void _ensureAllTracks() {
- final items = CollectionUtils.mappedBy(view.childViews, (view_) => view_.layout);
+ final items = view.childViews.mappedBy((view_) => view_.layout);
for (final child in items) {
if (child.layoutParams == null) {
@@ -435,7 +437,7 @@ class GridLayout extends ViewLayout {
* Given the track sizes that were computed, position children in the grid.
*/
void _setBoundsOfChildren() {
- final items = CollectionUtils.mappedBy(view.childViews, (view_) => view_.layout);
+ final items = view.childViews.mappedBy((view_) => view_.layout);
for (final item in items) {
GridLayoutParams childLayout = item.layoutParams;

Powered by Google App Engine
This is Rietveld 408576698