https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • m

    Mayank Wadhwa

    02/25/2021, 1:39 PM
    Hi everyone, Can someone help me with taking a screenshot in jetpack compose scrollable column such that the result image contains the invisible part of the screen as well.?
    s
    h
    +3
    • 6
    • 7
  • a

    alorma

    02/25/2021, 2:59 PM
    One question... setting a navigationIcon` on
    TopBar
    shows the arrow in a really strange position...is it intended?
    Scaffold(
            topBar = {
                TopAppBar(
                    navigationIcon = { Icon(
                        imageVector = Icons.Default.ArrowBack,
                        contentDescription = "back"
                    ) },
                    title = { Text(text = "Puppy ${puppyId.value}") },
                    backgroundColor = MaterialTheme.colors.primary,
                )
            }) {
    
        }
    s
    • 2
    • 3
  • s

    Shakil Karim

    02/25/2021, 3:15 PM
    Does any notice Performance improvements on lazyColumn and other Lazy Components in beta1?
    a
    c
    • 3
    • 5
  • m

    mmaillot

    02/25/2021, 4:02 PM
    How can I do that with compose ?
    Column(modifier = Modifier.fillMaxHeight(), verticalArrangement = Arrangement.SpaceBetween) {
            Header()
            Content()
            Bottom()
        }
    I have this code for the whole screen. In my
    Content
    component, I have the 6 squares which are well aligned with
    SpaceAround
    .
    Column(
            modifier = Modifier.fillMaxWidth(),
            verticalArrangement = Arrangement.SpaceAround,
        ) {
            Row(
                horizontalArrangement = Arrangement.SpaceAround,
                modifier = Modifier.fillMaxWidth(),
            ) {
                Square()
                Square()
                Square()
            }
            Row(
                horizontalArrangement = Arrangement.SpaceAround,
                modifier = Modifier.fillMaxWidth(),
            ) {
                Square()
                Square()
                Square()
            }
        }
    I want the green part to take all place between Header (fixed height) and ProgressBar (fixed height too).
    t
    s
    • 3
    • 10
  • a

    alorma

    02/25/2021, 4:05 PM
    Is there any
    Ranger
    like
    SLider
    but with min / max selector?
    s
    r
    • 3
    • 11
  • a

    Arun

    02/25/2021, 4:08 PM
    Is there any guide/tutorial for BottomSheets in compose? Have access to the source code, howevere, it seems daunting.
    s
    • 2
    • 2
  • w

    why

    02/25/2021, 4:20 PM
    Hi I would love to know if the following dependencies are necessary for a pure Jetpack Compose project :
    implementation 'androidx.core:core-ktx:1.3.2'
     implementation 'androidx.appcompat:appcompat:1.2.0'
     implementation 'com.google.android.material:material:1.3.0'
     implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
    t
    l
    +2
    • 5
    • 10
  • t

    Timo Drick

    02/25/2021, 5:07 PM
    I do have a problem with Alignment.Bottom in AlertDialog:
    AlertDialog(
            onDismissRequest = { onAction(DismissDialog) },
            text = {
            Column {
                Row(verticalAlignment = Alignment.Bottom) {
                    Text(text = description, Modifier.weight(2f))
                    Image(
                        modifier = Modifier.weight(1f).padding(end = 4.dp),
                        painter = painterResource(id = R.drawable.ic_mango_shake),
                        contentDescription = "mango shake",
                        contentScale = ContentScale.Inside
                    )
                }
            }
        },...
    s
    k
    • 3
    • 9
  • m

    manueldidonna

    02/25/2021, 5:30 PM
    I encountered a strange bug using
    LazyColumn
    and
    CoilImage
    without setting a
    Modifier.height
    on it. The scroll offset is resetted to 0 every time I scroll up. @cb I tried with
    Image
    and
    painterResource
    and the bug is absent so I think it depends on Accompanist
    a
    c
    • 3
    • 9
  • l

    Lucien Guimaraes

    02/25/2021, 5:52 PM
    I'm asking for help on this one again. I'm unable to create a smooth alpha transition like this video, using NestedScrollConnection or simply with animateColorAsState. For both the value isn't updated as often as the scroll is happening in the view
    ✅ 1
    t
    d
    +2
    • 5
    • 38
  • d

    Denis

    02/25/2021, 7:25 PM
    What's the point of this error (not a compile one, thankfully)? What if I want to pass separate modifiers and then apply them conditionally?
    l
    • 2
    • 2
  • a

    alorma

    02/25/2021, 8:05 PM
    Is there a way to show image (or anything) below statusbar?
    t
    c
    +3
    • 6
    • 12
  • v

    Vitor Prado

    02/25/2021, 9:15 PM
    how to draw an image behind view? (I need to draw image as background and the image should be cropped to the content size)
    ➕ 1
    c
    a
    • 3
    • 3
  • d

    deniskrr

    02/25/2021, 9:19 PM
    Hey 😄 Does anyone know how I can draw a transparent gradient over an image? I’m trying to achieve this: (there’s a black gradient starting from the bottom)
    v
    • 2
    • 3
  • d

    Dominaezzz

    02/25/2021, 10:50 PM
    I think
    produceState
    should forget the initial value if any of the input keys change.
    l
    z
    +2
    • 5
    • 47
  • s

    Shivam Sethi

    02/26/2021, 1:44 AM
    In my Composable function I am not able to get reference to Context ? I saw we can use AmbeintContext.current in composables but still no recommendation appears when I type and after typing the whole reference it errors and says not found ?
    a
    • 2
    • 2
  • s

    Shivam Sethi

    02/26/2021, 1:49 AM
    also is there a way we can scope a ViewModel to certain number of composables using compose navigation library, like we can scope in activity or nav graph for multiple fragments I want to use same ViewModel for 2 screens composables ?
    a
    i
    • 3
    • 9
  • t

    Tlaster

    02/26/2021, 3:24 AM
    Can we get Item keys https://developer.android.com/jetpack/compose/lists#item-keys with Paging3 https://developer.android.com/jetpack/compose/lists#large-datasets ?
    a
    • 2
    • 1
  • c

    cavega

    02/26/2021, 4:02 AM
    👋 Not sure if the samples are out of date compared to the beta release, but I starting going through the tutorials and Android Studio gives me an error for
    Modifier.padding()
    . Am I missing something? This is with a new project created via Android Studio Arctic Fox | 2020.3.1 Canary 8. Just barely started on Lesson 1 here https://developer.android.com/jetpack/compose/tutorial
    a
    • 2
    • 2
  • n

    Neal Sanche

    02/26/2021, 5:03 AM
    Would it be a bad thing to try and stick a viewModel into a CompositionLocalProvider so that I don't have to pass it to all of my composables? I seem to be passing the main viewmodel all over the place, and I'm not liking doing this. I'd love some advice on this. I get the feeling I'm missing something. Pass data down, and events up. But I guess a ViewModel is actually not data, it's a data holder. So, does it make sense to be passing it down?
    z
    j
    • 3
    • 6
  • m

    Mehdi Haghgoo

    02/26/2021, 5:50 AM
    Why is AnimatedVisibility experimental? It is already so beautiful.
    d
    • 2
    • 1
  • a

    allan.conda

    02/26/2021, 7:10 AM
    Replacing
    vectorResource()
    with
    painterResource()
    caused this issue, any idea how to fix it? Or should I file a bug?
    n
    c
    • 3
    • 6
  • t

    Tijs Gobbens

    02/26/2021, 7:58 AM
    trying out the navigation library I'm passing the NavController to most of my screens, but this seems to break
    @Preview
    feature, is. there something I could pass into a composable with preview as a NavController?
    l
    f
    i
    • 4
    • 3
  • n

    Nathan Castlehow

    02/26/2021, 8:28 AM
    hey hey, I’m trying to submit for the weekly challenge but the build fails on the linter. When i run locally though and run spotless apply it seems to all be fine. Do the build logs in the CI contain some detail I’m missing?
    • 1
    • 1
  • a

    alorma

    02/26/2021, 8:32 AM
    Hi. I set mu status bar to be translucent, but then i got this... it draws under status
    l
    z
    +2
    • 5
    • 9
  • c

    chrisxinyue

    02/26/2021, 8:57 AM
    https://kotlinlang.slack.com/archives/C0B8M7BUY/p1614328944172900
    y
    • 2
    • 2
  • m

    Marcin Środa

    02/26/2021, 9:20 AM
    Hey! Does anyone knows how to replace
    pressIndicatorGestureFilter
    ? Looks like I should use
    Modifier.pointerInput
    with
    detectTapGestures
    , but how to handle press / cancel / stop states?
    • 1
    • 2
  • a

    alorma

    02/26/2021, 9:31 AM
    Hi. If
    Surface
    is a `Box, shouldn't the
    content
    slot be
    BoxScope.() -> Unit
    ?
    a
    • 2
    • 1
  • t

    Timon Bohn

    02/26/2021, 9:59 AM
    Any suggestions for a presenting / toast view?
    g
    a
    • 3
    • 3
  • a

    alorma

    02/26/2021, 9:59 AM
    Another question... I'm trying to do a colored card, using:
    backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.12f).compositeOverSurface()
    That is supposed to do a dim version of
    primary
    color... but it shows plain
    primary
    v
    • 2
    • 4
Powered by Linen
Title
a

alorma

02/26/2021, 9:59 AM
Another question... I'm trying to do a colored card, using:
backgroundColor = MaterialTheme.colors.primary.copy(alpha = 0.12f).compositeOverSurface()
That is supposed to do a dim version of
primary
color... but it shows plain
primary
v

Vivek Sharma

02/26/2021, 12:23 PM
what is
compositeOverSurface
for ? can you try removing it and try
a

alorma

02/26/2021, 12:30 PM
If I remove it then the card is translucent and shadow is drawn incorrectly
compositeOverSurface
puts one color "over" surface, so if the color has alpha, it will draw a solid version, but provided by surface...
Good fdr dark mode
v

Vivek Sharma

02/26/2021, 12:58 PM
oh, so then do one thing
MaterialTheme.colors.primary.compositeOverSurface().copy(alpha = 0.12f)
check if this works for you
View count: 1