Reputation: 59
How can i display the screen on the left if there are no Chat List is empty and display the screen on the right, if the Message List is populated.
Upvotes: 0
Views: 209
Reputation: 888
Well, we've many solution for this. U asked about show a circularprogressbar too, right?
So...
list.isEmpty
? EmptyScreen()
: DataScreen()
In EmptyScreen.dart :
Future<void> loadingData() async{
setState(() {isLoading = true;});
await call_your_loading_data_function();
setState(() {isLoading = false;});
}
and in your layout section of EmptyScreen.dart:
(isLoading)
? CircularProgressIndicator()
: Container()
You can change Container() by any other component that you want.
Upvotes: 2