flet 0.70.0.dev5774__py3-none-any.whl → 0.70.0.dev5776__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/controls/control.py +12 -6
- flet/controls/core/animated_switcher.py +3 -2
- flet/controls/core/autofill_group.py +6 -2
- flet/controls/core/dismissible.py +12 -10
- flet/controls/core/drag_target.py +3 -2
- 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/safe_area.py +3 -2
- flet/controls/core/text_span.py +5 -3
- 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/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 +24 -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 +22 -14
- flet/controls/material/vertical_divider.py +14 -12
- flet/controls/page.py +2 -1
- flet/version.py +1 -1
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5776.dist-info}/METADATA +5 -5
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5776.dist-info}/RECORD +63 -63
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5776.dist-info}/WHEEL +0 -0
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5776.dist-info}/entry_points.txt +0 -0
- {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5776.dist-info}/top_level.txt +0 -0
flet/controls/control.py
CHANGED
|
@@ -15,6 +15,10 @@ class Control(BaseControl):
|
|
|
15
15
|
Base class for controls.
|
|
16
16
|
|
|
17
17
|
Not meant to be used directly.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
ValueError: If [`opacity`][(c).] is not between `0.0` and `1.0` inclusive.
|
|
21
|
+
ValueError: If [`expand`][(c).] is not None and not of type `bool` or `int`.
|
|
18
22
|
"""
|
|
19
23
|
|
|
20
24
|
expand: Optional[Union[bool, int]] = None
|
|
@@ -132,12 +136,14 @@ class Control(BaseControl):
|
|
|
132
136
|
|
|
133
137
|
def before_update(self):
|
|
134
138
|
super().before_update()
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
if not (0.0 <= self.opacity <= 1.0):
|
|
140
|
+
raise ValueError(
|
|
141
|
+
f"opacity must be between 0.0 and 1.0 inclusive, got {self.opacity}"
|
|
142
|
+
)
|
|
143
|
+
if self.expand is not None and not isinstance(self.expand, (bool, int)):
|
|
144
|
+
raise ValueError(
|
|
145
|
+
f"expand must be of type bool or int, got {type(self.expand)}"
|
|
146
|
+
)
|
|
141
147
|
|
|
142
148
|
def clean(self) -> None:
|
|
143
149
|
raise Exception("Deprecated!")
|
|
@@ -22,7 +22,7 @@ class AnimatedSwitcher(LayoutControl):
|
|
|
22
22
|
Used to switch between controls with an animation.
|
|
23
23
|
|
|
24
24
|
Raises:
|
|
25
|
-
|
|
25
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
content: Control
|
|
@@ -60,4 +60,5 @@ class AnimatedSwitcher(LayoutControl):
|
|
|
60
60
|
|
|
61
61
|
def before_update(self):
|
|
62
62
|
super().before_update()
|
|
63
|
-
|
|
63
|
+
if not self.content.visible:
|
|
64
|
+
raise ValueError("content must be visible")
|
|
@@ -3,7 +3,7 @@ from enum import Enum
|
|
|
3
3
|
from flet.controls.base_control import control
|
|
4
4
|
from flet.controls.control import Control
|
|
5
5
|
|
|
6
|
-
__all__ = ["AutofillGroup", "
|
|
6
|
+
__all__ = ["AutofillGroup", "AutofillGroupDisposeAction", "AutofillHint"]
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class AutofillHint(Enum):
|
|
@@ -84,6 +84,9 @@ class AutofillGroupDisposeAction(Enum):
|
|
|
84
84
|
class AutofillGroup(Control):
|
|
85
85
|
"""
|
|
86
86
|
Used to group autofill controls together.
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
87
90
|
"""
|
|
88
91
|
|
|
89
92
|
content: Control
|
|
@@ -99,4 +102,5 @@ class AutofillGroup(Control):
|
|
|
99
102
|
|
|
100
103
|
def before_update(self):
|
|
101
104
|
super().before_update()
|
|
102
|
-
|
|
105
|
+
if not self.content.visible:
|
|
106
|
+
raise ValueError("content must be visible")
|
|
@@ -46,9 +46,9 @@ class Dismissible(LayoutControl, AdaptiveControl):
|
|
|
46
46
|
over the specified [`resize_duration`][(c).].
|
|
47
47
|
|
|
48
48
|
Raises:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[`background`][(c).] is not
|
|
49
|
+
ValueError: If the [`content`][(c).] is not visible.
|
|
50
|
+
ValueError: If the [`secondary_background`][(c).] is provided and visible
|
|
51
|
+
but the [`background`][(c).] is not provided and visible.
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
content: Control
|
|
@@ -155,13 +155,15 @@ class Dismissible(LayoutControl, AdaptiveControl):
|
|
|
155
155
|
|
|
156
156
|
def before_update(self):
|
|
157
157
|
super().before_update()
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
if not self.content.visible:
|
|
159
|
+
raise ValueError("content must be visible")
|
|
160
|
+
if (self.secondary_background and self.secondary_background.visible) and not (
|
|
161
|
+
self.background and self.background.visible
|
|
162
|
+
):
|
|
163
|
+
raise ValueError(
|
|
164
|
+
"secondary_background can only be specified if background is also "
|
|
165
|
+
"specified/visible"
|
|
166
|
+
)
|
|
165
167
|
|
|
166
168
|
async def confirm_dismiss(self, dismiss: bool):
|
|
167
169
|
await self._invoke_method("confirm_dismiss", {"dismiss": dismiss})
|
|
@@ -50,7 +50,7 @@ class DragTarget(Control):
|
|
|
50
50
|
asked to accept the `Draggable`'s data.
|
|
51
51
|
|
|
52
52
|
Raises:
|
|
53
|
-
|
|
53
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
54
54
|
"""
|
|
55
55
|
|
|
56
56
|
content: Control
|
|
@@ -92,4 +92,5 @@ class DragTarget(Control):
|
|
|
92
92
|
|
|
93
93
|
def before_update(self):
|
|
94
94
|
super().before_update()
|
|
95
|
-
|
|
95
|
+
if not self.content.visible:
|
|
96
|
+
raise ValueError("content must be visible")
|
flet/controls/core/draggable.py
CHANGED
|
@@ -19,8 +19,8 @@ class Draggable(Control):
|
|
|
19
19
|
given the opportunity to complete drag-and-drop flow.
|
|
20
20
|
|
|
21
21
|
Raises:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
23
|
+
ValueError: If [`max_simultaneous_drags`][(c).] is set to a negative value.
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
content: Control
|
|
@@ -101,10 +101,10 @@ class Draggable(Control):
|
|
|
101
101
|
|
|
102
102
|
def before_update(self):
|
|
103
103
|
super().before_update()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
if not self.content.visible:
|
|
105
|
+
raise ValueError("content must be visible")
|
|
106
|
+
if self.max_simultaneous_drags is not None and self.max_simultaneous_drags < 0:
|
|
107
|
+
raise ValueError(
|
|
108
|
+
f"max_simultaneous_drags must be greater than or equal to 0, "
|
|
109
|
+
f"got {self.max_simultaneous_drags}"
|
|
110
|
+
)
|
flet/controls/core/icon.py
CHANGED
|
@@ -17,9 +17,9 @@ class Icon(LayoutControl):
|
|
|
17
17
|
parameters such as stroke weight, fill level, and shadows.
|
|
18
18
|
|
|
19
19
|
Raises:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
ValueError: If [`fill`][(c).] is less than `0.0` or greater than `1.0`.
|
|
21
|
+
ValueError: If [`weight`][(c).] is less than or equal to `0.0`.
|
|
22
|
+
ValueError: If [`optical_size`][(c).] is less than or equal to `0.0`.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
icon: IconData
|
|
@@ -110,12 +110,16 @@ class Icon(LayoutControl):
|
|
|
110
110
|
|
|
111
111
|
def before_update(self):
|
|
112
112
|
super().before_update()
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
if self.fill is not None and not (0.0 <= self.fill <= 1.0):
|
|
114
|
+
raise ValueError(
|
|
115
|
+
f"fill must be between 0.0 and 1.0 inclusive, got {self.fill}"
|
|
116
|
+
)
|
|
117
|
+
if self.weight is not None and self.weight <= 0.0:
|
|
118
|
+
raise ValueError(
|
|
119
|
+
f"weight must be strictly greater than 0.0, got {self.weight}"
|
|
120
|
+
)
|
|
121
|
+
if self.optical_size is not None and self.optical_size <= 0.0:
|
|
122
|
+
raise ValueError(
|
|
123
|
+
f"optical_size must be strictly greater than 0.0, "
|
|
124
|
+
f"got {self.optical_size}"
|
|
125
|
+
)
|
|
@@ -23,11 +23,11 @@ class InteractiveViewer(LayoutControl):
|
|
|
23
23
|
Allows you to pan, zoom, and rotate its [`content`][(c).].
|
|
24
24
|
|
|
25
25
|
Raises:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
27
|
+
ValueError: If [`min_scale`][(c).] is not greater than `0`.
|
|
28
|
+
ValueError: If [`max_scale`][(c).] is not greater than `0`.
|
|
29
|
+
ValueError: If [`max_scale`][(c).] is less than `min_scale`.
|
|
30
|
+
ValueError: If [`interaction_end_friction_coefficient`][(c).] is not
|
|
31
31
|
greater than `0`.
|
|
32
32
|
"""
|
|
33
33
|
|
|
@@ -130,24 +130,25 @@ class InteractiveViewer(LayoutControl):
|
|
|
130
130
|
|
|
131
131
|
def before_update(self):
|
|
132
132
|
super().before_update()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
f"max_scale must be greater than 0, got {self.max_scale}"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
self.interaction_end_friction_coefficient is None
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
133
|
+
if not self.content.visible:
|
|
134
|
+
raise ValueError("content must be visible")
|
|
135
|
+
if self.min_scale <= 0:
|
|
136
|
+
raise ValueError(f"min_scale must be greater than 0, got {self.min_scale}")
|
|
137
|
+
if self.max_scale <= 0:
|
|
138
|
+
raise ValueError(f"max_scale must be greater than 0, got {self.max_scale}")
|
|
139
|
+
if self.max_scale < self.min_scale:
|
|
140
|
+
raise ValueError(
|
|
141
|
+
"max_scale must be greater than or equal to min_scale, "
|
|
142
|
+
f"got max_scale={self.max_scale}, min_scale={self.min_scale}"
|
|
143
|
+
)
|
|
144
|
+
if (
|
|
145
|
+
self.interaction_end_friction_coefficient is not None
|
|
146
|
+
and self.interaction_end_friction_coefficient <= 0
|
|
147
|
+
):
|
|
148
|
+
raise ValueError(
|
|
149
|
+
"interaction_end_friction_coefficient must be greater than 0, "
|
|
150
|
+
f"got {self.interaction_end_friction_coefficient}"
|
|
151
|
+
)
|
|
151
152
|
|
|
152
153
|
async def reset(self, animation_duration: Optional[DurationValue] = None):
|
|
153
154
|
await self._invoke_method(
|
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/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")
|
|
@@ -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")
|