forked from melod1n/fast-messenger
feat: replace settings icon button with segmented buttons in ProfileScreen
This commit is contained in:
+15
-7
@@ -14,8 +14,6 @@ import androidx.compose.foundation.layout.statusBarsPadding
|
|||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -38,6 +36,9 @@ import dev.meloda.fast.profile.ProfileViewModel
|
|||||||
import dev.meloda.fast.profile.ProfileViewModelImpl
|
import dev.meloda.fast.profile.ProfileViewModelImpl
|
||||||
import dev.meloda.fast.profile.model.ProfileScreenState
|
import dev.meloda.fast.profile.model.ProfileScreenState
|
||||||
import dev.meloda.fast.ui.R
|
import dev.meloda.fast.ui.R
|
||||||
|
import dev.meloda.fast.ui.components.SegmentedButtonItem
|
||||||
|
import dev.meloda.fast.ui.components.SegmentedButtonsRow
|
||||||
|
import dev.meloda.fast.ui.util.buildImmutableList
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -72,12 +73,19 @@ fun ProfileScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = onSettingsButtonClicked) {
|
val items = buildImmutableList {
|
||||||
Icon(
|
add(SegmentedButtonItem("settings", R.drawable.ic_settings_round_24))
|
||||||
painter = painterResource(R.drawable.ic_settings_round_24),
|
|
||||||
contentDescription = null
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SegmentedButtonsRow(
|
||||||
|
modifier = Modifier.padding(end = 8.dp),
|
||||||
|
items = items,
|
||||||
|
onClick = { index ->
|
||||||
|
when (items[index].key) {
|
||||||
|
"settings" -> onSettingsButtonClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Transparent)
|
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Transparent)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user