[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
This commit is contained in:
Hixie 2015-04-20 16:35:49 -07:00
parent 0b125319e5
commit c1dd855d2d

View File

@ -20,9 +20,9 @@ class Stocklist extends FixedHeightScrollable {
List<UINode> 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);