|  | @@ -1,27 +1,57 @@
 | 
	
		
			
				|  |  |  package tachiyomi.presentation.core.components.material
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import androidx.compose.animation.core.Spring
 | 
	
		
			
				|  |  | +import androidx.compose.animation.core.animateDpAsState
 | 
	
		
			
				|  |  | +import androidx.compose.animation.core.spring
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.isSystemInDarkTheme
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.Row
 | 
	
		
			
				|  |  | +import androidx.compose.foundation.layout.fillMaxWidth
 | 
	
		
			
				|  |  | +import androidx.compose.foundation.layout.offset
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.padding
 | 
	
		
			
				|  |  | +import androidx.compose.foundation.layout.width
 | 
	
		
			
				|  |  | +import androidx.compose.foundation.layout.wrapContentSize
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.shape.RoundedCornerShape
 | 
	
		
			
				|  |  |  import androidx.compose.material3.MaterialTheme
 | 
	
		
			
				|  |  |  import androidx.compose.material3.TabPosition
 | 
	
		
			
				|  |  |  import androidx.compose.material3.TabRowDefaults
 | 
	
		
			
				|  |  | -import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
 | 
	
		
			
				|  |  |  import androidx.compose.material3.Text
 | 
	
		
			
				|  |  |  import androidx.compose.runtime.Composable
 | 
	
		
			
				|  |  | +import androidx.compose.runtime.getValue
 | 
	
		
			
				|  |  |  import androidx.compose.ui.Alignment
 | 
	
		
			
				|  |  |  import androidx.compose.ui.Modifier
 | 
	
		
			
				|  |  | +import androidx.compose.ui.composed
 | 
	
		
			
				|  |  |  import androidx.compose.ui.draw.clip
 | 
	
		
			
				|  |  | +import androidx.compose.ui.unit.IntOffset
 | 
	
		
			
				|  |  |  import androidx.compose.ui.unit.dp
 | 
	
		
			
				|  |  |  import androidx.compose.ui.unit.sp
 | 
	
		
			
				|  |  |  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)
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @Composable
 | 
	
		
			
				|  |  | -fun TabIndicator(currentTabPosition: TabPosition) {
 | 
	
		
			
				|  |  | +fun TabIndicator(
 | 
	
		
			
				|  |  | +    currentTabPosition: TabPosition,
 | 
	
		
			
				|  |  | +    currentPageOffsetFraction: Float,
 | 
	
		
			
				|  |  | +) {
 | 
	
		
			
				|  |  |      TabRowDefaults.Indicator(
 | 
	
		
			
				|  |  |          Modifier
 | 
	
		
			
				|  |  | -            .tabIndicatorOffset(currentTabPosition)
 | 
	
		
			
				|  |  | +            .tabIndicatorOffset(currentTabPosition, currentPageOffsetFraction)
 | 
	
		
			
				|  |  |              .padding(horizontal = 8.dp)
 | 
	
		
			
				|  |  |              .clip(RoundedCornerShape(topStart = 3.dp, topEnd = 3.dp)),
 | 
	
		
			
				|  |  |      )
 |