I have scrollable tab row. Need to put loading ind...
# compose
j
I have scrollable tab row. Need to put loading indicator full width bellow it. Is this achievable?
Indicator just follow width of tabs 😞
o
I guess you could simply put
Modifier.fillMaxWidth()
on the indicator? 🤔
j
Thx man, Tried it already does not work. Found hack to add lists in column and present it when needed on top of list 🤕
o
But what structure do you have? I think this one should work okay:
Copy code
Column {
   SomeScrollableRowWithTabs()
   Indicator(Modifier.fillMaxWidth())
}
j
will give it a try thx ❤️
message has been deleted
get this 😄
Copy code
Column(modifier = Modifier.background(Style.colors.appBackground).fillMaxWidth()) {
        ScrollableTabRow(
            selectedTabIndex = pagerState.currentPage,
            containerColor = Style.colors.content,
            edgePadding = 5.dp,
            modifier = Modifier.height(50.dp).widthIn(min = 1000.dp),
            divider = {},
            indicator = {}
        ) {
            val scope = rememberCoroutineScope()
            state.tabs.forEachIndexed { index, tab ->
                val isSelected = pagerState.currentPage == index
                Tab(
                    selected = isSelected,
                    onClick = {
                        scope.launch {
                            pagerState.animateScrollToPage(index)
                        }
                    },
                    modifier = Modifier
                        .background(Style.colors.content)
                        .height(30.dp)
                        .clip(RoundedCornerShape(50))
                        .background(
                            if (isSelected) Style.colors.inputActive else Style.colors.content
                        ),
                    text = {
                        Text(
                            text = tab.title,
                            style = Style.typography.bodyBold,
                            color = if (isSelected) Style.colors.textLink else Style.colors.textStandard,
                        )
                    })
            }
        }

        HorizontalPager(
            count = state.tabs.size,
            state = pagerState
        ) { page ->
            CommunityPage(
                tab = state.tabs.elementAt(page),
                actionManager = actionManager,
                navigateToPostGalleryView = navigateToPostGalleryView,
                openComments = openComments
            )
        }
    }
    LinearProgressIndicator(
        modifier = Modifier.fillMaxWidth(),
        trackColor = Style.colors.appBackground,
        color = colorResource(
            id = R.color.light_blue
        ),
        progress = 0.5f
    )
}
o
Oh, hm 🤔 Did you try to put indicator between
ScrollableTabRow
and
HorizontalPager
?
j
this works thx a lot