stock_list.dart 848 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.stocks, this.onOpen, this.onAction }) : super(key: key);
9 10

  final List<Stock> stocks;
11 12
  final StockRowActionCallback onOpen;
  final StockRowActionCallback onAction;
13

14
  Widget build(BuildContext context) {
15 16 17 18
    return new Material(
      type: MaterialType.canvas,
      child: new ScrollableList<Stock>(
        items: stocks,
19
        itemExtent: StockRow.kHeight,
20 21 22
        itemBuilder: (BuildContext context, Stock stock) {
          return new StockRow(
            stock: stock,
23 24
            onPressed: onOpen,
            onLongPressed: onAction
25 26
          );
        }
27 28 29 30
      )
    );
  }
}