OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Extends the generated _Gradient interface via the CustomDart attribute. | |
6 | |
7 class Gradient extends _Gradient { | |
8 // TODO(mpcomplete): Support other gradient types. | |
9 // TODO(mpcomplete): Should we pas a list of (color, colorStop) pairs instead? | |
eseidel
2015/06/08 17:26:57
pas -> pass
Matt Perry
2015/06/08 17:43:53
Done.
| |
10 Gradient.Linear(List<Point> endPoints, | |
11 List<Color> colors, | |
12 List<double> colorStops) | |
13 : super(0, endPoints, colors, _validate(colorStops, colors)); | |
14 | |
15 // TODO(mpcomplete): Figure out a good way to validate arguments. | |
16 static List<double> _validate(colorStops, colors) { | |
17 if (colorStops != null && colors.length != colorStops.length) { | |
18 throw new ArgumentError( | |
19 "[colors] and [colorStops] parameters must be equal length."); | |
20 } | |
21 return colorStops; | |
22 } | |
23 } | |
OLD | NEW |