Theming the tab indicator according to designs

This commit is contained in:
ThomasSession 2024-06-13 16:58:16 +10:00 committed by Andrew
parent bd679b0889
commit 2373612f98

View File

@ -8,6 +8,7 @@ import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.Tab import androidx.compose.material.Tab
import androidx.compose.material.TabRow import androidx.compose.material.TabRow
import androidx.compose.material.TabRowDefaults import androidx.compose.material.TabRowDefaults
import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
@ -34,6 +35,13 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
backgroundColor = Color.Unspecified, backgroundColor = Color.Unspecified,
selectedTabIndex = pagerState.currentPage, selectedTabIndex = pagerState.currentPage,
contentColor = LocalColors.current.text, contentColor = LocalColors.current.text,
indicator = { tabPositions ->
TabRowDefaults.Indicator(
Modifier.tabIndicatorOffset(tabPositions[pagerState.currentPage]),
color = LocalColors.current.primary,
height = 5.dp
)
},
divider = { TabRowDefaults.Divider(color = LocalColors.current.divider) }, divider = { TabRowDefaults.Divider(color = LocalColors.current.divider) },
modifier = Modifier modifier = Modifier
.height(48.dp) .height(48.dp)