Skip to content
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

Add url and url_target to controls with on_click event #1337

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

FeodorFitsner
Copy link
Contributor

This PR is a solution for #1105 when Safari blocks redirects not initiated (or initiated with some delay) as a result of user gesture.

The solution allows to replace the code:

ft.ElevatedButton("Go to Google", on_click=lambda e: e.page.launch_url("https://google.com"))

with the one that does unconditional redirect on the client (on_click is called anyway):

ft.ElevatedButton("Go to Google", url="https://google.com")

New url and url_target properties were added to these controls:

  • Container
  • ElevatedButton
  • FilledButton
  • FilledTonalButton
  • FloatingActionButton
  • IconButton
  • ListTile
  • OutlinedButton
  • TextButton
  • TextSpan

New properties added to Markdown to auto-follow links:

  • auto_follow_links - default is False. on_tap_link event fires anyway.
  • auto_follow_links_target - default is _blank - new tab/window.

@FeodorFitsner FeodorFitsner merged commit da53ef2 into main Apr 25, 2023
@FeodorFitsner FeodorFitsner deleted the buttons-urls branch April 25, 2023 18:03
zrr1999 pushed a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
…v#1337)

* All buttons have `url` and `url_target` props

* `Markdown.auto_follow_links`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant