Hello everyone, for the life of me, I cannot remov...
# compose
j
Hello everyone, for the life of me, I cannot remove the padding in the Tab of a Tabrow, its causing my label to jump to the next line ( or i can force it on one line but it clips or ellipses ) I cannot get it to render fully. the text is only "completed" and theres plenty of room there, I see like 20dp on both sides of the label of padding when i make my text a different color than the tab. (code in thread)
Copy code
TabRow(selectedTabIndex = tabs.indexOf(selectedTab),
            containerColor = Color.White,
            indicator = { tabPositions ->
                SecondaryIndicator(
                    Modifier.tabIndicatorOffset(tabPositions[tabs.indexOf(selectedTab)]),
                    color = RColor.HIGHLIGHT_500.color
                )
            }) {
            tabs.forEachIndexed { _, tabFilter ->
                Tab(
                    selected = selectedTab == tabFilter,
                    onClick = {

                    },
                    text = {
                        if (selectedTab == tabFilter) {
                            Text(tabFilter.tabTitle)
                        } else {
                            Text(tabFilter.tabTitle)
                        }
                    }
                )
            }
Screenshot 2025-01-20 at 7.47.56 AM.png
ive tried modifier.fillmaxwidth, etc on the label but it always shows this padding. (in this case because my rendered preview is a bit more wide than on my device it fits on one line.)
s
TabRow comes frome material3 right? You might wanna take a look at their implementation, it may not be possible to make the adjustment you want to. Copy pasting the implementation to your project would be your only option if that is the case.
j
yes, material 3... thats a pain 😢
m
Trust me if you want it customisable to your needs just make your own Composable. Much less pain…
Been there done that.
j
I had started to do this, but then I noticed the indicator animates and slides under the appropriate tab, and probably will get bitched at if i remove said animation, tbd.
s
You can copy paste the entire implementation, including that animation. And then make your adjustments as needed.
j
I wasnt aware until this thread that the code was open sourced. 🤦
👍 1