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

@ -90,7 +90,7 @@ class CardWidget extends StatelessWidget {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
);
}

View File

@ -111,7 +111,6 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
}
void _quickLoad({bool uiOnly: false}) {
_bottomInfoBarController.hideBottomBar();
_bottomInfoBarController.showInfoBottomBar(progress: true,);
ConnectionManager().init(loadSettings: false, forceReconnect: false).then((_){
_fetchData(useCache: false, uiOnly: uiOnly);
@ -127,7 +126,10 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
});
}
await HomeAssistant().fetchData(uiOnly).then((_) {
setState((){
_bottomInfoBarController.hideBottomBar();
});
HomeAssistant().saveCache();
}).catchError((e) {
if (e is HAError) {
_setErrorState(e);
@ -144,7 +146,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded && !_preventAppRefresh) {
_quickLoad();
} 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> result = [];
views.forEach((view) {
result.add(
view.build(context)
);
});
return result;
return views.map((view) => view.build(context)).toList();
}
void clear() {