-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
size.dart
71 lines (60 loc) · 1.39 KB
/
size.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import 'package:hashcodes/hashcodes.dart';
/// {@template image_size_getter.Size}
///
/// [Size] is a class for image size.
///
/// The size contains [width] and [height].
///
/// {@endtemplate}
///
/// ---
///
/// {@macro image_size_getter.Size.needToRotate}
class Size {
/// {@macro image_size_getter.Size}
///
/// ---
///
/// {@macro image_size_getter.Size.needToRotate}
const Size(
this.width,
this.height, {
this.needRotate = false,
});
/// The width of the media.
final int width;
/// The height of the media.
final int height;
/// {@template image_size_getter.Size.needToRotate}
///
/// If the [needRotate] is true,
/// the [width] and [height] need to be swapped when using.
///
/// Such as, orientation value of the jpeg format is [5, 6, 7, 8].
///
/// {@endtemplate}
final bool needRotate;
/// The [width] is zero and [height] is zero.
static Size zero = Size(0, 0);
@override
String toString() {
return "Size( $width, $height, needRotate: $needRotate )";
}
@override
bool operator ==(Object? obj) {
if (identical(obj, this)) {
return true;
}
if (obj == null) {
return false;
}
if (obj is Size) {
return width == obj.width &&
height == obj.height &&
needRotate == obj.needRotate;
}
return false;
}
@override
int get hashCode => hashValues(width, height);
}