stock_list.dart 938 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 StatelessWidget {
11
  StockList({ Key key, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
12 13

  final List<Stock> stocks;
14
  final StockRowActionCallback onOpen;
15
  final StockRowActionCallback onShow;
16
  final StockRowActionCallback onAction;
17

18
  @override
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 25 26
        return new StockRow(
          stock: stock,
          onPressed: onOpen,
27
          onDoubleTap: onShow,
28 29
          onLongPressed: onAction
        );
30
      })
31 32 33
    );
  }
}