refactor: make Tab some component @Immutable

This commit is contained in:
2023-11-30 13:41:42 +08:00
parent ed651ff231
commit 235871db7a

View File

@@ -264,7 +264,7 @@ data class TabPosition(val left: Dp, val width: Dp, val tabWidth: Dp) {
fun calculateCenter(currentWidth: Dp) = left + width / 2 - currentWidth / 2 fun calculateCenter(currentWidth: Dp) = left + width / 2 - currentWidth / 2
} }
@Stable @Immutable
class TabRow internal constructor( class TabRow internal constructor(
val selectedTabIndex: Int, val selectedTabIndex: Int,
val colors: TabColors, val colors: TabColors,
@@ -360,7 +360,7 @@ class TabRow internal constructor(
} }
} }
@Stable @Immutable
private class ScrollableTabData(private val scrollState: ScrollState, private val coroutineScope: CoroutineScope) { private class ScrollableTabData(private val scrollState: ScrollState, private val coroutineScope: CoroutineScope) {
private var selectedTab: Int? = null private var selectedTab: Int? = null