FletAppDemo/src/gallery/icon_catalog.py

17 lines
517 B
Python

"""Searchable names from the icon set shipped with the pinned Flet version."""
import flet as ft
ICON_NAMES = tuple(sorted(name for name in dir(ft.Icons) if name.isupper()))
PAGE_SIZE = 80
def matching_icons(query: str) -> tuple[str, ...]:
words = query.upper().split()
return tuple(name for name in ICON_NAMES if all(word in name for word in words))
def icon_snippet(name: str) -> str:
if name not in ICON_NAMES:
raise ValueError(f"Unknown Flet icon: {name}")
return f"ft.Icons.{name}"