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

22 lines
597 B
Dart
Raw Normal View History

2018-10-27 14:27:41 +03:00
part of '../main.dart';
class EntityModel extends InheritedWidget {
const EntityModel({
Key key,
@required this.entityWrapper,
2018-10-27 14:27:41 +03:00
@required this.handleTap,
@required Widget child,
}) : super(key: key, child: child);
final EntityWrapper entityWrapper;
2018-10-27 14:27:41 +03:00
final bool handleTap;
static EntityModel of(BuildContext context) {
2020-04-25 20:38:21 +03:00
return context.dependOnInheritedWidgetOfExactType<EntityModel>();
2018-10-27 14:27:41 +03:00
}
@override
2020-04-25 20:38:21 +03:00
bool updateShouldNotify(EntityModel oldWidget) {
return entityWrapper.entity.lastUpdatedTimestamp != oldWidget.entityWrapper.entity.lastUpdatedTimestamp;
2018-10-27 14:27:41 +03:00
}
}