Resolves #162 View names display

This commit is contained in:
Yegor Vialov
2018-11-04 22:19:45 +02:00
parent 1f0bd8059b
commit 5d95c3702d
2 changed files with 37 additions and 24 deletions

View File

@ -55,6 +55,42 @@ class HAView {
cards.addAll(autoGeneratedCards);
}
Widget buildTab() {
if (linkedEntity == null) {
if (iconName != null) {
return
Tab(
icon:
Icon(
MaterialDesignIcons.createIconDataFromIconName(
iconName ?? "mdi:home-assistant"),
size: 24.0,
)
);
} else {
return
Tab(
text: name.toUpperCase(),
);
}
} else {
if (linkedEntity.icon != null && linkedEntity.icon.length > 0) {
return Tab(
icon: Icon(
MaterialDesignIcons.createIconDataFromIconName(
linkedEntity.icon),
size: 24.0,
)
);
} else {
return Tab(
text: linkedEntity.displayName.toUpperCase(),
);
}
}
}
Widget build(BuildContext context) {
return ViewWidget(
view: this,