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/entity_widgets/default_entity_container.dart

40 lines
856 B
Dart
Raw Normal View History

2018-10-27 14:27:41 +03:00
part of '../main.dart';
class DefaultEntityContainer extends StatelessWidget {
DefaultEntityContainer({
Key key,
2018-11-04 22:57:53 +02:00
@required this.state
2018-10-27 14:27:41 +03:00
}) : super(key: key);
final Widget state;
@override
Widget build(BuildContext context) {
2018-11-24 00:37:55 +02:00
final EntityModel entityModel = EntityModel.of(context);
return InkWell(
onLongPress: () {
if (entityModel.handleTap) {
entityModel.entityWrapper.handleHold();
}
},
onTap: () {
if (entityModel.handleTap) {
entityModel.entityWrapper.handleTap();
}
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
EntityIcon(),
2018-11-18 16:40:12 +02:00
2018-11-24 00:37:55 +02:00
Flexible(
fit: FlexFit.tight,
flex: 3,
child: EntityName(),
),
state
],
),
2018-10-27 14:27:41 +03:00
);
}
}