Denis Ismailaj
02/26/2021, 10:49 AM// TODO(b/158077409) support shape in OutlinedTextField
Orhan Tozan
02/26/2021, 11:10 AMremember(a, b) { a + b}
or derivedStateOf { a + b }
?Peter Parker
02/26/2021, 11:29 AMKensuke Sano
02/26/2021, 12:12 PMArchie
02/26/2021, 12:30 PM@Composable
fun TopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable (() -> Unit)? = null,
actions: @Composable RowScope.() -> Unit = {},
backgroundColor: Color = MaterialTheme.colors.primarySurface,
contentColor: Color = contentColorFor(backgroundColor),
elevation: Dp = AppBarDefaults.TopAppBarElevation
) {
...
}
Doesn't expose contentPadding
? Is it possible to request exposing the content padding to adding addition padding for WindowInsets
would be easier?Lukas K-G
02/26/2021, 1:00 PMAuto
Normal
and Auto
should start at the same offset depending on the longest text in the previous “column” (visualized in green). Any ideas how I achieve do that? 🤔escodro
02/26/2021, 1:20 PMFlow
inside a ViewModel
that is notified in every time a change is made in my database and reflect the state via sealed class
to my composable. This Flow
is attached to the viewModelScope
.
Basically I’m facing two problems:
1. Every time the screen is recomposed, the function to load the data is called and a new flow is registered and listening to changes.
2. When I’m navigating in another composables that handles the same data, the Flow
keeps emitting data changes for the composable that is no longer visible.
Is there a better way to implement it? Should I use my own scope instead the one from ViewModel
? If so, how can I “dispose” the scope when the Composable is no longer visible?
@Composable
private fun TaskListLoader(viewModel: TaskListViewModel = viewModel()) {
viewModel.loadTasks()
val viewState by viewModel.state.collectAsState()
TaskScaffold(...)
}
fun loadTasks() = viewModelScope.launch {
loadAllTasksUseCase().collect { tasks ->
// emit via StateFlow
}
}
Thanks a lot in advance! ❤️Samir Basnet
02/26/2021, 2:30 PMDeepak Gahlot
02/26/2021, 3:00 PM@Preview
@Composable
fun AttachmentComponent() {
var fileName = remember { mutableStateOf(ArrayList<String>()) }
var array = arrayOf("application/pdf")
var files = ArrayList<String>()
var fileAttached = remember { mutableStateOf(false) }
Column {
val registerTakeFile = registerForActivityResult(
ActivityResultContracts.OpenMultipleDocuments()
) {
for (i in 0 until it.size) {
var uri = it.get(i)
files.add(uri.path!!)
}
fileName.value = files
}
Text(
text = "Attachment",
color = colorResource(id = R.color.gray1)
)
if (fileAttached.value) {
FileAttached(item = fileName.value)
}
OutlinedButton(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
colors = ButtonDefaults.outlinedButtonColors(
contentColor = colorResource(id = R.color.blue1)
),
onClick = {
registerTakeFile.launch(array)
fileAttached.value = true
}
) {
Icon(painterResource(id = R.drawable.ico_attach), contentDescription = "attach")
Text(
fontSize = 14.sp,
text = "Add Files",
)
}
}
}
@Composable
fun FileAttached(item: ArrayList<String>) {
Column {
item.forEach {
Row {
Text(
text = it,
color = colorResource(id = R.color.black)
)
}
}
}
}
Shakil Karim
02/26/2021, 3:27 PMModalBottomSheet(
sheetState = clubsSheetState,
sheetContent = {
---------Sheet 1 content
},
content = {
---- Sheet 1 body
ModalBottomSheet(
sheetState = clubsSheetState,
sheetContent = {
---------Sheet 2 content
},
content = {
---- Sheet 2 body
})
})
Isn't it will be better to use it like Dialog
if(show) {
BottomSheet()
}Neal Sanche
02/26/2021, 3:36 PMAdam Powell
02/26/2021, 3:59 PMrsktash
02/26/2021, 4:08 PMandroid.media.MediaPlayer
grandstaish
02/26/2021, 4:09 PMAnnotatedString
?Lucien Guimaraes
02/26/2021, 4:11 PMelevation = 0.dp
the background is correctly applied. If the elevation is by default, the background color is different (more bright). Is this an intended behaviour or a bug with beta01 ? Also it's only with the black color from Compose (Color.Black
), I tried with other colors and it's working fine 🤷timmy
02/26/2021, 4:19 PMStylianos Gakis
02/26/2021, 4:28 PMvar someVariable by remember { mutableStateOf(false) }
. I had to manually import import androidx.compose.runtime.getValue
myself for it to work. Is there something I am doing wrong, or an IDE bug?Tony Kazanjian
02/26/2021, 5:29 PMviewPager
in compose beta, or should we still go for interoperability for something like that for now?rsktash
02/26/2021, 7:33 PMVitor Prado
02/26/2021, 7:45 PMBottomDrawerLayout
intercept my content scroll?Colton Idle
02/26/2021, 7:50 PMKotlin 1.4.31 is now available with fixes for several bugs, including some that appeared in IntelliJ IDEA and Android Studio with Kotlin 1.4.30.Safe to update, or will that blow something up with compose? https://twitter.com/kotlin/status/1365237672231452675
vanpra
02/26/2021, 8:10 PMArkadii Ivanov
02/26/2021, 8:46 PMChris Grigg
02/26/2021, 8:50 PManimatedFloat
to remember { Animatable(initialValue = 0f) }
. Changing this involves replacing an onEnd
callback and I’m using async/await for it, I was wondering if this is a good way of approaching it? Complete code snippets are below in the reply thread.Colton Idle
02/26/2021, 9:34 PMGabriel
02/26/2021, 9:57 PMChris Grigg
02/26/2021, 10:34 PMviewModel()
within composables since upgrading to beta 1?itnoles
02/27/2021, 3:19 AMDropdownMenu(expanded = false)
is like disappear?sen kumar
02/27/2021, 5:05 AMoverride fun afterTextChanged(editable: Editable?)
in a TextField component in Compose?sen kumar
02/27/2021, 5:09 AMsen kumar
02/27/2021, 5:09 AMColton Idle
02/27/2021, 6:22 PMsen kumar
02/27/2021, 7:08 PM