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/entities/entity_model.widget.dart
2020-04-25 17:38:21 +00:00

22 lines
597 B
Dart

part of '../main.dart';
class EntityModel extends InheritedWidget {
const EntityModel({
Key key,
@required this.entityWrapper,
@required this.handleTap,
@required Widget child,
}) : super(key: key, child: child);
final EntityWrapper entityWrapper;
final bool handleTap;
static EntityModel of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<EntityModel>();
}
@override
bool updateShouldNotify(EntityModel oldWidget) {
return entityWrapper.entity.lastUpdatedTimestamp != oldWidget.entityWrapper.entity.lastUpdatedTimestamp;
}
}