how could I draw only the parts of the text that a...
# compose
f
how could I draw only the parts of the text that are on top of the darker, filled background in white and the rest in black?
c
Someone had this question before (it was a progress bar filling up from the bottom of the screen and the numbers were in the middle) and it was like months ago... but I can't find it. 😭
l
I would draw the text twice on top of each other, and have a clipshape that clips the top text based on how much progress you have
👍 2
f
Thank you @Colton Idle I'll read that
@Luis if that works it's pretty smart
🙏 1
a
I suppose you can couple usage of
AnnotatedString
with your progress bar, coloring text depending on the progress made. I didn’t test it, but this sounds like a possible solution
f
@Anastasia Rozovskaya Thank you. I don't know how good that will work with localized strings tho
@Luis can you point me to the method I have to use to clip the text depending on the progress?
l
there is a
clip()
modifier that takes a Shape
You could create a custom Rectable Shape that is based on a percentage, and draws an outline based on that
The
RectangleShape
source just draws a rectangle outline, but you can create one that outlines based on a percentage of width (or height)
f
ok, thank you very much!
@Luis you're a genius 🙂
👍 2
😅 1
l
Glad you got it working!