flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.5k stars 449 forks source link

fix: `Segment` and `NavigationBarDestination` accept only string tooltips #4326

Closed ndonkoHenri closed 1 week ago

ndonkoHenri commented 2 weeks ago

Fixes #4324

Test Code

```python import flet as ft def main(page: ft.Page): page.horizontal_alignment = ft.CrossAxisAlignment.CENTER page.vertical_alignment = ft.MainAxisAlignment.CENTER page.navigation_bar = ft.NavigationBar( destinations=[ ft.NavigationBarDestination("one", icon=ft.icons.ADD, tooltip="one"), ft.NavigationBarDestination("two", icon=ft.icons.TWO_K, tooltip="two"), ], ) page.add( ft.SegmentedButton( selected={"0"}, selected_icon=ft.Icon(ft.icons.CHECK), segments=[ ft.Segment( value="0", icon=ft.Icon(ft.icons.LOOKS_ONE), label=ft.Text("I am Text", size=16), tooltip="tooltip from text", ), ft.Segment( value="2", icon=ft.Icon(ft.icons.LOOKS_3), label=ft.Text( "I am Class", size=16, tooltip=ft.Tooltip( message="tooltip from class", padding=3, border_radius=10, gradient=ft.LinearGradient( colors=[ft.colors.RED, ft.colors.BLUE] ), ), ), ), ], ) ) ft.app(main) ```

Summary by Sourcery

Fix tooltip handling in Segment and NavigationBarDestination to accept only string values and update plugin registrations for platform-specific screen_retriever plugins.

Bug Fixes:

Enhancements:

Chores: