Commit 23283319 authored by Hixie's avatar Hixie

[Effen] Only skip rows we're showing, when skipping past the rows that we've...

[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
parent 9fd7ed7a
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment