@@ -119,39 +119,40 @@ internal fun ListTopBar(
119
119
@OptIn(ExperimentalMaterial3Api ::class )
120
120
@Composable
121
121
private fun UserTabs (selected : Int , userList : List <UserInfo >, usersMap : Map <Int , Long >, onTabClick : (index: Int ) -> Unit ) {
122
- PrimaryScrollableTabRow (
123
- selectedTabIndex = selected,
124
- edgePadding = SizeTokens .Level0 ,
125
- indicator = @Composable {
126
- TabRowDefaults .PrimaryIndicator (
127
- Modifier .tabIndicatorOffset(selected, matchContentSize = true ),
128
- shape = CircleShape
129
- )
130
- },
131
- divider = {
132
- Divider (modifier = Modifier .fillMaxWidth())
133
- }
134
- ) {
135
- userList.forEachIndexed { index, user ->
136
- Tab (
137
- selected = selected == index,
138
- onClick = {
139
- onTabClick(index)
140
- },
141
- text = {
142
- BadgedBox (
143
- modifier = Modifier .fillMaxSize(),
144
- badge = {
145
- if (usersMap.containsKey(user.id)) {
146
- Badge { Text (text = usersMap[user.id].toString()) }
122
+ if (userList.isNotEmpty()) {
123
+ PrimaryScrollableTabRow (
124
+ selectedTabIndex = selected,
125
+ edgePadding = SizeTokens .Level0 ,
126
+ indicator = @Composable {
127
+ TabRowDefaults .PrimaryIndicator (
128
+ Modifier .tabIndicatorOffset(selected, matchContentSize = true ),
129
+ shape = CircleShape
130
+ )
131
+ },
132
+ divider = {
133
+ Divider (modifier = Modifier .fillMaxWidth())
134
+ }
135
+ ) {
136
+ userList.forEachIndexed { index, user ->
137
+ Tab (
138
+ selected = selected == index,
139
+ onClick = {
140
+ onTabClick(index)
141
+ },
142
+ text = {
143
+ BadgedBox (
144
+ modifier = Modifier .fillMaxSize(),
145
+ badge = {
146
+ if (usersMap.containsKey(user.id)) {
147
+ Badge { Text (text = usersMap[user.id].toString()) }
148
+ }
147
149
}
150
+ ) {
151
+ Text (text = " ${user.name} (${user.id} )" , maxLines = 2 , overflow = TextOverflow .Ellipsis )
148
152
}
149
- ) {
150
- Text (text = " ${user.name} (${user.id} )" , maxLines = 2 , overflow = TextOverflow .Ellipsis )
151
153
}
152
- }
153
- )
154
+ )
155
+ }
154
156
}
155
157
}
156
158
}
157
-
0 commit comments