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/entity_name.dart

28 lines
745 B
Dart
Raw Normal View History

2018-10-27 14:27:41 +03:00
part of '../main.dart';
class EntityName extends StatelessWidget {
2018-11-14 19:52:17 +02:00
final EdgeInsetsGeometry padding;
const EntityName({Key key, this.padding: const EdgeInsets.only(right: 10.0)}) : super(key: key);
2018-10-27 14:27:41 +03:00
@override
Widget build(BuildContext context) {
final entityModel = EntityModel.of(context);
return GestureDetector(
child: Padding(
2018-11-14 19:52:17 +02:00
padding: padding,
2018-10-27 14:27:41 +03:00
child: Text(
"${entityModel.entity.displayName}",
overflow: TextOverflow.ellipsis,
2018-11-14 19:52:17 +02:00
softWrap: true,
2018-11-12 20:28:10 +02:00
style: TextStyle(fontSize: Sizes.nameFontSize),
2018-10-27 14:27:41 +03:00
),
),
onTap: () =>
entityModel.handleTap
? eventBus.fire(new ShowEntityPageEvent(entityModel.entity))
: null,
);
}
}