https://kotlinlang.org logo
Title
f

FunkyMuse

08/12/2021, 10:15 PM
hey guys, what i'm doing wrong (code in thread)
Dialog(
    onDismissRequest = {}, properties =
    DialogProperties(dismissOnBackPress = false,
        dismissOnClickOutside = false)
) {
    Column(
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier
            .background(MaterialTheme.colors.background, shape = Shapes.medium)
    ) {
        Text(
            text = stringResource(id = R.string.copying_file),
            modifier = Modifier
                .align(Alignment.CenterHorizontally)
                .padding(16.dp)
        )
        LinearProgressIndicator(
            progress = progress,
            modifier = Modifier
                .align(Alignment.CenterHorizontally)
                .padding(horizontal = 16.dp, vertical = 8.dp)
        )
        Text(
            text = "%${progress.toInt()}",
            modifier = Modifier
                .align(Alignment.CenterHorizontally)
                .padding(horizontal = 16.dp)
                .padding(top = 8.dp, bottom = 16.dp)
        )
    }
}
I don't want the
LinearProgressIndicator
to go outside the frame box 😕
c

Chris Miller

08/12/2021, 10:27 PM
progress
should be between 0 and 1
I notice the docs say "Values outside of this range are coerced into the range", but that doesn't appear to be happening
c

Colton Idle

08/13/2021, 1:43 AM
What's wrong with it? 😂
c

Chris Miller

08/13/2021, 2:28 AM
You shouldn't be using a value greater than 1. The docs for LinearProgressIndicator.progress indicate that it treats anything > 1 as 100% anyway, but the LinearProgressIndicator code doesn't actually look like it does that, which is why your line goes past 100%. So you have a bug, and perhaps LinearProgressIndicator has a bug 🙂
1