Line data Source code
1 14 : enum ResizeType {
2 : clip,
3 : crop,
4 : scale,
5 : fill,
6 : }
7 :
8 : extension _ResizeX on ResizeType {
9 2 : String? get name => {
10 : ResizeType.clip: 'clip',
11 : ResizeType.crop: 'crop',
12 : ResizeType.scale: 'scale',
13 : ResizeType.fill: 'fill',
14 1 : }[this];
15 : }
16 :
17 : ///
18 : class Resize {
19 : ///
20 2 : const Resize(
21 : this._width,
22 : this._height, {
23 : ResizeType type = ResizeType.clip,
24 2 : }) : assert(_width > 0, 'Width should be a positive number'),
25 2 : assert(_height > 0, 'Height should be a positive number'),
26 : _type = type;
27 :
28 : final int _width;
29 : final int _height;
30 : final ResizeType _type;
31 :
32 : ///
33 2 : Map<String, Object?> get params => <String, Object?>{
34 2 : 'resize': _type.name,
35 1 : 'w': _width,
36 1 : 'h': _height,
37 : };
38 : }
|