• Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Question about future direction: With so many things moving to modifiers (I believe yall intend to make the semantics stuff configurable via modifiers?), has there ever been any thought about making ambients configurable via modifiers? E.g.
    SomeComposable(modifier = Modifier.withAmbients(FooAmbient provides foo)) { … }
    Zach Klippenstein (he/him) [MOD]
    Adam Powell
    4 replies
    Copy to Clipboard
  • carbaj0

    carbaj0

    2 years ago
    is this the better way to change between light and dark mode?
    setContent {
                val (mode, setMode) = state { lightColorPalette() }
                MaterialTheme(mode) {
                    Button(onClick = { setMode(if (mode.isLight) darkColorPalette() else lightColorPalette()) }) {
                        Text(text = "button")
                    }
                }
            }
    carbaj0
    1 replies
    Copy to Clipboard
  • Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    I know yall are still rebasing onto the latest 1.3 compiler for the latest IR support, so is it safe to assume there won’t be any dev builds that support kotlin 1.4 anytime soon?
    Zach Klippenstein (he/him) [MOD]
    Adam Powell
    12 replies
    Copy to Clipboard
  • s

    semoro

    2 years ago
    I’m trying to implement list with animated swipe removal Do I really have to use
    stateFor
    and provide some key? https://gist.github.com/semoro/ea7c07cf3bcbd3bc4cbc4729b82b4140#file-composeremovalarea-kt-L64 Actually, if I don’t provide some kind of this id parameter, button click also hides subsequent list element, which is a bit counter-intuitive. Is it due to that changes of input parameters in RemovalArea’s child doesn’t cause recompose in RemovalArea itself, and previously occupied slot for deleted element became used by next one, without reset of state? Is there is some way to avoid passing
    id
    parameter?
    s
    Timo Drick
    +1
    22 replies
    Copy to Clipboard
  • Adam Bennett

    Adam Bennett

    2 years ago
    Is there an equivalent to this in
    Canvas
    using Compose? I'm looking to do this
    override fun onDraw(canvas: Canvas?) {
            super.onDraw(canvas)
            calculatePropagation()
            canvas?.let { render() }
            postInvalidateDelayed(20)
        }
    But I can't seem to find an equivalent for repeatedly drawing to Canvas. I've done a tonne of digging through docs and on here - can anyone chime in?
    Adam Bennett
    b
    +2
    22 replies
    Copy to Clipboard
  • c

    codeslubber

    2 years ago
    This was working fine under I think
    dev05
    but under 8 it says failed to cast to MutableState:
    *val* position = _state_ *{* _SliderPosition_(valueRange = sliderRange, initial = range.*first*.toFloat(), steps = 9) }
    c
    Adam Powell
    +2
    24 replies
    Copy to Clipboard
  • k

    Kazemihabib1996

    2 years ago
    k
    1 replies
    Copy to Clipboard
  • amar_1995

    amar_1995

    2 years ago
    I am trying to use TextField. In text field onBlur is not getting called. Am I doing somthing wrong. I am only using one text field.
    TextField(
        value = value,
        onValueChange = onValueChange,
        textStyle = editorStyle,
        imeAction = ImeAction.Search,
        keyboardType = keyboardType,
        onImeActionPerformed = {
            onSearchClick()
        },
        onFocus = {
            println("focus called >>>>")
            onSearchChanged(R.drawable.ic_baseline_arrow_back_24)
        },
        onBlur = {
            println("blur called >>>>")
        }
    )
    In above example
    blur called >>>>
    is never printed. Cursor is also not removed once it gain focus. In dev-05( I think) it was working fine but not now.
    amar_1995
    1 replies
    Copy to Clipboard
  • m

    molikto

    2 years ago
    is it safe to create a static
    MutableState
    outside of any composition, then this state is shared among multiple compositions? Will this leak any Composition/Context?
    m
    1 replies
    Copy to Clipboard
  • s

    Sri

    2 years ago
    I was trying to create a row of buttons using the following code.
    @Composable
    fun ButtonRow() {
        Row {
            val padding = Modifier.padding(12.dp)
            Button(onClick = {  }, modifier = padding) {
                Text(text = "Ok")
            }
            Button(onClick = {  }, modifier = padding) {
                Text(text = "Subtract")
            }
        }
    }
    I am not able to center the
    Ok
    text. Any help as to what I have to do to center it would be much appreciated.
    s
    1 replies
    Copy to Clipboard