2015-07-16 18:54:25 +00:00
|
|
|
// 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.
|
|
|
|
|
2015-07-24 17:53:34 +00:00
|
|
|
part of stocks;
|
2015-07-16 18:54:25 +00:00
|
|
|
|
2015-09-28 20:58:07 +00:00
|
|
|
class StockList extends StatelessComponent {
|
2015-12-02 06:48:36 +00:00
|
|
|
StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
|
2015-07-16 18:54:25 +00:00
|
|
|
|
2015-12-02 06:48:36 +00:00
|
|
|
final Object keySalt;
|
2015-07-16 18:54:25 +00:00
|
|
|
final List<Stock> stocks;
|
2015-10-02 17:20:08 +00:00
|
|
|
final StockRowActionCallback onOpen;
|
2015-11-11 23:38:13 +00:00
|
|
|
final StockRowActionCallback onShow;
|
2015-10-02 17:20:08 +00:00
|
|
|
final StockRowActionCallback onAction;
|
2015-07-16 18:54:25 +00:00
|
|
|
|
2015-09-25 23:00:56 +00:00
|
|
|
Widget build(BuildContext context) {
|
2015-10-19 19:08:53 +00:00
|
|
|
return new ScrollableList<Stock>(
|
|
|
|
items: stocks,
|
|
|
|
itemExtent: StockRow.kHeight,
|
2015-11-12 19:26:58 +00:00
|
|
|
itemBuilder: (BuildContext context, Stock stock, int index) {
|
2015-10-19 19:08:53 +00:00
|
|
|
return new StockRow(
|
2015-12-02 06:48:36 +00:00
|
|
|
keySalt: keySalt,
|
2015-10-19 19:08:53 +00:00
|
|
|
stock: stock,
|
|
|
|
onPressed: onOpen,
|
2015-11-11 23:38:13 +00:00
|
|
|
onDoubleTap: onShow,
|
2015-10-19 19:08:53 +00:00
|
|
|
onLongPressed: onAction
|
|
|
|
);
|
|
|
|
}
|
2015-07-16 18:54:25 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|