All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.tech.skot.core.components.SKPager.kt Maven / Gradle / Ivy

There is a newer version: 1.2.9
Show newest version
package tech.skot.core.components

import tech.skot.core.di.coreViewInjector

class SKPager(initialScreens: List>, onSwipeToPage: ((index: Int) -> Unit)? = null, initialSelectedPageIndex: Int = 0, swipable:Boolean = true) : SKComponent() {
    override val view = coreViewInjector.pager(screens = initialScreens.map { it.view }, onSwipeToPage = onSwipeToPage, initialSelectedPageIndex = initialSelectedPageIndex, swipable = swipable)

    var selectedIndex: Int
        get() = view.selectedPageIndex
        set(value) {
            view.selectedPageIndex = value
        }

    var screens: List> = initialScreens
        set(value) {
            view.screens = value.map { it.view }
            field = value
        }

    override fun onRemove() {
        super.onRemove()
        screens.forEach { it.onRemove() }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy