Fix dashboard switching issues

This commit is contained in:
Yegor Vialov 2020-04-21 09:01:21 +00:00
parent 82d7aeba02
commit 513bf85cae
3 changed files with 11 additions and 15 deletions

View File

@ -88,11 +88,11 @@ class CardWidget extends StatelessWidget {
) )
).toList(); ).toList();
return Row( return Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: children, children: children,
); );
} }
return Container(height: 0.0, width: 0.0,); return Container(height: 0.0, width: 0.0,);
} }

View File

@ -111,7 +111,6 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
} }
void _quickLoad({bool uiOnly: false}) { void _quickLoad({bool uiOnly: false}) {
_bottomInfoBarController.hideBottomBar();
_bottomInfoBarController.showInfoBottomBar(progress: true,); _bottomInfoBarController.showInfoBottomBar(progress: true,);
ConnectionManager().init(loadSettings: false, forceReconnect: false).then((_){ ConnectionManager().init(loadSettings: false, forceReconnect: false).then((_){
_fetchData(useCache: false, uiOnly: uiOnly); _fetchData(useCache: false, uiOnly: uiOnly);
@ -127,7 +126,10 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
}); });
} }
await HomeAssistant().fetchData(uiOnly).then((_) { await HomeAssistant().fetchData(uiOnly).then((_) {
_bottomInfoBarController.hideBottomBar(); setState((){
_bottomInfoBarController.hideBottomBar();
});
HomeAssistant().saveCache();
}).catchError((e) { }).catchError((e) {
if (e is HAError) { if (e is HAError) {
_setErrorState(e); _setErrorState(e);
@ -144,7 +146,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded && !_preventAppRefresh) { if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded && !_preventAppRefresh) {
_quickLoad(); _quickLoad();
} else if (state == AppLifecycleState.paused && ConnectionManager().settingsLoaded && !_preventAppRefresh) { } else if (state == AppLifecycleState.paused && ConnectionManager().settingsLoaded && !_preventAppRefresh) {
HomeAssistant().saveCache(); //HomeAssistant().saveCache();
} }
} }

View File

@ -61,13 +61,7 @@ class HomeAssistantUI {
} }
List<Widget> _buildViews(BuildContext context) { List<Widget> _buildViews(BuildContext context) {
List<Widget> result = []; return views.map((view) => view.build(context)).toList();
views.forEach((view) {
result.add(
view.build(context)
);
});
return result;
} }
void clear() { void clear() {