This commit is contained in:
Yegor Vialov
2018-11-24 00:37:55 +02:00
parent 215871ce9e
commit 73398378c4
7 changed files with 111 additions and 129 deletions

View File

@ -10,27 +10,14 @@ class EntityIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
final entityModel = EntityModel.of(context);
return InkWell(
child: Padding(
padding: padding,
child: MaterialDesignIcons.createIconWidgetFromEntityData(
entityModel.entityWrapper,
iconSize,
EntityColor.stateColor(entityModel.entityWrapper.entity.state)
),
final EntityWrapper entityWrapper = EntityModel.of(context).entityWrapper;
return Padding(
padding: padding,
child: MaterialDesignIcons.createIconWidgetFromEntityData(
entityWrapper,
iconSize,
EntityColor.stateColor(entityWrapper.entity.state)
),
onLongPress: () {
if (entityModel.handleTap) {
entityModel.entityWrapper.handleHold();
}
},
onTap: () {
if (entityModel.handleTap) {
entityModel.entityWrapper.handleTap();
}
}
);
}
}