Last active
September 25, 2019 21:30
-
-
Save Laimiux/dbcc0762af6793ba6c1bdffdeadc7c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun startStopButton(state: State, context: FormulaContext<State>): ButtonRenderModel { | |
return if (state.isRunning) { | |
ButtonRenderModel( | |
text = "Stop", | |
onSelected = context.callback { | |
transition(state.copy(isRunning = false)) | |
} | |
) | |
} else { | |
ButtonRenderModel( | |
text = "Start", | |
onSelected = context.callback { | |
transition(state.copy(isRunning = true)) | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment