flet 0.70.0.dev5774__py3-none-any.whl → 0.70.0.dev5835__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flet might be problematic. Click here for more details.
- flet/__init__.py +32 -4
- flet/components/__init__.py +0 -0
- flet/components/component.py +346 -0
- flet/components/component_decorator.py +24 -0
- flet/components/component_owned.py +22 -0
- flet/components/hooks/__init__.py +0 -0
- flet/components/hooks/hook.py +12 -0
- flet/components/hooks/use_callback.py +28 -0
- flet/components/hooks/use_context.py +91 -0
- flet/components/hooks/use_effect.py +104 -0
- flet/components/hooks/use_memo.py +52 -0
- flet/components/hooks/use_state.py +58 -0
- flet/components/memo.py +34 -0
- flet/components/observable.py +269 -0
- flet/components/public_utils.py +10 -0
- flet/components/utils.py +85 -0
- flet/controls/base_control.py +34 -10
- flet/controls/base_page.py +44 -40
- flet/controls/context.py +22 -1
- flet/controls/control.py +12 -6
- flet/controls/control_event.py +19 -2
- flet/controls/core/animated_switcher.py +3 -2
- flet/controls/core/autofill_group.py +6 -2
- flet/controls/core/column.py +5 -0
- flet/controls/core/dismissible.py +12 -10
- flet/controls/core/drag_target.py +20 -10
- flet/controls/core/draggable.py +9 -9
- flet/controls/core/icon.py +16 -12
- flet/controls/core/interactive_viewer.py +24 -23
- flet/controls/core/pagelet.py +3 -2
- flet/controls/core/reorderable_draggable.py +3 -2
- flet/controls/core/row.py +5 -0
- flet/controls/core/safe_area.py +3 -2
- flet/controls/core/text_span.py +5 -3
- flet/controls/core/view.py +6 -6
- flet/controls/core/window_drag_area.py +3 -2
- flet/controls/cupertino/cupertino_action_sheet.py +10 -5
- flet/controls/cupertino/cupertino_action_sheet_action.py +3 -4
- flet/controls/cupertino/cupertino_activity_indicator.py +4 -3
- flet/controls/cupertino/cupertino_alert_dialog.py +6 -3
- flet/controls/cupertino/cupertino_button.py +6 -5
- flet/controls/cupertino/cupertino_context_menu.py +8 -4
- flet/controls/cupertino/cupertino_context_menu_action.py +3 -4
- flet/controls/cupertino/cupertino_date_picker.py +44 -28
- flet/controls/cupertino/cupertino_dialog_action.py +3 -4
- flet/controls/cupertino/cupertino_list_tile.py +3 -4
- flet/controls/cupertino/cupertino_navigation_bar.py +6 -5
- flet/controls/cupertino/cupertino_picker.py +14 -10
- flet/controls/cupertino/cupertino_segmented_button.py +6 -5
- flet/controls/cupertino/cupertino_slider.py +16 -12
- flet/controls/cupertino/cupertino_sliding_segmented_button.py +6 -5
- flet/controls/cupertino/cupertino_timer_picker.py +38 -31
- flet/controls/id_counter.py +24 -0
- flet/controls/material/alert_dialog.py +6 -5
- flet/controls/material/app_bar.py +17 -14
- flet/controls/material/banner.py +13 -11
- flet/controls/material/bottom_app_bar.py +5 -4
- flet/controls/material/bottom_sheet.py +5 -4
- flet/controls/material/button.py +12 -4
- flet/controls/material/chip.py +13 -12
- flet/controls/material/circle_avatar.py +17 -13
- flet/controls/material/datatable.py +48 -41
- flet/controls/material/divider.py +30 -14
- flet/controls/material/dropdown.py +5 -3
- flet/controls/material/expansion_tile.py +11 -22
- flet/controls/material/floating_action_button.py +32 -23
- flet/controls/material/icon_button.py +7 -3
- flet/controls/material/navigation_rail.py +14 -11
- flet/controls/material/outlined_button.py +7 -3
- flet/controls/material/progress_bar.py +18 -10
- flet/controls/material/radio_group.py +5 -1
- flet/controls/material/range_slider.py +13 -13
- flet/controls/material/segmented_button.py +21 -17
- flet/controls/material/selection_area.py +3 -2
- flet/controls/material/slider.py +16 -12
- flet/controls/material/snack_bar.py +18 -10
- flet/controls/material/switch.py +6 -5
- flet/controls/material/tabs.py +18 -14
- flet/controls/material/textfield.py +32 -15
- flet/controls/material/vertical_divider.py +20 -12
- flet/controls/object_patch.py +434 -197
- flet/controls/page.py +205 -85
- flet/controls/services/haptic_feedback.py +0 -3
- flet/controls/services/shake_detector.py +0 -3
- flet/messaging/flet_socket_server.py +13 -6
- flet/messaging/session.py +103 -10
- flet/{controls/session_storage.py → messaging/session_store.py} +2 -2
- flet/version.py +1 -1
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/METADATA +5 -5
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/RECORD +93 -80
- flet/controls/cache.py +0 -87
- flet/controls/control_id.py +0 -22
- flet/controls/core/state_view.py +0 -60
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/WHEEL +0 -0
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/entry_points.txt +0 -0
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/top_level.txt +0 -0
flet/controls/control_id.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import itertools
|
|
2
|
-
import threading
|
|
3
|
-
|
|
4
|
-
from flet.utils.locks import NopeLock
|
|
5
|
-
from flet.utils.platform_utils import is_pyodide
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ControlId:
|
|
9
|
-
"""
|
|
10
|
-
Generates unique, auto-incrementing integers safely across
|
|
11
|
-
multiple threads and asyncio tasks using itertools.count.
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
_counter_iterator = itertools.count(3) # Creates an iterator starting at 3
|
|
15
|
-
_lock = threading.Lock() if not is_pyodide() else NopeLock()
|
|
16
|
-
|
|
17
|
-
@classmethod
|
|
18
|
-
def next(cls) -> int:
|
|
19
|
-
"""Returns the next unique integer identifier."""
|
|
20
|
-
with cls._lock:
|
|
21
|
-
# next() on the iterator is atomic *relative to the lock*
|
|
22
|
-
return next(cls._counter_iterator)
|
flet/controls/core/state_view.py
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import weakref
|
|
2
|
-
from dataclasses import InitVar
|
|
3
|
-
from typing import Any, Callable, ClassVar, Generic, Optional, TypeVar
|
|
4
|
-
|
|
5
|
-
from flet.controls.base_control import control
|
|
6
|
-
from flet.controls.control import Control
|
|
7
|
-
from flet.controls.ref import Ref
|
|
8
|
-
|
|
9
|
-
__all__ = ["StateView"]
|
|
10
|
-
|
|
11
|
-
T = TypeVar("T")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@control("StateView", post_init_args=4)
|
|
15
|
-
class StateView(Control, Generic[T]):
|
|
16
|
-
"""
|
|
17
|
-
Builds control tree on every update based on data.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
state: InitVar[T]
|
|
21
|
-
builder: InitVar[Callable[[T], Control]]
|
|
22
|
-
state_key: InitVar[Optional[Callable[[T], Any]]] = None
|
|
23
|
-
content: Optional[Control] = None
|
|
24
|
-
|
|
25
|
-
# Cache: (control_id, state_id) -> control
|
|
26
|
-
_builder_cache: ClassVar[weakref.WeakValueDictionary[tuple[int, Any], Control]] = (
|
|
27
|
-
weakref.WeakValueDictionary()
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
def __post_init__(
|
|
31
|
-
self,
|
|
32
|
-
ref: Optional[Ref[Any]],
|
|
33
|
-
state: T,
|
|
34
|
-
builder: Callable[[T], Control],
|
|
35
|
-
state_key: Optional[Callable[[T], Any]] = None,
|
|
36
|
-
):
|
|
37
|
-
Control.__post_init__(self, ref)
|
|
38
|
-
self._state: T = state
|
|
39
|
-
self._builder = builder
|
|
40
|
-
self._state_key = state_key
|
|
41
|
-
|
|
42
|
-
def before_update(self):
|
|
43
|
-
# print(f"StateView({self._i}).before_update")
|
|
44
|
-
frozen = getattr(self, "_frozen", None)
|
|
45
|
-
if frozen:
|
|
46
|
-
del self._frozen
|
|
47
|
-
|
|
48
|
-
cache_key = (self._i, self._state_key(self._state)) if self._state_key else None
|
|
49
|
-
|
|
50
|
-
if cache_key is not None and cache_key in self._builder_cache:
|
|
51
|
-
self.content = self._builder_cache[cache_key]
|
|
52
|
-
else:
|
|
53
|
-
self.content = self._builder(self._state)
|
|
54
|
-
if cache_key is not None and self.content:
|
|
55
|
-
self._builder_cache[cache_key] = self.content
|
|
56
|
-
|
|
57
|
-
if self.content:
|
|
58
|
-
object.__setattr__(self.content, "_frozen", True)
|
|
59
|
-
if frozen:
|
|
60
|
-
self._frozen = frozen
|
|
File without changes
|
|
File without changes
|
|
File without changes
|