andylamax
03/06/2021, 7:55 AMtheapache64
03/06/2021, 3:03 PMgbaldeck
03/06/2021, 3:53 PMYan Pujante
03/06/2021, 5:48 PMGlenn Martin
03/07/2021, 4:37 AMmutableStateOf
on the main class at the top of my appTheMrCodes
03/07/2021, 10:06 AMlaunch
a new Coroutine in an @Composeable
function to load resources in Background without using LaunchedEffect
, it will be a death loop 🤦Dirk Hoffmann
03/07/2021, 11:04 AMColumn(modifier) {
TabRow(selectedTabIndex = activeTab()) {
Tab(selected = activeTab() == 0, onClick = { activeTab(0) }, enabled = true) {
Text("Tab 1", Modifier.padding(3.dp), textAlign = TextAlign.Center)
}
Tab(selected = activeTab() == 1, onClick = { activeTab(1) }, enabled = true) {
Text("Search: Result", Modifier.padding(3.dp), textAlign = TextAlign.Center)
}
Tab(selected = activeTab() == 2, onClick = { activeTab(2) }, enabled = true) {
Text("Tab 3", Modifier.padding(3.dp), textAlign = TextAlign.Center)
}
}
no matter what I try, I don't get the Tab Texts vertically centered.
Isn't TabRow missing a "verticalAligment" parameter???TheMrCodes
03/08/2021, 2:41 PMYan Pujante
03/08/2021, 6:13 PMYan Pujante
03/08/2021, 7:38 PMColumn {
parts.value.forEach { part ->
Row(modifier = Modifier.fillMaxWidth().background(color = Color.LightGray)) {
Text(part.name, modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Red))
Text(part.description ?: "N/A", modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Green))
Text(part.price.toString(), modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Blue))
}
}
}
It renders this way so I guess I don't understand the fraction parameter...Yan Pujante
03/09/2021, 4:50 PMUserMgr.getUsers(userFilter) -> List<User>, UserMgr.removeUser(userID)
). I want to display this list of users and offer the ability to remove any item from the list (with the click of a button). I am not entirely sure how to handle this use case with compose-desktop. If I use
val userFilter = xxx
val users = remember { userMgr.getUsers(userFilter) }
// ...
// for each user
val id = ...
Button(onClick = { userMgr.delete(id) } // ...
// ...
Then of course it does not get recomposed because there is no way for the framework to know that the list has changed... I apologize if this question has been asked before. Can somebody point me to the recommended way to handle a compose-dekstop application backed by a database with essentially screens that implement CRUD access to it?TheMrCodes
03/09/2021, 9:22 PMSrSouza
03/10/2021, 12:53 PMMarcin Wisniowski
03/10/2021, 5:52 PMtheapache64
03/10/2021, 9:54 PMTab
from a TextField
? Do we have any built-in support? (other than manually moving the focus using a state).
I am looking for something like tabIndexLin Zhang
03/11/2021, 9:04 AM1.0.0-beta02
? I don’t think that’s a good idea… the animation looks so wired on initializing UI and no API to disable it
https://android-review.googlesource.com/c/platform/frameworks/support/+/1580345Yan Pujante
03/11/2021, 3:55 PMtad
03/12/2021, 2:38 AMBruno Blazinc
03/12/2021, 8:35 AMImage
that can handle loading from network? Something that a library like Coil, Glide or Picasso provide.
Eg. Coil: https://github.com/google/accompanist/tree/main/coil
I am creating a Multiplatform Kotlin app(Android & Desktop, iOS in the works) and I wan’t to share the Compose UI code as a module that is imported in the Android and Desktop module. Everything else works fine but I would love to be able to load images in a platform independent way.theapache64
03/12/2021, 3:24 PMsamuel
03/12/2021, 7:32 PMspechard
03/12/2021, 9:42 PMGlenn Martin
03/13/2021, 12:36 AMSudhir Singh Khanger
03/13/2021, 2:26 AMDirk Hoffmann
03/13/2021, 10:41 AMorangy
03/13/2021, 2:49 PMException in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: LayoutNode@108e4651 children: 1 measurePolicy: androidx.compose.foundation.Scrollbar_desktopKt$verticalMeasurePolicy$1@7d30d0b0 is not ready. layoutState is NeedsRemeasure
Build 0.4.0-build173
Any ideas?Yan Pujante
03/13/2021, 7:52 PM// from DiscoverViewModel
init {
viewModelScope.launch {
// Combines the latest value from each of the flows, allowing us to generate a
// view state instance which only contains the latest values.
combine(
categoryStore.categoriesSortedByPodcastCount() //. simplified cause not important
_selectedCategory
) { categories, selectedCategory ->
DiscoverViewState(
categories = categories,
selectedCategory = selectedCategory
)
}.collect { _state.value = it }
}
}
// then in CategoryStore
/**
* Returns a flow containing a list of categories which is sorted by the number
* of podcasts in each category.
*/
fun categoriesSortedByPodcastCount(
limit: Int = Integer.MAX_VALUE
): Flow<List<Category>> {
return categoriesDao.categoriesSortedByPodcastCount(limit)
}
/**
* Adds the category to the database if it doesn't already exist.
*
* @return the id of the newly inserted/existing category
*/
suspend fun addCategory(category: Category): Long {
return when (val local = categoriesDao.getCategoryWithName(category.name)) {
null -> categoriesDao.insert(category)
else -> local.id
}
}
when addCategory is called, how does the DiscoverViewModel state gets updated exactly? Clearly after adding a category to the database, the list of categories is different. I just don't see from this code how that gets propagated. Is there something missing? Am I missing something?gbaldeck
03/13/2021, 11:27 PMDirk Hoffmann
03/14/2021, 12:01 PMorangy
03/14/2021, 2:19 PMScrollbarStyleAmbient
be renamed to LocalScrollbarStyle
to match compose current style?orangy
03/14/2021, 2:19 PMScrollbarStyleAmbient
be renamed to LocalScrollbarStyle
to match compose current style?Igor Demin
03/14/2021, 2:22 PMorangy
04/17/2021, 10:59 AMIgor Demin
04/17/2021, 11:35 AM