This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| drawArc( | |
| brush = Brush.sweepGradient( | |
| colorStops = listOf( | |
| 0.0f to gradientStart, | |
| sweep / 360 to gradientEnd, | |
| ).toTypedArray() | |
| ), | |
| // ... | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| drawArc( | |
| brush = Brush.sweepGradient(listOf(gradientStart, gradientEnd)), | |
| startAngle = startAngle + 90, | |
| sweepAngle = sweep, | |
| // ... | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val arcDimen = size.width - 2 * diameterOffset | |
| rotate(degrees = -90f) { | |
| drawArc( | |
| brush = Brush.sweepGradient(listOf(gradientStart, gradientEnd)), | |
| startAngle = startAngle, | |
| sweepAngle = sweep, | |
| useCenter = false, | |
| topLeft = Offset(diameterOffset, diameterOffset), | |
| size = Size(arcDimen, arcDimen), | |
| style = stroke |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Canvas( | |
| modifier | |
| .progressSemantics(progress) | |
| ) { | |
| // Start at 12 o'clock | |
| val startAngle = 270f | |
| val sweep = progress * 360f | |
| // Adding track with this line 👇 | |
| drawDeterminateCircularIndicator(startAngle, 360f, trackColor, stroke) | |
| drawDeterminateCircularIndicator(startAngle, sweep, color, stroke) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| var progress: Float by remember { mutableStateOf(0.75f) } | |
| val indicatorSize = 144.dp | |
| val trackWidth: Dp = (indicatorSize * .1f) | |
| val commonModifier = Modifier.size(indicatorSize) | |
| Column( | |
| verticalArrangement = Arrangement.Center, | |
| horizontalAlignment = Alignment.CenterHorizontally | |
| ) { | |
| Row( |