stock_list.dart 922 Bytes
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
part of stocks;
6

7
class StockList extends StatelessComponent {
8
  StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
9

10
  final Object keySalt;
11
  final List<Stock> stocks;
12
  final StockRowActionCallback onOpen;
13
  final StockRowActionCallback onShow;
14
  final StockRowActionCallback onAction;
15

16
  Widget build(BuildContext context) {
17 18 19
    return new ScrollableList<Stock>(
      items: stocks,
      itemExtent: StockRow.kHeight,
20
      itemBuilder: (BuildContext context, Stock stock, int index) {
21
        return new StockRow(
22
          keySalt: keySalt,
23 24
          stock: stock,
          onPressed: onOpen,
25
          onDoubleTap: onShow,
26 27 28
          onLongPressed: onAction
        );
      }
29 30 31
    );
  }
}