aspectRatio property
double
get
aspectRatio
Returns size.width
/ size.height
.
Will return 1.0
if:
- isInitialized is
false
size.width
, orsize.height
is equal to0.0
- aspect ratio would be less than or equal to
0.0
Implementation
double get aspectRatio {
if (!isInitialized || size.width == 0 || size.height == 0) {
return 1.0;
}
final double aspectRatio = size.width / size.height;
if (aspectRatio <= 0) {
return 1.0;
}
return aspectRatio;
}