Resolves #160 Flexible entity heigth
This commit is contained in:
@ -13,7 +13,7 @@ class DefaultEntityContainer extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: height,
|
//height: height,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityIcon(),
|
EntityIcon(),
|
||||||
|
@ -9,16 +9,19 @@ class ButtonStateWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final entityModel = EntityModel.of(context);
|
final entityModel = EntityModel.of(context);
|
||||||
return FlatButton(
|
return SizedBox(
|
||||||
onPressed: (() {
|
height: 34.0,
|
||||||
_setNewState(entityModel.entity);
|
child: FlatButton(
|
||||||
}),
|
onPressed: (() {
|
||||||
child: Text(
|
_setNewState(entityModel.entity);
|
||||||
"EXECUTE",
|
}),
|
||||||
textAlign: TextAlign.right,
|
child: Text(
|
||||||
style:
|
"EXECUTE",
|
||||||
new TextStyle(fontSize: Entity.stateFontSize, color: Colors.blue),
|
textAlign: TextAlign.right,
|
||||||
),
|
style:
|
||||||
|
new TextStyle(fontSize: Entity.stateFontSize, color: Colors.blue),
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,19 +4,21 @@ class SimpleEntityState extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final entityModel = EntityModel.of(context);
|
final entityModel = EntityModel.of(context);
|
||||||
return Padding(
|
return Expanded(
|
||||||
padding: EdgeInsets.fromLTRB(
|
child: Padding(
|
||||||
0.0, 0.0, Entity.rightWidgetPadding, 0.0),
|
padding: EdgeInsets.fromLTRB(0.0, 0.0, Entity.rightWidgetPadding, 0.0),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${entityModel.entity.state}${entityModel.entity.unitOfMeasurement}",
|
"${entityModel.entity.state}${entityModel.entity.unitOfMeasurement}",
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: Entity.stateFontSize,
|
fontSize: Entity.stateFontSize,
|
||||||
)),
|
)),
|
||||||
onTap: () => entityModel.handleTap
|
onTap: () => entityModel.handleTap
|
||||||
? eventBus.fire(new ShowEntityPageEvent(entityModel.entity))
|
? eventBus.fire(new ShowEntityPageEvent(entityModel.entity))
|
||||||
: null,
|
: null,
|
||||||
));
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,16 @@ class _SwitchStateWidgetState extends State<SwitchStateWidget> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final entityModel = EntityModel.of(context);
|
final entityModel = EntityModel.of(context);
|
||||||
final entity = entityModel.entity;
|
final entity = entityModel.entity;
|
||||||
|
Widget result;
|
||||||
if ((entity.attributes["assumed_state"] == null) || (entity.attributes["assumed_state"] == false)) {
|
if ((entity.attributes["assumed_state"] == null) || (entity.attributes["assumed_state"] == false)) {
|
||||||
return Switch(
|
result = Switch(
|
||||||
value: entity.assumedState == 'on',
|
value: entity.assumedState == 'on',
|
||||||
onChanged: ((switchState) {
|
onChanged: ((switchState) {
|
||||||
_setNewState(switchState, entity);
|
_setNewState(switchState, entity);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Row(
|
result = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
@ -55,6 +56,9 @@ class _SwitchStateWidgetState extends State<SwitchStateWidget> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return SizedBox(
|
||||||
|
height: 32.0,
|
||||||
|
child: result,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user