• k

    Kshitij Patil

    1 year ago
    What’s the right way of conditionally adding Modifiers? I tried
    Modifier.padding()
    .preferredSize()
    .apply {
        if(<some condition>) {
            this.then(Modifier.clickable { })
        }
    }
    but didn’t work
    k
    d
    +2
    6 replies
    Copy to Clipboard
  • a

    alorma

    1 year ago
    Hi. I'm getting:
    * What went wrong:
    lateinit property variantName has not been initialized
    When trying to build my project form command line Config:
    com.android.tools.build:gradle:7.0.0-alpha06
    6.8.2-all.zip
    compose
    alpha12
    a
    jim
    3 replies
    Copy to Clipboard
  • d

    David Edwards

    1 year ago
    Is there a replacement for
    Spinner
    yet?
    d
    j
    +1
    11 replies
    Copy to Clipboard
  • Timo Drick

    Timo Drick

    1 year ago
    PaddingValues is since alph12 just an interface what makes it very difficult to add or substract values. E.g. i want to add a FAB padding to the content padding of my LazyColumn. How can i do it now?
    Timo Drick
    grandstaish
    +1
    8 replies
    Copy to Clipboard
  • b

    Bradleycorn

    1 year ago
    Perhaps a Studio question more-so than compose, but ... has anyone else had trouble getting the debugger to attach since updating everything to latest stuff for alpha 12?
    b
    d
    12 replies
    Copy to Clipboard
  • Geert

    Geert

    1 year ago
    I just tried to add a onbackpress dispatcher to a composable function. It works, but should I place it the function, SideEffect, LaunchedEffect, or DisposableEffect? I have to add it since it needs the call popBackStack() multiple times (or popUpTo)
    Geert
    Albert Chang
    2 replies
    Copy to Clipboard
  • Lukas K-G

    Lukas K-G

    1 year ago
    I shere a way to get hold of a Surface in compose?
    Lukas K-G
    Zach Klippenstein (he/him) [MOD]
    +1
    5 replies
    Copy to Clipboard
  • Simone Summo

    Simone Summo

    1 year ago
    Hi all, I have made a custom composable for a Searchbar that takes as input a
    query
    and an
    onValueChange: (String?) -> Unit
    . The idea is that when I have the
    onValueChange
    with the string as null the UI is different and the TextField is empty, but I get an error when I call my onValueChange inside the clickable of the close icon. The error I get:
    java.lang.AssertionError: org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl@63ae5d17: No such type argument slot: 1
    Simone Summo
    jim
    2 replies
    Copy to Clipboard
  • Alexander Karkossa

    Alexander Karkossa

    1 year ago
    @cb  I have a question about the ViewModels in the JetCaster app.https://github.com/android/compose-samples/blob/master/Jetcaster/app/src/main/java/com/example/jetcaster/ui/home/HomeViewModel.kt#L46 The state/_state variable (MutableStateFlow) is set by a collect on a combine in a launch on the viewModelScope.
    val state: StateFlow<HomeViewState>
        get() = _state
    
      init {
        viewModelScope.launch {
          combine(
            ...
          }.collect {
            _state.value = it
          }
        }
      }
    Why don't use return value of the combine method directly to the state variable?
    val state = combine(
        ...
      )
    Can someone explain the benefits of viewModelScope.launch -> collect in the init?
    Alexander Karkossa
    Alexander Sitnikov
    +1
    7 replies
    Copy to Clipboard
  • escodro

    escodro

    1 year ago
    Hello, everyone! 😊 I have a complex Composable function that I decided to create two ViewModels in order to better split the responsibilities and both of them emits state (
    sealed classes
    via
    StateFlow
    ). How could I handle the state changes? 1. Combine both states (with
    .combine
    ) and create a third “ViewState” mixing and matching the two states. 2. Observe both individually and let my function recompose when they change 3. Another better approach? The first ViewModel has three states: EmptyList, LoadedList, Error and the second one has two: DataLoaded and Error. Thanks and advance! 🎉
    escodro
    Adam Powell
    +1
    23 replies
    Copy to Clipboard