From c1dd855d2d1023055f046690859153530d2b41ef Mon Sep 17 00:00:00 2001 From: Hixie Date: Mon, 20 Apr 2015 16:35:49 -0700 Subject: [PATCH] [Effen] Only skip rows we're showing, when skipping past the rows that we've scrolled beyond in the stock list. Currently, if you then scroll down N items with a filter set, we select which stock to show by taking the entire list of stocks, skipping the first N, then filtering the list, then selecting as many stocks as needed to fill the list. So suppose the list is A, B, Cx, Dx, Ex, F, and the filter is "x", and you've scrolled down 1 item. Currently we'd show Cx, Dx, Ex. Scroll down 1 again. We still show Cx, Dx, Ex. What we _should_ show is Dx, Ex if you've scrolled down 1, and just Ex if you've scrolled two. This patch fixes this. We now skip rows _after_ filtering. This fixes the bug whereby if you set a filter then fling the list, we show the same item over and over as if in a loop. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1057603006 --- examples/stocks/lib/stock_list.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stocks/lib/stock_list.dart b/examples/stocks/lib/stock_list.dart index 4ad488ac2d9..2e6e5bbf1d9 100644 --- a/examples/stocks/lib/stock_list.dart +++ b/examples/stocks/lib/stock_list.dart @@ -20,9 +20,9 @@ class Stocklist extends FixedHeightScrollable { List buildItems(int start, int count) { return stocks - .skip(start) .where((stock) => query == null || stock.symbol.contains( new RegExp(query, caseSensitive: false))) + .skip(start) .take(count) .map((stock) => new StockRow(stock: stock)) .toList(growable: false);