We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am on the starter branch. RaceTracker runs right away, and the Start/Pause button does not do anything.
The text was updated successfully, but these errors were encountered:
Here is my workaround
@Composable fun RaceTrackerApp() { val playerOne = remember { RaceParticipant(name = "Player 1", progressIncrement = 1) } val playerTwo = remember { RaceParticipant(name = "Player 2", progressIncrement = 2) } var raceInProgress by remember { mutableStateOf(false) } val scope = rememberCoroutineScope() var playerOneTask by remember { mutableStateOf<Job?>(null) } var playerTwoTask by remember { mutableStateOf<Job?>(null) } // trigger button click event val onRunStateChange = { status: Boolean -> raceInProgress = status // start if (status) { scope.launch { coroutineScope { playerOneTask = launch { playerOne.run() } playerTwoTask = launch { playerTwo.run() } } raceInProgress = false } } // pause if (!status) { playerOneTask?.cancel() playerTwoTask?.cancel() } } RaceTrackerScreen( playerOne = playerOne, playerTwo = playerTwo, isRunning = raceInProgress, onRunStateChange = onRunStateChange, modifier = Modifier .statusBarsPadding() .fillMaxSize() .verticalScroll(rememberScrollState()) .safeDrawingPadding() .padding(horizontal = dimensionResource(R.dimen.padding_medium)), ) }
Sorry, something went wrong.
No branches or pull requests
I am on the starter branch. RaceTracker runs right away, and the Start/Pause button does not do anything.
The text was updated successfully, but these errors were encountered: