Resolves #515 tabs controller issue
This commit is contained in:
		| @@ -139,12 +139,6 @@ class _MainPageState extends ReceiveShareState<MainPage> with WidgetsBindingObse | |||||||
|     } |     } | ||||||
|     await HomeAssistant().fetchData().then((_) { |     await HomeAssistant().fetchData().then((_) { | ||||||
|       _hideBottomBar(); |       _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) { |       if (_entityToShow != null) { | ||||||
|         _entityToShow = HomeAssistant().entities.get(_entityToShow.entityId); |         _entityToShow = HomeAssistant().entities.get(_entityToShow.entityId); | ||||||
|       } |       } | ||||||
| @@ -643,6 +637,13 @@ class _MainPageState extends ReceiveShareState<MainPage> with WidgetsBindingObse | |||||||
|     List<PopupMenuItem<String>> serviceMenuItems = []; |     List<PopupMenuItem<String>> serviceMenuItems = []; | ||||||
|     List<PopupMenuItem<String>> mediaMenuItems = []; |     List<PopupMenuItem<String>> 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<String>( |     serviceMenuItems.add(PopupMenuItem<String>( | ||||||
|       child: new Text("Reload"), |       child: new Text("Reload"), | ||||||
|       value: "reload", |       value: "reload", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user