With fritz1.0-RC8 we added a bunch of convenience-render-functions to reduce boilerplate-code within the ui-sections, such as renderIf({/*some boolean expression */}) { ... }. In many cases however, we have to work with boolean Flows which lead to code like this:
someBooleanFlow.renderIf({ it }) {
/* render UI */
}
This looks not as clean as it could.
Solution
This PR adds two convenience functions Flow<Boolean>.renderIfTrue(...) and Flow<Boolean>.renderIfFalse(...) that render a given content if a boolean Flow's value is true or false respectively.
Examples:
val store = storeOf(true)
store.data.renderIfTrue {
// content is rendered if the Store's value is true.
// If the Store's value is false, nothing is rendered.
}
val store = storeOf(false)
store.data.renderIfFalse {
// content is rendered if the Store's value is false.
// If the Store's value is true, nothing is rendered.
}
Motivation
With fritz1.0-RC8 we added a bunch of convenience-render-functions to reduce boilerplate-code within the ui-sections, such as
renderIf({/*some boolean expression */}) { ... }
. In many cases however, we have to work with boolean Flows which lead to code like this:This looks not as clean as it could.
Solution
This PR adds two convenience functions
Flow<Boolean>.renderIfTrue(...)
andFlow<Boolean>.renderIfFalse(...)
that render a given content if a boolean Flow's value istrue
orfalse
respectively.Examples: