icon_button.dart 1008 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
import 'package:flutter/widgets.dart';
6 7

import 'icon.dart';
Adam Barth's avatar
Adam Barth committed
8
import 'icon_theme_data.dart';
9
import 'ink_well.dart';
10

11
class IconButton extends StatelessComponent {
12 13 14 15 16 17 18
  const IconButton({
    Key key,
    this.icon,
    this.color,
    this.colorFilter,
    this.onPressed
  }) : super(key: key);
19 20

  final String icon;
21
  final IconThemeColor color;
Adam Barth's avatar
Adam Barth committed
22
  final ColorFilter colorFilter;
23
  final VoidCallback onPressed;
24

25
  Widget build(BuildContext context) {
26
    return new InkResponse(
27
      onTap: onPressed,
28
      child: new Padding(
29 30
        padding: const EdgeDims.all(8.0),
        child: new Icon(
31
          icon: icon,
32 33 34 35
          color: color,
          colorFilter: colorFilter
        )
      )
36 37
    );
  }
Hixie's avatar
Hixie committed
38 39 40 41 42

  void debugFillDescription(List<String> description) {
    super.debugFillDescription(description);
    description.add('$icon');
  }
43
}