hp property
double
get
hp
Returns the value as a percentage of the screen height.
Example:
double halfScreen = 50.0.hp;
Implementation
double get hp {
assert(this >= 0 && this <= 100, 'Percent must be between 0 and 100');
try {
final screenHeight = Get.height;
if (screenHeight <= 0) {
return this * 6.67; // Fallback assuming 667px base height
}
return (screenHeight * (this / 100)).roundToDouble();
} catch (e) {
return this * 6.67; // Fallback if GetX is not properly initialized
}
}