WIP #183 Custom names and icons
This commit is contained in:
@ -77,20 +77,15 @@ class Entity {
|
||||
}
|
||||
|
||||
Widget buildDefaultWidget(BuildContext context) {
|
||||
return EntityModel(
|
||||
entity: this,
|
||||
child: DefaultEntityContainer(
|
||||
state: _buildStatePart(context)
|
||||
),
|
||||
handleTap: true,
|
||||
return DefaultEntityContainer(
|
||||
state: _buildStatePart(context)
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildGlanceWidget(BuildContext context) {
|
||||
return EntityModel(
|
||||
entity: this,
|
||||
child: GlanceEntityContainer(),
|
||||
handleTap: true,
|
||||
Widget buildGlanceWidget(BuildContext context, bool showName, bool showState) {
|
||||
return GlanceEntityContainer(
|
||||
showName: showName,
|
||||
showState: showState,
|
||||
);
|
||||
}
|
||||
|
||||
@ -111,7 +106,7 @@ class Entity {
|
||||
|
||||
Widget buildEntityPageWidget(BuildContext context) {
|
||||
return EntityModel(
|
||||
entity: this,
|
||||
entity: EntityWrapper(entity: this),
|
||||
child: EntityPageContainer(children: <Widget>[
|
||||
DefaultEntityContainer(state: _buildStatePartForPage(context)),
|
||||
LastUpdatedWidget(),
|
||||
@ -133,7 +128,7 @@ class Entity {
|
||||
|
||||
Widget buildBadgeWidget(BuildContext context) {
|
||||
return EntityModel(
|
||||
entity: this,
|
||||
entity: EntityWrapper(entity: this),
|
||||
child: BadgeWidget(),
|
||||
handleTap: true,
|
||||
);
|
||||
|
14
lib/entity_class/entity_wrapper.class.dart
Normal file
14
lib/entity_class/entity_wrapper.class.dart
Normal file
@ -0,0 +1,14 @@
|
||||
part of '../main.dart';
|
||||
|
||||
class EntityWrapper {
|
||||
|
||||
String displayName;
|
||||
String icon;
|
||||
Entity entity;
|
||||
|
||||
EntityWrapper({this.entity, String icon, String displayName}) {
|
||||
this.icon = icon ?? entity.icon;
|
||||
this.displayName = displayName ?? entity.displayName;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user