Skip to content

Commit afd43dc

Browse files
style(scope): make scope list scrollable
...shorten previews code Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 2f356eb commit afd43dc

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

app/src/main/java/com/nextcloud/talk/ui/dialog/ScopeBottomSheet.kt

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import android.content.res.Configuration
1010
import androidx.compose.foundation.clickable
1111
import androidx.compose.foundation.isSystemInDarkTheme
1212
import androidx.compose.foundation.layout.Column
13+
import androidx.compose.foundation.rememberScrollState
14+
import androidx.compose.foundation.verticalScroll
1315
import androidx.compose.foundation.layout.Row
1416
import androidx.compose.foundation.layout.Spacer
1517
import androidx.compose.foundation.layout.fillMaxWidth
@@ -20,7 +22,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
2022
import androidx.compose.material3.Icon
2123
import androidx.compose.material3.MaterialTheme
2224
import androidx.compose.material3.ModalBottomSheet
23-
import androidx.compose.material3.Surface
2425
import androidx.compose.material3.Text
2526
import androidx.compose.material3.darkColorScheme
2627
import androidx.compose.material3.lightColorScheme
@@ -60,7 +61,7 @@ fun ScopeBottomSheetContent(
6061
showPrivate: Boolean = true,
6162
onScopeSelected: (Scope) -> Unit
6263
) {
63-
Column(modifier = modifier.fillMaxWidth().padding(bottom = 8.dp)) {
64+
Column(modifier = modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 8.dp)) {
6465
if (showPrivate) {
6566
ScopeOption(
6667
iconRes = R.drawable.ic_cellphone,
@@ -128,23 +129,18 @@ private fun ScopeOption(
128129
}
129130
}
130131

131-
@Preview(name = "Light", showBackground = true)
132-
@Preview(name = "Dark", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
132+
@OptIn(ExperimentalMaterial3Api::class)
133+
@Preview(name = "Light")
134+
@Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES)
135+
@Preview(name = "RTL · Arabic", locale = "ar")
133136
@Composable
134137
private fun PreviewScopeBottomSheet() {
135138
val colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
136139
MaterialTheme(colorScheme = colorScheme) {
137-
Surface {
138-
ScopeBottomSheetContent(onScopeSelected = {})
139-
}
140-
}
141-
}
142-
143-
@Preview(name = "RTL · Arabic", showBackground = true, locale = "ar")
144-
@Composable
145-
private fun PreviewScopeBottomSheetRtl() {
146-
MaterialTheme(colorScheme = lightColorScheme()) {
147-
Surface {
140+
ModalBottomSheet(
141+
onDismissRequest = {},
142+
sheetState = rememberModalBottomSheetState()
143+
) {
148144
ScopeBottomSheetContent(onScopeSelected = {})
149145
}
150146
}

0 commit comments

Comments
 (0)