Minor gauge fixes
This commit is contained in:
parent
37e63637a7
commit
6508f109f7
@ -291,13 +291,14 @@ class CardWidget extends StatelessWidget {
|
|||||||
Widget _buildGaugeCard(BuildContext context) {
|
Widget _buildGaugeCard(BuildContext context) {
|
||||||
card.linkedEntityWrapper.displayName = card.name ??
|
card.linkedEntityWrapper.displayName = card.name ??
|
||||||
card.linkedEntityWrapper.displayName;
|
card.linkedEntityWrapper.displayName;
|
||||||
|
card.linkedEntityWrapper.unitOfMeasurement = card.unit ??
|
||||||
|
card.linkedEntityWrapper.unitOfMeasurement;
|
||||||
return Card(
|
return Card(
|
||||||
child: EntityModel(
|
child: EntityModel(
|
||||||
entityWrapper: card.linkedEntityWrapper,
|
entityWrapper: card.linkedEntityWrapper,
|
||||||
child: GaugeCardBody(
|
child: GaugeCardBody(
|
||||||
min: card.min,
|
min: card.min,
|
||||||
max: card.max,
|
max: card.max,
|
||||||
unit: card.unit ?? card.linkedEntityWrapper.entity.unitOfMeasurement,
|
|
||||||
severity: card.severity,
|
severity: card.severity,
|
||||||
),
|
),
|
||||||
handleTap: true
|
handleTap: true
|
||||||
|
@ -4,10 +4,9 @@ class GaugeCardBody extends StatefulWidget {
|
|||||||
|
|
||||||
final int min;
|
final int min;
|
||||||
final int max;
|
final int max;
|
||||||
final String unit;
|
|
||||||
final Map severity;
|
final Map severity;
|
||||||
|
|
||||||
GaugeCardBody({Key key, this.min, this.max, this.unit, this.severity}) : super(key: key);
|
GaugeCardBody({Key key, this.min, this.max, this.severity}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_GaugeCardBodyState createState() => _GaugeCardBodyState();
|
_GaugeCardBodyState createState() => _GaugeCardBodyState();
|
||||||
@ -104,11 +103,15 @@ class _GaugeCardBodyState extends State<GaugeCardBody> {
|
|||||||
double fontSize = constraints.maxHeight / 7;
|
double fontSize = constraints.maxHeight / 7;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: 2*fontSize),
|
padding: EdgeInsets.only(bottom: 2*fontSize),
|
||||||
child: Text(
|
child: SimpleEntityState(
|
||||||
'${entityWrapper.entity.doubleState}${widget.unit}',
|
//textAlign: TextAlign.center,
|
||||||
|
expanded: false,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
bold: true,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: fontSize),
|
textAlign: TextAlign.center,
|
||||||
|
padding: EdgeInsets.all(0.0),
|
||||||
|
fontSize: fontSize,
|
||||||
|
//padding: EdgeInsets.only(top: Sizes.rowPadding),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -121,11 +124,12 @@ class _GaugeCardBodyState extends State<GaugeCardBody> {
|
|||||||
double fontSize = constraints.maxHeight / 7;
|
double fontSize = constraints.maxHeight / 7;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: fontSize),
|
padding: EdgeInsets.only(bottom: fontSize),
|
||||||
child: Text(
|
child: EntityName(
|
||||||
'${entityWrapper.displayName}',
|
fontSize: fontSize,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
padding: EdgeInsets.all(0.0),
|
||||||
style: TextStyle(fontSize: fontSize),
|
textAlign: TextAlign.center,
|
||||||
|
textOverflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ class EntityWrapper {
|
|||||||
|
|
||||||
String displayName;
|
String displayName;
|
||||||
String icon;
|
String icon;
|
||||||
|
String unitOfMeasurement;
|
||||||
String entityPicture;
|
String entityPicture;
|
||||||
EntityUIAction uiAction;
|
EntityUIAction uiAction;
|
||||||
Entity entity;
|
Entity entity;
|
||||||
@ -24,6 +25,7 @@ class EntityWrapper {
|
|||||||
if (uiAction == null) {
|
if (uiAction == null) {
|
||||||
uiAction = EntityUIAction();
|
uiAction = EntityUIAction();
|
||||||
}
|
}
|
||||||
|
unitOfMeasurement = entity.unitOfMeasurement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class BadgeWidget extends StatelessWidget {
|
|||||||
} else if (entityModel.entityWrapper.entity.displayState.length <= 10) {
|
} else if (entityModel.entityWrapper.entity.displayState.length <= 10) {
|
||||||
stateFontSize = 8.0;
|
stateFontSize = 8.0;
|
||||||
}
|
}
|
||||||
onBadgeTextValue = entityModel.entityWrapper.entity.unitOfMeasurement;
|
onBadgeTextValue = entityModel.entityWrapper.unitOfMeasurement;
|
||||||
badgeIcon = Center(
|
badgeIcon = Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${entityModel.entityWrapper.entity.displayState}",
|
"${entityModel.entityWrapper.entity.displayState}",
|
||||||
|
@ -7,8 +7,10 @@ class SimpleEntityState extends StatelessWidget {
|
|||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
final String customValue;
|
final String customValue;
|
||||||
|
final double fontSize;
|
||||||
|
final bool bold;
|
||||||
|
|
||||||
const SimpleEntityState({Key key, this.maxLines: 10, this.expanded: true, this.textAlign: TextAlign.right, this.padding: const EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0), this.customValue}) : super(key: key);
|
const SimpleEntityState({Key key,this.bold: false, this.maxLines: 10, this.fontSize: Sizes.stateFontSize, this.expanded: true, this.textAlign: TextAlign.right, this.padding: const EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0), this.customValue}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -21,18 +23,22 @@ class SimpleEntityState extends StatelessWidget {
|
|||||||
state = customValue;
|
state = customValue;
|
||||||
}
|
}
|
||||||
TextStyle textStyle = TextStyle(
|
TextStyle textStyle = TextStyle(
|
||||||
fontSize: Sizes.stateFontSize,
|
fontSize: this.fontSize,
|
||||||
|
fontWeight: FontWeight.normal
|
||||||
);
|
);
|
||||||
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.CALL_SERVICE) {
|
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.CALL_SERVICE) {
|
||||||
textStyle = textStyle.apply(color: Colors.blue);
|
textStyle = textStyle.apply(color: Colors.blue);
|
||||||
}
|
}
|
||||||
|
if (this.bold) {
|
||||||
|
textStyle = textStyle.apply(fontWeightDelta: 100);
|
||||||
|
}
|
||||||
while (state.contains(" ")){
|
while (state.contains(" ")){
|
||||||
state = state.replaceAll(" ", " ");
|
state = state.replaceAll(" ", " ");
|
||||||
}
|
}
|
||||||
Widget result = Padding(
|
Widget result = Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
child: Text(
|
child: Text(
|
||||||
"$state ${entityModel.entityWrapper.entity.unitOfMeasurement}",
|
"$state ${entityModel.entityWrapper.unitOfMeasurement}",
|
||||||
textAlign: textAlign,
|
textAlign: textAlign,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
Reference in New Issue
Block a user