diff --git a/lib/pages/main.page.dart b/lib/pages/main.page.dart index 817d1ec..18d101f 100644 --- a/lib/pages/main.page.dart +++ b/lib/pages/main.page.dart @@ -139,12 +139,6 @@ class _MainPageState extends ReceiveShareState with WidgetsBindingObse } await HomeAssistant().fetchData().then((_) { _hideBottomBar(); - int currentViewCount = HomeAssistant().ui?.views?.length ?? 0; - if (_previousViewCount != currentViewCount) { - Logger.d("Views count changed ($_previousViewCount->$currentViewCount). Creating new tabs controller."); - _viewsTabController = TabController(vsync: this, length: currentViewCount); - _previousViewCount = currentViewCount; - } if (_entityToShow != null) { _entityToShow = HomeAssistant().entities.get(_entityToShow.entityId); } @@ -643,6 +637,13 @@ class _MainPageState extends ReceiveShareState with WidgetsBindingObse List> serviceMenuItems = []; List> mediaMenuItems = []; + int currentViewCount = HomeAssistant().ui?.views?.length ?? 0; + if (_previousViewCount != currentViewCount) { + Logger.d("Views count changed ($_previousViewCount->$currentViewCount). Creating new tabs controller."); + _viewsTabController = TabController(vsync: this, length: currentViewCount); + _previousViewCount = currentViewCount; + } + serviceMenuItems.add(PopupMenuItem( child: new Text("Reload"), value: "reload",