decoration.dart 954 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 'basic_types.dart';
6 7 8 9 10 11 12 13 14 15 16 17
import 'edge_dims.dart';

export 'edge_dims.dart' show EdgeDims;

// This group of classes is intended for painting in cartesian coordinates.

abstract class Decoration {
  const Decoration();
  bool debugAssertValid() => true;
  EdgeDims get padding => null;
  Decoration lerpFrom(Decoration a, double t) => this;
  Decoration lerpTo(Decoration b, double t) => b;
18
  bool hitTest(Size size, Point position) => true;
19
  bool get needsListeners => false;
20 21
  void addChangeListener(VoidCallback listener) { assert(false); }
  void removeChangeListener(VoidCallback listener) { assert(false); }
22 23 24 25 26
  BoxPainter createBoxPainter();
  String toString([String prefix = '']) => '$prefix$runtimeType';
}

abstract class BoxPainter {
27
  void paint(Canvas canvas, Rect rect);
28
}