|
|
|
@ -29,20 +29,21 @@ import tachiyomi.presentation.core.components.Pill
|
|
|
|
|
private fun Modifier.tabIndicatorOffset(
|
|
|
|
|
currentTabPosition: TabPosition,
|
|
|
|
|
currentPageOffsetFraction: Float,
|
|
|
|
|
) = composed {
|
|
|
|
|
val currentTabWidth by animateDpAsState(
|
|
|
|
|
targetValue = currentTabPosition.width,
|
|
|
|
|
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
|
|
|
|
)
|
|
|
|
|
val offset by animateDpAsState(
|
|
|
|
|
targetValue = currentTabPosition.left + (currentTabWidth * currentPageOffsetFraction),
|
|
|
|
|
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
|
|
|
|
)
|
|
|
|
|
fillMaxWidth()
|
|
|
|
|
.wrapContentSize(Alignment.BottomStart)
|
|
|
|
|
.offset { IntOffset(x = offset.roundToPx(), y = 0) }
|
|
|
|
|
.width(currentTabWidth)
|
|
|
|
|
}
|
|
|
|
|
) = fillMaxWidth()
|
|
|
|
|
.wrapContentSize(Alignment.BottomStart)
|
|
|
|
|
.composed {
|
|
|
|
|
val currentTabWidth by animateDpAsState(
|
|
|
|
|
targetValue = currentTabPosition.width,
|
|
|
|
|
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
|
|
|
|
)
|
|
|
|
|
val offset by animateDpAsState(
|
|
|
|
|
targetValue = currentTabPosition.left + (currentTabWidth * currentPageOffsetFraction),
|
|
|
|
|
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
|
|
|
|
)
|
|
|
|
|
Modifier
|
|
|
|
|
.offset { IntOffset(x = offset.roundToPx(), y = 0) }
|
|
|
|
|
.width(currentTabWidth)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun TabIndicator(
|
|
|
|
|