stock_list.dart 995 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 6 7 8
import 'package:flutter/material.dart';

import 'stock_data.dart';
import 'stock_row.dart';
9

10
class StockList extends StatelessComponent {
11
  StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
12

13
  final Object keySalt;
14
  final List<Stock> stocks;
15
  final StockRowActionCallback onOpen;
16
  final StockRowActionCallback onShow;
17
  final StockRowActionCallback onAction;
18

19
  Widget build(BuildContext context) {
20
    return new ScrollableList(
21
      key: const ValueKey<String>('stock-list'),
22
      itemExtent: StockRow.kHeight,
23
      children: stocks.map((Stock stock) {
24
        return new StockRow(
25
          keySalt: keySalt,
26 27
          stock: stock,
          onPressed: onOpen,
28
          onDoubleTap: onShow,
29 30
          onLongPressed: onAction
        );
31
      })
32 33 34
    );
  }
}