颜色判断

hmxc
张萌 3 years ago
parent 7eaa5b917e
commit f99caa685c

@ -33,6 +33,12 @@ class BraceletModel {
} }
} }
bool get heartNormal => heartRate >= 60 && heartRate <= 100;
bool get sbpNormal => sbp >= 90 && sbp <= 139;
bool get dbpNormal => dbp >= 60 && dbp <= 89;
const BraceletModel({ const BraceletModel({
required this.sbp, required this.sbp,
required this.todaySteps, required this.todaySteps,

@ -135,12 +135,12 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
var mid = Row( var mid = Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'141' '${_model?.sbp}'
.richText .richText
.withTextSpanChildren([]) .withTextSpanChildren([])
.size(48.sp) .size(48.sp)
.bold .bold
.color(Colors.red) .color(_model!.sbpNormal ? Color(0xFF37C6BD) : Colors.red)
.make(), .make(),
8.w.widthBox, 8.w.widthBox,
Column( Column(
@ -167,12 +167,12 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
var right = Row( var right = Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'86' '${_model?.dbp}'
.richText .richText
.withTextSpanChildren([]) .withTextSpanChildren([])
.size(48.sp) .size(48.sp)
.bold .bold
.color(Color(0xFF37C6BD)) .color(_model!.dbpNormal ? Color(0xFF37C6BD) : Colors.red)
.make(), .make(),
8.w.widthBox, 8.w.widthBox,
Column( Column(
@ -252,7 +252,7 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
]) ])
.size(56.sp) .size(56.sp)
.bold .bold
.color(Colors.red) .color(_model!.heartNormal ? Color(0xFF37C6BD) : Colors.red)
.make(), .make(),
Spacer(), Spacer(),
'正常为60-100次/分' '正常为60-100次/分'

Loading…
Cancel
Save