Skip to content

Instantly share code, notes, and snippets.

@anoochit
Created June 9, 2022 08:16
Show Gist options
  • Save anoochit/f9803954f3af26cf27abd5370e142686 to your computer and use it in GitHub Desktop.
Save anoochit/f9803954f3af26cf27abd5370e142686 to your computer and use it in GitHub Desktop.
bmi calculator
double bmi = _weight / ((_height / 100) * (_height / 100));
setState(() {
if (bmi < 18.5) {
_result = "Underweight";
_color = Colors.lightBlue;
} else if (bmi < 25) {
_result = "Normal";
_color = Colors.green;
} else if (bmi < 30) {
_result = "Overweight";
_color = Colors.amber;
} else {
_result = "Obese";
_color = Colors.red;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment