John O'Reilly
09/13/2020, 11:14 AMlaunchInComposition as shown here to call suspend function....what's recommended way to show progress indicator (like CircularProgressIndicator) until that function completes?
@Composable
fun MainLayout(sdk: SpaceXSDK) {
var launches by remember { mutableStateOf<List<RocketLaunch>>(emptyList()) }
launchInComposition {
launches = sdk.getLaunches(false)
}
LazyColumnFor(items = launches) { launch ->
LaunchView(launch)
}
}John O'Reilly
09/13/2020, 11:31 AMJetNews sample has something very similar to what I need (with their launchUiStateProducer)Halil Ozercan
09/13/2020, 12:08 PMremember { mutableStateOf(true) } and update that state once your calculation is completed in launchInCompositionHalil Ozercan
09/13/2020, 12:09 PMvar isLoading by remember { mutableStateOf(true) }
launchInComposition {
...
isLoading = false
}
if(isLoading) {
CircularProgressIndicator()
}John O'Reilly
09/13/2020, 12:45 PM