This repository has been archived on 2023-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
ha_client/lib/cards/alarm_panel_card.dart

62 lines
1.6 KiB
Dart
Raw Normal View History

2020-04-25 20:38:21 +03:00
part of '../main.dart';
class AlarmPanelCard extends StatelessWidget {
2020-04-27 01:46:37 +03:00
final AlarmPanelCardData card;
2020-04-25 20:38:21 +03:00
const AlarmPanelCard({Key key, this.card}) : super(key: key);
@override
Widget build(BuildContext context) {
2020-04-27 01:46:37 +03:00
if (card.entity.entity.statelessType == StatelessEntityType.missed) {
return EntityModel(
entityWrapper: card.entity,
child: MissedEntityWidget(),
handleTap: false,
);
}
2020-04-25 20:38:21 +03:00
List<Widget> body = [];
body.add(CardHeader(
name: card.name ?? "",
2020-04-27 01:46:37 +03:00
subtitle: Text("${card.entity.entity.displayState}",
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
children: [
EntityIcon(
size: 50.0,
),
Container(
width: 26.0,
child: IconButton(
padding: EdgeInsets.all(0.0),
alignment: Alignment.centerRight,
icon: Icon(MaterialDesignIcons.getIconDataFromIconName(
"mdi:dots-vertical")),
onPressed: () => eventBus.fire(new ShowEntityPageEvent(entityId: card.entity.entity.entityId))
2020-04-25 20:38:21 +03:00
)
2020-04-27 01:46:37 +03:00
)
]
),
2020-04-25 20:38:21 +03:00
));
body.add(
AlarmControlPanelControlsWidget(
extended: true,
states: card.states,
)
);
return CardWrapper(
child: EntityModel(
2020-04-27 01:46:37 +03:00
entityWrapper: card.entity,
2020-04-25 20:38:21 +03:00
handleTap: null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: body
)
)
);
}
}