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/core/pagelet.py
CHANGED
|
@@ -26,7 +26,7 @@ class Pagelet(LayoutControl, AdaptiveControl):
|
|
|
26
26
|
such as demos and galleries.
|
|
27
27
|
|
|
28
28
|
Raises:
|
|
29
|
-
|
|
29
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
content: Control
|
|
@@ -104,7 +104,8 @@ class Pagelet(LayoutControl, AdaptiveControl):
|
|
|
104
104
|
|
|
105
105
|
def before_update(self):
|
|
106
106
|
super().before_update()
|
|
107
|
-
|
|
107
|
+
if not self.content.visible:
|
|
108
|
+
raise ValueError("content must be visible")
|
|
108
109
|
|
|
109
110
|
# todo: deprecate show_* in favor of a open/close methods, or page.open/close
|
|
110
111
|
# Drawer
|
|
@@ -13,7 +13,7 @@ class ReorderableDraggable(LayoutControl, AdaptiveControl):
|
|
|
13
13
|
event over the given [`content`][(c).] control.
|
|
14
14
|
|
|
15
15
|
Raises:
|
|
16
|
-
|
|
16
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
index: int
|
|
@@ -29,4 +29,5 @@ class ReorderableDraggable(LayoutControl, AdaptiveControl):
|
|
|
29
29
|
|
|
30
30
|
def before_update(self):
|
|
31
31
|
super().before_update()
|
|
32
|
-
|
|
32
|
+
if not self.content.visible:
|
|
33
|
+
raise ValueError("content must be visible")
|
flet/controls/core/row.py
CHANGED
|
@@ -68,6 +68,11 @@ class Row(LayoutControl, ScrollableControl, AdaptiveControl):
|
|
|
68
68
|
How the runs should be placed in the cross-axis when `wrap=True`.
|
|
69
69
|
"""
|
|
70
70
|
|
|
71
|
+
intrinsic_height: bool = False
|
|
72
|
+
"""
|
|
73
|
+
If `True`, the Row will be as tall as the tallest child control.
|
|
74
|
+
"""
|
|
75
|
+
|
|
71
76
|
def init(self):
|
|
72
77
|
super().init()
|
|
73
78
|
self._internals["host_expanded"] = True
|
flet/controls/core/safe_area.py
CHANGED
|
@@ -23,7 +23,7 @@ class SafeArea(LayoutControl, AdaptiveControl):
|
|
|
23
23
|
or the safe area padding will be applied.
|
|
24
24
|
|
|
25
25
|
Raises:
|
|
26
|
-
|
|
26
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
content: Control
|
|
@@ -71,4 +71,5 @@ class SafeArea(LayoutControl, AdaptiveControl):
|
|
|
71
71
|
|
|
72
72
|
def before_update(self):
|
|
73
73
|
super().before_update()
|
|
74
|
-
|
|
74
|
+
if not self.content.visible:
|
|
75
|
+
raise ValueError("content must be visible")
|
flet/controls/core/text_span.py
CHANGED
|
@@ -18,6 +18,9 @@ class TextSpan(Control):
|
|
|
18
18
|
|
|
19
19
|
For the object to be useful, at least one of [`text`][(c).] or
|
|
20
20
|
[`spans`][(c).] should be set.
|
|
21
|
+
|
|
22
|
+
Raises:
|
|
23
|
+
ValueError: If [`semantics_label`][(c).] is set when [`text`][(c).] is `None`.
|
|
21
24
|
"""
|
|
22
25
|
|
|
23
26
|
text: Optional[str] = None
|
|
@@ -94,6 +97,5 @@ class TextSpan(Control):
|
|
|
94
97
|
|
|
95
98
|
def before_update(self):
|
|
96
99
|
super().before_update()
|
|
97
|
-
|
|
98
|
-
"semantics_label can be set only when text is not None"
|
|
99
|
-
)
|
|
100
|
+
if self.text is None and self.semantics_label is not None:
|
|
101
|
+
raise ValueError("semantics_label can be set only when text is not None")
|
flet/controls/core/view.py
CHANGED
|
@@ -37,12 +37,6 @@ class View(ScrollableControl, LayoutControl):
|
|
|
37
37
|
control, so it has a similar behavior and shares same properties.
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
|
-
route: Optional[str] = None
|
|
41
|
-
"""
|
|
42
|
-
View's route - not currently used by Flet framework, but can be used in a user
|
|
43
|
-
program to update [`Page.route`][flet.] when a view popped.
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
40
|
controls: list[BaseControl] = field(default_factory=list)
|
|
47
41
|
"""
|
|
48
42
|
A list of controls to display.
|
|
@@ -71,6 +65,12 @@ class View(ScrollableControl, LayoutControl):
|
|
|
71
65
|
///
|
|
72
66
|
"""
|
|
73
67
|
|
|
68
|
+
route: Optional[str] = field(default_factory=lambda: "/")
|
|
69
|
+
"""
|
|
70
|
+
View's route - not currently used by Flet framework, but can be used in a user
|
|
71
|
+
program to update [`Page.route`][flet.Page.route] when a view popped.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
74
|
appbar: Optional[Union[AppBar, CupertinoAppBar]] = None
|
|
75
75
|
"""
|
|
76
76
|
An [`AppBar`][flet.] control to display at the top of
|
|
@@ -15,7 +15,7 @@ class WindowDragArea(LayoutControl):
|
|
|
15
15
|
title bar on the [`content`][(c).] control.
|
|
16
16
|
|
|
17
17
|
Raises:
|
|
18
|
-
|
|
18
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
content: Control
|
|
@@ -54,4 +54,5 @@ class WindowDragArea(LayoutControl):
|
|
|
54
54
|
|
|
55
55
|
def before_update(self):
|
|
56
56
|
super().before_update()
|
|
57
|
-
|
|
57
|
+
if not self.content.visible:
|
|
58
|
+
raise ValueError("content must be visible")
|
|
@@ -15,6 +15,10 @@ class CupertinoActionSheet(LayoutControl):
|
|
|
15
15
|
|
|
16
16
|
Action sheets are generally used to give the user a choice between
|
|
17
17
|
two or more choices for the current context.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
ValueError: If none of [`actions`][(c).], [`title`][(c).], [`message`][(c).],
|
|
21
|
+
or [`cancel`][(c).] are provided.
|
|
18
22
|
"""
|
|
19
23
|
|
|
20
24
|
title: Optional[StrOrControl] = None
|
|
@@ -48,12 +52,13 @@ class CupertinoActionSheet(LayoutControl):
|
|
|
48
52
|
|
|
49
53
|
def before_update(self):
|
|
50
54
|
super().before_update()
|
|
51
|
-
|
|
55
|
+
if not (
|
|
52
56
|
self.actions is not None
|
|
53
57
|
or self.title is not None
|
|
54
58
|
or self.message is not None
|
|
55
59
|
or self.cancel is not None
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
):
|
|
61
|
+
raise ValueError(
|
|
62
|
+
"This action sheet must have a non-None value for at least one of the "
|
|
63
|
+
"following arguments: `actions`, `title`, `message`, or `cancel`"
|
|
64
|
+
)
|
|
@@ -14,7 +14,7 @@ class CupertinoActionSheetAction(LayoutControl):
|
|
|
14
14
|
An action button typically used in a CupertinoActionSheet.
|
|
15
15
|
|
|
16
16
|
Raises:
|
|
17
|
-
|
|
17
|
+
ValueError: If [`content`][(c).] is neither a string nor a visible Control.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
content: StrOrControl
|
|
@@ -44,6 +44,5 @@ class CupertinoActionSheetAction(LayoutControl):
|
|
|
44
44
|
|
|
45
45
|
def before_update(self):
|
|
46
46
|
super().before_update()
|
|
47
|
-
|
|
48
|
-
"content must be a string or a visible Control"
|
|
49
|
-
)
|
|
47
|
+
if not (isinstance(self.content, str) or self.content.visible):
|
|
48
|
+
raise ValueError("content must be a string or a visible Control")
|
|
@@ -36,6 +36,7 @@ class CupertinoActivityIndicator(LayoutControl):
|
|
|
36
36
|
|
|
37
37
|
def before_update(self):
|
|
38
38
|
super().before_update()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if self.radius <= 0.0:
|
|
40
|
+
raise ValueError(
|
|
41
|
+
f"radius must be strictly greater than 0.0, got {self.radius}"
|
|
42
|
+
)
|
|
@@ -60,9 +60,12 @@ class CupertinoAlertDialog(DialogControl):
|
|
|
60
60
|
|
|
61
61
|
def before_update(self):
|
|
62
62
|
super().before_update()
|
|
63
|
-
|
|
63
|
+
if not (
|
|
64
64
|
(isinstance(self.title, str) or self.title.visible)
|
|
65
65
|
or (self.content and self.content.visible)
|
|
66
66
|
or any(a.visible for a in self.actions)
|
|
67
|
-
)
|
|
68
|
-
|
|
67
|
+
):
|
|
68
|
+
raise ValueError(
|
|
69
|
+
"AlertDialog has nothing to display. Provide at minimum one of the "
|
|
70
|
+
"following: title, content, actions"
|
|
71
|
+
)
|
|
@@ -33,7 +33,7 @@ class CupertinoButton(LayoutControl):
|
|
|
33
33
|
An iOS-style button.
|
|
34
34
|
|
|
35
35
|
Raises:
|
|
36
|
-
|
|
36
|
+
ValueError: If [`opacity_on_click`][(c).] is not between `0.0`
|
|
37
37
|
and `1.0` inclusive.
|
|
38
38
|
"""
|
|
39
39
|
|
|
@@ -158,10 +158,11 @@ class CupertinoButton(LayoutControl):
|
|
|
158
158
|
|
|
159
159
|
def before_update(self):
|
|
160
160
|
super().before_update()
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
if not (0 <= self.opacity_on_click <= 1):
|
|
162
|
+
raise ValueError(
|
|
163
|
+
"opacity_on_click must be between 0 and 1 inclusive, "
|
|
164
|
+
f"got {self.opacity_on_click}"
|
|
165
|
+
)
|
|
165
166
|
|
|
166
167
|
async def focus(self):
|
|
167
168
|
await self._invoke_method("focus")
|
|
@@ -9,6 +9,10 @@ __all__ = ["CupertinoContextMenu"]
|
|
|
9
9
|
class CupertinoContextMenu(AdaptiveControl):
|
|
10
10
|
"""
|
|
11
11
|
A full-screen modal route that opens up when the [`content`][(c).] is long-pressed.
|
|
12
|
+
|
|
13
|
+
Raises:
|
|
14
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
15
|
+
ValueError: If [`actions`][(c).] does not contain at least one visible action.
|
|
12
16
|
"""
|
|
13
17
|
|
|
14
18
|
content: Control
|
|
@@ -38,7 +42,7 @@ class CupertinoContextMenu(AdaptiveControl):
|
|
|
38
42
|
|
|
39
43
|
def before_update(self):
|
|
40
44
|
super().before_update()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if not self.content.visible:
|
|
46
|
+
raise ValueError("content must be visible")
|
|
47
|
+
if not any(a.visible for a in self.actions):
|
|
48
|
+
raise ValueError("at least one action must be visible")
|
|
@@ -16,7 +16,7 @@ class CupertinoContextMenuAction(AdaptiveControl):
|
|
|
16
16
|
Typically used as a child of [`CupertinoContextMenu.actions`][flet.].
|
|
17
17
|
|
|
18
18
|
Raises:
|
|
19
|
-
|
|
19
|
+
ValueError: If [`content`][(c).] is neither a string nor a visible Control.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
content: StrOrControl
|
|
@@ -46,6 +46,5 @@ class CupertinoContextMenuAction(AdaptiveControl):
|
|
|
46
46
|
|
|
47
47
|
def before_update(self):
|
|
48
48
|
super().before_update()
|
|
49
|
-
|
|
50
|
-
"content must be a string or a visible Control"
|
|
51
|
-
)
|
|
49
|
+
if not (isinstance(self.content, str) or self.content.visible):
|
|
50
|
+
raise ValueError("content must be a string or a visible Control")
|
|
@@ -34,6 +34,15 @@ class CupertinoDatePickerDateOrder(Enum):
|
|
|
34
34
|
class CupertinoDatePicker(LayoutControl):
|
|
35
35
|
"""
|
|
36
36
|
An iOS-styled date picker.
|
|
37
|
+
|
|
38
|
+
Raises:
|
|
39
|
+
ValueError: If [`item_extent`][(c).] is not strictly greater than `0`.
|
|
40
|
+
ValueError: If [`minute_interval`][(c).] is not a positive integer
|
|
41
|
+
factor of `60`.
|
|
42
|
+
ValueError: If [`value`][(c).] is before [`first_date`][(c).] or
|
|
43
|
+
after [`last_date`][(c).].
|
|
44
|
+
ValueError: If [`value`][(c).] year is less than [`minimum_year`][(c).] or
|
|
45
|
+
greater than [`maximum_year`][(c).].
|
|
37
46
|
"""
|
|
38
47
|
|
|
39
48
|
value: DateTimeValue = field(default_factory=lambda: datetime.now())
|
|
@@ -159,21 +168,23 @@ class CupertinoDatePicker(LayoutControl):
|
|
|
159
168
|
else:
|
|
160
169
|
value = self.value
|
|
161
170
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
if self.item_extent <= 0:
|
|
172
|
+
raise ValueError(
|
|
173
|
+
f"item_extent must be strictly greater than 0, got {self.item_extent}"
|
|
174
|
+
)
|
|
175
|
+
if not (self.minute_interval > 0 and 60 % self.minute_interval == 0):
|
|
176
|
+
raise ValueError(
|
|
177
|
+
f"minute_interval must be a positive integer factor of 60, "
|
|
178
|
+
f"got {self.minute_interval}"
|
|
179
|
+
)
|
|
169
180
|
|
|
170
181
|
if self.date_picker_mode == CupertinoDatePickerMode.DATE_AND_TIME:
|
|
171
|
-
if self.first_date:
|
|
172
|
-
|
|
182
|
+
if self.first_date and value < self.first_date:
|
|
183
|
+
raise ValueError(
|
|
173
184
|
f"value ({value}) can't be before first_date ({self.first_date})"
|
|
174
185
|
)
|
|
175
|
-
if self.last_date:
|
|
176
|
-
|
|
186
|
+
if self.last_date and value > self.last_date:
|
|
187
|
+
raise ValueError(
|
|
177
188
|
f"value ({value}) can't be after last_date ({self.last_date})"
|
|
178
189
|
)
|
|
179
190
|
|
|
@@ -181,34 +192,39 @@ class CupertinoDatePicker(LayoutControl):
|
|
|
181
192
|
CupertinoDatePickerMode.DATE,
|
|
182
193
|
CupertinoDatePickerMode.MONTH_YEAR,
|
|
183
194
|
]:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
195
|
+
if not (1 <= self.minimum_year <= value.year):
|
|
196
|
+
raise ValueError(
|
|
197
|
+
f"value.year ({value.year}) can't be less than minimum_year "
|
|
198
|
+
f"({self.minimum_year})"
|
|
199
|
+
)
|
|
188
200
|
|
|
189
|
-
if self.maximum_year:
|
|
190
|
-
|
|
201
|
+
if self.maximum_year and value.year > self.maximum_year:
|
|
202
|
+
raise ValueError(
|
|
191
203
|
f"value.year ({value.year}) can't be greater than maximum_year "
|
|
204
|
+
f"({self.maximum_year})"
|
|
192
205
|
)
|
|
193
|
-
f"({self.maximum_year})"
|
|
194
206
|
|
|
195
|
-
if self.first_date:
|
|
196
|
-
|
|
207
|
+
if self.first_date and value < self.first_date:
|
|
208
|
+
raise ValueError(
|
|
197
209
|
f"value ({value}) can't be before first_date ({self.first_date})"
|
|
198
210
|
)
|
|
199
211
|
|
|
200
|
-
if self.last_date:
|
|
201
|
-
|
|
212
|
+
if self.last_date and value > self.last_date:
|
|
213
|
+
raise ValueError(
|
|
202
214
|
f"value ({value}) can't be after last_date ({self.last_date})"
|
|
203
215
|
)
|
|
204
216
|
|
|
205
|
-
if
|
|
206
|
-
|
|
217
|
+
if (
|
|
218
|
+
self.date_picker_mode != CupertinoDatePickerMode.DATE
|
|
219
|
+
and self.show_day_of_week
|
|
220
|
+
):
|
|
221
|
+
raise ValueError(
|
|
207
222
|
"show_day_of_week is only supported when date_picker_mode is "
|
|
208
223
|
"CupertinoDatePickerMode.DATE"
|
|
209
224
|
)
|
|
210
225
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
226
|
+
if value.minute % self.minute_interval != 0:
|
|
227
|
+
raise ValueError(
|
|
228
|
+
f"value.minute ({value.minute}) must be divisible by minute_interval "
|
|
229
|
+
f"({self.minute_interval})"
|
|
230
|
+
)
|
|
@@ -17,7 +17,7 @@ class CupertinoDialogAction(Control):
|
|
|
17
17
|
Typically used as a child of [`CupertinoAlertDialog.actions`][flet.].
|
|
18
18
|
|
|
19
19
|
Raises:
|
|
20
|
-
|
|
20
|
+
ValueError: If [`content`][(c).] is neither a string nor a visible Control.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
content: StrOrControl
|
|
@@ -57,6 +57,5 @@ class CupertinoDialogAction(Control):
|
|
|
57
57
|
|
|
58
58
|
def before_update(self):
|
|
59
59
|
super().before_update()
|
|
60
|
-
|
|
61
|
-
"content must be a string or a visible Control"
|
|
62
|
-
)
|
|
60
|
+
if not (isinstance(self.content, str) or self.content.visible):
|
|
61
|
+
raise ValueError("content must be a string or a visible Control")
|
|
@@ -23,7 +23,7 @@ class CupertinoListTile(LayoutControl):
|
|
|
23
23
|
Can also serve as a cupertino equivalent of the Material [`ListTile`][flet.].
|
|
24
24
|
|
|
25
25
|
Raises:
|
|
26
|
-
|
|
26
|
+
ValueError: If [`title`][(c).] is neither a string nor a visible Control.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
title: StrOrControl
|
|
@@ -120,6 +120,5 @@ class CupertinoListTile(LayoutControl):
|
|
|
120
120
|
|
|
121
121
|
def before_update(self):
|
|
122
122
|
super().before_update()
|
|
123
|
-
|
|
124
|
-
"title must be a string or a visible Control"
|
|
125
|
-
)
|
|
123
|
+
if not (isinstance(self.title, str) or self.title.visible):
|
|
124
|
+
raise ValueError("title must be a string or a visible Control")
|
|
@@ -23,7 +23,7 @@ class CupertinoNavigationBar(LayoutControl):
|
|
|
23
23
|
destinations in an app.
|
|
24
24
|
|
|
25
25
|
Raises:
|
|
26
|
-
|
|
26
|
+
ValueError: If [`destinations`][(c).] does not contain at least two visible
|
|
27
27
|
[`NavigationBarDestination`][flet.]s.
|
|
28
28
|
IndexError: If [`selected_index`][(c).] is out of range.
|
|
29
29
|
"""
|
|
@@ -80,10 +80,11 @@ class CupertinoNavigationBar(LayoutControl):
|
|
|
80
80
|
def before_update(self):
|
|
81
81
|
super().before_update()
|
|
82
82
|
visible_destinations_count = len([d for d in self.destinations if d.visible])
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
if visible_destinations_count < 2:
|
|
84
|
+
raise ValueError(
|
|
85
|
+
f"destinations must contain at minimum two visible controls, "
|
|
86
|
+
f"got {visible_destinations_count}"
|
|
87
|
+
)
|
|
87
88
|
if not (0 <= self.selected_index < visible_destinations_count):
|
|
88
89
|
raise IndexError(
|
|
89
90
|
f"selected_index ({self.selected_index}) is out of range. "
|
|
@@ -20,7 +20,7 @@ class CupertinoPicker(LayoutControl):
|
|
|
20
20
|
An iOS-styled picker.
|
|
21
21
|
|
|
22
22
|
Raises:
|
|
23
|
-
|
|
23
|
+
ValueError: If [`item_extent`][(c).], [`squeeze`][(c).],
|
|
24
24
|
or [`magnification`][(c).] is not strictly greater than `0.0`.
|
|
25
25
|
"""
|
|
26
26
|
|
|
@@ -104,12 +104,16 @@ class CupertinoPicker(LayoutControl):
|
|
|
104
104
|
|
|
105
105
|
def before_update(self):
|
|
106
106
|
super().before_update()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
if self.squeeze <= 0.0:
|
|
108
|
+
raise ValueError(
|
|
109
|
+
f"squeeze must be strictly greater than 0.0, got {self.squeeze}"
|
|
110
|
+
)
|
|
111
|
+
if self.magnification <= 0.0:
|
|
112
|
+
raise ValueError(
|
|
113
|
+
f"magnification must be strictly greater than 0.0, "
|
|
114
|
+
f"got {self.magnification}"
|
|
115
|
+
)
|
|
116
|
+
if self.item_extent <= 0.0:
|
|
117
|
+
raise ValueError(
|
|
118
|
+
f"item_extent must be strictly greater than 0.0, got {self.item_extent}"
|
|
119
|
+
)
|
|
@@ -16,7 +16,7 @@ class CupertinoSegmentedButton(LayoutControl):
|
|
|
16
16
|
An iOS-style segmented button.
|
|
17
17
|
|
|
18
18
|
Raises:
|
|
19
|
-
|
|
19
|
+
ValueError: If [`controls`][(c).] does not contain at least two visible
|
|
20
20
|
controls.
|
|
21
21
|
IndexError: If [`selected_index`][(c).] is out of range.
|
|
22
22
|
"""
|
|
@@ -88,10 +88,11 @@ class CupertinoSegmentedButton(LayoutControl):
|
|
|
88
88
|
def before_update(self):
|
|
89
89
|
super().before_update()
|
|
90
90
|
visible_controls_count = len([c for c in self.controls if c.visible])
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
if visible_controls_count < 2:
|
|
92
|
+
raise ValueError(
|
|
93
|
+
f"controls must contain at minimum two visible Controls, "
|
|
94
|
+
f"got {visible_controls_count}"
|
|
95
|
+
)
|
|
95
96
|
if not (0 <= self.selected_index < visible_controls_count):
|
|
96
97
|
raise IndexError(
|
|
97
98
|
f"selected_index ({self.selected_index}) is out of range. "
|
|
@@ -24,9 +24,9 @@ class CupertinoSlider(LayoutControl):
|
|
|
24
24
|
setting changes.
|
|
25
25
|
|
|
26
26
|
Raises:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
ValueError: If [`min`][(c).] is greater than [`max`][(c).].
|
|
28
|
+
ValueError: If [`value`][(c).] is less than [`min`][(c).].
|
|
29
|
+
ValueError: If [`value`][(c).] is greater than [`max`][(c).].
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
value: Optional[Number] = None
|
|
@@ -102,12 +102,16 @@ class CupertinoSlider(LayoutControl):
|
|
|
102
102
|
def before_update(self):
|
|
103
103
|
super().before_update()
|
|
104
104
|
self.value = self.value if self.value is not None else self.min
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
if self.min > self.max:
|
|
106
|
+
raise ValueError(
|
|
107
|
+
f"min ({self.min}) must be less than or equal to max ({self.max})"
|
|
108
|
+
)
|
|
109
|
+
if self.value is not None and self.value < self.min:
|
|
110
|
+
raise ValueError(
|
|
111
|
+
f"value ({self.value}) must be greater than or "
|
|
112
|
+
f"equal to min ({self.min})"
|
|
113
|
+
)
|
|
114
|
+
if self.value is not None and self.value > self.max:
|
|
115
|
+
raise ValueError(
|
|
116
|
+
f"value ({self.value}) must be less than or equal to max ({self.max})"
|
|
117
|
+
)
|
|
@@ -20,7 +20,7 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
|
|
|
20
20
|
A cupertino sliding segmented button.
|
|
21
21
|
|
|
22
22
|
Raises:
|
|
23
|
-
|
|
23
|
+
ValueError: If [`controls`][(c).] does not contain at least two
|
|
24
24
|
visible controls.
|
|
25
25
|
IndexError: If [`selected_index`][(c).] is out of range.
|
|
26
26
|
"""
|
|
@@ -78,10 +78,11 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
|
|
|
78
78
|
def before_update(self):
|
|
79
79
|
super().before_update()
|
|
80
80
|
visible_controls_count = len([c for c in self.controls if c.visible])
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if visible_controls_count < 2:
|
|
82
|
+
raise ValueError(
|
|
83
|
+
f"controls must contain at minimum two visible Controls, "
|
|
84
|
+
f"got {visible_controls_count}"
|
|
85
|
+
)
|
|
85
86
|
if not (0 <= self.selected_index < visible_controls_count):
|
|
86
87
|
raise IndexError(
|
|
87
88
|
f"selected_index ({self.selected_index}) is out of range. "
|