Skip to content

Instantly share code, notes, and snippets.

@wakaztahir
Created October 13, 2022 17:07
Show Gist options
  • Save wakaztahir/12145df72c53ebc6e1a6feca46fbc3bc to your computer and use it in GitHub Desktop.
Save wakaztahir/12145df72c53ebc6e1a6feca46fbc3bc to your computer and use it in GitHub Desktop.
These are my use cases all in one composable for the whole screen
var botShet by remember { mutableStateOf(false) }
var columnOne by remember { mutableStateOf(false) }
if (!botShet) {
Scaffold(
modifier = Modifier.statusBarsPadding(),
bottomBar = {
BottomNavigation {
for (i in 0..4) {
IconButton(onClick = { /*TODO*/ }) {
Icon(imageVector = Icons.Default.Check, contentDescription = null)
}
}
}
}
) { pVals ->
if (!columnOne) {
LazyColumn(
Modifier
.padding(pVals)
.imePadding()
.navigationBarsPadding()
) {
item {
Row {
Button(onClick = { botShet = !botShet }) { Text(text = "BottomSheetOne") }
Button(onClick = { columnOne = !columnOne }) { Text(text = "ColumnOne") }
}
}
items(20) { num ->
var text by remember { mutableStateOf("Field $num") }
OutlinedTextField(
value = text,
onValueChange = { text = it }
)
}
}
} else {
Column(
Modifier
.padding(pVals)
.imePadding()
.navigationBarsPadding()
.verticalScroll(rememberScrollState())
) {
Row {
Button(onClick = { botShet = !botShet }) { Text(text = "BottomSheetOne") }
Button(onClick = { columnOne = !columnOne }) { Text(text = "LazyOne") }
}
for (i in 0..20) {
var text by remember { mutableStateOf("Field $i") }
OutlinedTextField(
value = text,
onValueChange = { text = it }
)
}
}
}
}
} else {
BottomSheetScaffold(
sheetContent = {
// I need the sheet
},
sheetGesturesEnabled = false
) { pVals ->
Column(
Modifier
.padding(pVals)
.imePadding()
.navigationBarsPadding()
) {
LazyColumn(modifier = Modifier.weight(1f)) {
item { Button(onClick = { botShet = !botShet }) { Text(text = "ScaffoldOne") } }
items(20) { num ->
var text by remember { mutableStateOf("Field $num") }
OutlinedTextField(
value = text,
onValueChange = { text = it }
)
}
}
Row {
for (i in 0..4) {
IconButton(onClick = { /*TODO*/ }) {
Icon(imageVector = Icons.Default.Check, contentDescription = null)
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment