I can't make a 1.dp height linear progress bar ```...
# compose
o
I can't make a 1.dp height linear progress bar
Copy code
LinearProgressIndicator(Modifier.fillMaxWidth().height(1.dp))
The implementation hard codes its size it seems:
Copy code
Canvas(
    modifier
        .progressSemantics()
        .size(LinearIndicatorWidth, LinearIndicatorHeight)
        .focusable()
Any solution?
o
1. Create an issue: https://issuetracker.google.com/issues?q=componentid:612128 2. In the meantime copy the source and change the value to your liking It is entirely possible that the current implementation will remain hardcoded - Material Design dictates a height of 4. Other implementations have adjustable track height though. Edit: After looking through the material.io documentation of other implementations, only the Android View-based implementation allows variable track thickness (attribute
app:trackThickness
). None of [iOS, Flutter, Web] MDC implementations allow variable indicator height out of the box. https://material.io/components/progress-indicators#specs
o
Ok for the issue 👌 I was wondering if it was just me missing the point 😅
That being said, related to default MD impl of components, it leads pretty quickly to custom copy/pasted impl of such progress. I had to do the same copy/paste for
CircularProgressIndicator
to 1. adjust stroke end to round 2. add "background" layer of the progress I would have expected tuning parameters of the standard component for things like that (
strokeCap =
with relevant default and
backgroundColor =
)
a
You can wrap it in a
Box
with 1dp height (probably also
clipToBounds()
).
o
For my use case, I'll also have to tweak way more than height, so, at the end I'll duplicate the code.
But it could be a workaround for the height yes.
l
Shortcut to create compose issues: https://goo.gle/compose-feedback