【发布时间】:2021-11-19 02:07:32
【问题描述】:
我试图用红色为我的超重和体重不足添加颜色。你能帮我告诉我该怎么做吗?
代码如下:
import 'dart:math';
class CalculatorBrain {
CalculatorBrain({this.height, this.weight});
final int height;
final int weight;
double _bmi;
String calculateBMI() {
_bmi = weight / pow(height / 100, 2);
return _bmi.toStringAsFixed(1);
}
String getResults(){
if (_bmi >= 25) {
return 'Overweight';
} else if (_bmi > 18.5) {
return 'Normal';
} else {
return 'Underweight';
}
}
String getInterpretation () {
if (_bmi >= 25) {
return 'You have a higher than normal weight. Try to exercise more.';
} else if (_bmi > 18.5) {
return 'You have a normal body weight. Good job!';
} else {
return 'You have a lower than normal body weight. You can eat a bit more.';
}
}
}
【问题讨论】:
-
请明确在超重和超重时要显示为红色的内容。
-
对于超重和减重我想使用红色
标签: flutter flutter-layout flutter-web flutter-animation