Initial commit

This commit is contained in:
vfsfitvnm
2022-06-02 18:59:18 +02:00
commit 1e673ad582
160 changed files with 10800 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
package it.vfsfitvnm.route
import android.annotation.SuppressLint
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
@Immutable
class RouteHandlerScope(
val route: Route?,
private val push: (Route?) -> Unit,
val pop: () -> Unit,
) {
@SuppressLint("ComposableNaming")
@Composable
inline fun host(content: @Composable () -> Unit) {
if (route == null) {
content()
}
}
operator fun Route0.invoke() {
push(this)
}
operator fun <P0> Route1<P0>.invoke(
p0: P0 = this.p0
) {
this.p0 = p0
push(this)
}
operator fun <P0, P1> Route2<P0, P1>.invoke(
p0: P0 = this.p0,
p1: P1 = this.p1
) {
this.p0 = p0
this.p1 = p1
push(this)
}
}