Resolves #162 View names display
This commit is contained in:
parent
1f0bd8059b
commit
5d95c3702d
@ -301,30 +301,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
if (_homeAssistant.ui.views.isNotEmpty) {
|
if (_homeAssistant.ui.views.isNotEmpty) {
|
||||||
_homeAssistant.ui.views.forEach((HAView view) {
|
_homeAssistant.ui.views.forEach((HAView view) {
|
||||||
if (view.linkedEntity == null) {
|
result.add(view.buildTab());
|
||||||
result.add(
|
|
||||||
Tab(
|
|
||||||
icon:
|
|
||||||
Icon(
|
|
||||||
MaterialDesignIcons.createIconDataFromIconName(
|
|
||||||
view.iconName ?? "mdi:home-assistant"),
|
|
||||||
size: 24.0,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
result.add(
|
|
||||||
Tab(
|
|
||||||
icon: MaterialDesignIcons.createIconWidgetFromEntityData(
|
|
||||||
view.linkedEntity, 24.0, null) ??
|
|
||||||
Icon(
|
|
||||||
MaterialDesignIcons.createIconDataFromIconName(
|
|
||||||
"mdi:home-assistant"),
|
|
||||||
size: 24.0,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,42 @@ class HAView {
|
|||||||
cards.addAll(autoGeneratedCards);
|
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) {
|
Widget build(BuildContext context) {
|
||||||
return ViewWidget(
|
return ViewWidget(
|
||||||
view: this,
|
view: this,
|
||||||
|
Reference in New Issue
Block a user