https://kotlinlang.org logo
#compose
Title
# compose
m

mohamed rejeb

03/30/2024, 5:35 PM
Can we get the scroll amount of Compose TextField?
s

Stylianos Gakis

03/30/2024, 6:42 PM
The newest APIs expose a ScrollState as a parameter https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]=BasicTextField&ss=androidx%2Fplatform%2Fframeworks%2Fsupport so you can pass in your own remembered ScrollState and derive from it what the scroll situation is like. This may not be present in the latest stable releases though, I think this only started being a thing when BasicTextField2 was renamed to just BasicTextField
thank you color 3
m

mohamed rejeb

03/30/2024, 7:03 PM
Thanks! I'm currently having this issue when I draw a custom shape in the rich text editor. Because
MultiParagraph
get line bounds methods are not taking the scroll into consideration, otherwise it works fine for
BasicText
.
s

Stylianos Gakis

03/30/2024, 7:34 PM
Are you using these new BTField APIs? If there’s something which you think should work but doesn’t just file an issue is what I’d suggest. Can’t say I’ve done something similar myself to have a better idea here.
thank you color 1
h

Halil Ozercan

03/31/2024, 4:27 AM
there's no way to get this information with the current stable TextField API. The new BasicTextField exposes this information but it's not ready to be a basis for a rich text editor since it cannot render AnnotatedStrings.
thank you color 1
However, I should note that it's certainly in our immediate future plans to support multi style text rendering/editing
🌟 2
m

mohamed rejeb

03/31/2024, 5:20 AM
Thanks! Looking forward to those updates.
m

Mofe Ejegi

03/31/2024, 1:17 PM
I recognised your name from the Compose Rich Editor library @mohamed rejeb Thank you for that, looking forward to implementing it in my project soon.
🙌 1
v

vgonda

04/02/2024, 2:21 PM
Following for updates. The thing I'm doing in my own rich text editor is super hacky and I'm eager for better support.
s

Stylianos Gakis

04/02/2024, 2:22 PM
Have you tried the new BTF APIs Victoria? Does that not fill your requirements here?
v

vgonda

04/02/2024, 2:25 PM
Unfortunately, I haven't had the time to revisit our rich text component to see.
👍 1
m

mohamed rejeb

04/02/2024, 3:42 PM
v

vgonda

04/02/2024, 3:50 PM
I think I looked at that for initial inspiration! It doesn't meet every requirement we have, but it was super helpful in learning how to handle certain things ❤️
56 Views