I have home screen which two tabs. now when I get to home tab and got to search instantly. I get red screen for slight second and then all widgets get loaded.
Now where problem is,
in initState()
I'm assigning store.filteredPOI
to widget.floorPlan.pois
.
I'm getting store.filteredPOI
from a network call which will take some time. so in that fraction of time widget.floorPlan
is null so how can I show a loader to prevent the red error screen,
code
class SearchTab extends StatefulWidget {
final FloorPlan floorPlan;
final bool isIndoorMapVisible;
final NetworkStatus networkStatus;
SearchTab({this.floorPlan, this.isIndoorMapVisible,this.networkStatus});
@override
_SearchTabState createState() => _SearchTabState();
}
class _SearchTabState extends State<SearchTab> {
final TextEditingController textController = TextEditingController();
SearchStore store;
@override
void initState() {
store = SearchStore();
store.filteredPOI = widget.floorPlan.pois; //<<<<<<<<
super.initState();
}
@override
Widget build(BuildContext context) {
return (...)