-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SelectionArea fails for TextSpan elements #3035
Labels
bug
Something isn't working
Comments
One hint is in flutter/flutter#113530 , in the thread the recommendation is to use Text.rich instead of RichText.
I'm going to try a build with the change |
The following patch seems to fix it:
|
Will you mind opening a PR with the suggestion? |
sgrefen
added a commit
to sgrefen/flet
that referenced
this issue
Apr 20, 2024
FeodorFitsner
pushed a commit
that referenced
this issue
Apr 30, 2024
50Bytes-dev
pushed a commit
to 50Bytes-dev/flet
that referenced
this issue
May 18, 2024
zrr1999
pushed a commit
to zrr1999/flet
that referenced
this issue
Jul 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When ft.Text is in a SelectionArea the on_change callback works as intended, unless either selectable is True or the Text is using TextSpans. In the later case the spans are not selectable (unless selectable is True which breaks the on_change callback).
WebView and local Linux client behave identically.
Code example to reproduce the issue:
Describe the results you received:
Only the first text works as expected, this are selectable areas
and only these callbacks are generated:
$ python tcg.py package:media_kit_libs_linux registered. PE(plain False) {'target': '_2', 'name': 'change', 'data': '', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': 'T', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': 'TE', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': 'TEST [ plain select False]\n 432', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': 'TEST [ plain select False]\n 4324', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': 'TEST [ plain select False]\n 43240932840329\nsffsf', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')} PE(plain False) {'target': '_2', 'name': 'change', 'data': '', 'control': SelectionArea(), 'page': Page(id='page', route='/', pwa='false', web='false', debug='false', platform='linux', platformbrightness='light', media='{"padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_padding":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0},"view_insets":{"top":0.0,"right":0.0,"bottom":0.0,"left":0.0}}', width='1280.0', height='720.0', windowwidth='1280.0', windowheight='720.0', windowtop='0.0', windowleft='0.0', clientip='', clientuseragent='', windowminimized='false', windowmaximized='false', windowfocused='false', windowfullscreen='false')}
Describe the results you expected:
Expectation is receiving events also for text-spans, ideally as array with text_span-id + selected text in span
Additional information you deem important (e.g. issue happens only occasionally):
Flet version (
pip show flet
):The text was updated successfully, but these errors were encountered: