flet 0.70.0.dev5771__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/testing/finder.py +2 -0
- flet/testing/flet_test_app.py +2 -0
- flet/version.py +1 -1
- {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/METADATA +5 -5
- {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/RECORD +65 -65
- {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/WHEEL +0 -0
- {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/entry_points.txt +0 -0
- {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/top_level.txt +0 -0
|
@@ -36,7 +36,7 @@ class DataColumn(Control):
|
|
|
36
36
|
Column configuration for a [`DataTable`][flet.].
|
|
37
37
|
|
|
38
38
|
Raises:
|
|
39
|
-
|
|
39
|
+
ValueError: If the [`label`][(c).] is neither a string nor
|
|
40
40
|
a visible control.
|
|
41
41
|
"""
|
|
42
42
|
|
|
@@ -82,9 +82,11 @@ class DataColumn(Control):
|
|
|
82
82
|
|
|
83
83
|
def before_update(self):
|
|
84
84
|
super().before_update()
|
|
85
|
-
|
|
86
|
-
isinstance(self.label,
|
|
87
|
-
|
|
85
|
+
if not (
|
|
86
|
+
isinstance(self.label, str)
|
|
87
|
+
or (isinstance(self.label, Control) and self.label.visible)
|
|
88
|
+
):
|
|
89
|
+
raise ValueError("label must a string or a visible control")
|
|
88
90
|
|
|
89
91
|
|
|
90
92
|
@control("DataCell")
|
|
@@ -93,7 +95,7 @@ class DataCell(Control):
|
|
|
93
95
|
The data for a cell of a [`DataTable`][flet.].
|
|
94
96
|
|
|
95
97
|
Raises:
|
|
96
|
-
|
|
98
|
+
ValueError: If the [`content`][(c).] is neither a string nor a visible
|
|
97
99
|
control.
|
|
98
100
|
"""
|
|
99
101
|
|
|
@@ -185,8 +187,8 @@ class DataCell(Control):
|
|
|
185
187
|
|
|
186
188
|
def before_update(self):
|
|
187
189
|
super().before_update()
|
|
188
|
-
if isinstance(self.content, Control):
|
|
189
|
-
|
|
190
|
+
if isinstance(self.content, Control) and not self.content.visible:
|
|
191
|
+
raise ValueError("content must be visible")
|
|
190
192
|
|
|
191
193
|
|
|
192
194
|
@control("DataRow")
|
|
@@ -197,6 +199,9 @@ class DataRow(Control):
|
|
|
197
199
|
One row configuration must be provided for each row to display in the table.
|
|
198
200
|
|
|
199
201
|
The data for this row of the table is provided in the [`cells`][(c).] property.
|
|
202
|
+
|
|
203
|
+
Raises:
|
|
204
|
+
ValueError: If [`cells`][(c).] does not contain at least one visible DataCell.
|
|
200
205
|
"""
|
|
201
206
|
|
|
202
207
|
cells: list[DataCell] = field(default_factory=list)
|
|
@@ -267,9 +272,8 @@ class DataRow(Control):
|
|
|
267
272
|
|
|
268
273
|
def before_update(self):
|
|
269
274
|
super().before_update()
|
|
270
|
-
|
|
271
|
-
"cells must contain at minimum one visible DataCell"
|
|
272
|
-
)
|
|
275
|
+
if not any(cell.visible for cell in self.cells):
|
|
276
|
+
raise ValueError("cells must contain at minimum one visible DataCell")
|
|
273
277
|
|
|
274
278
|
|
|
275
279
|
@control("DataTable")
|
|
@@ -278,13 +282,13 @@ class DataTable(LayoutControl):
|
|
|
278
282
|
A Material Design data table.
|
|
279
283
|
|
|
280
284
|
Raises:
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
ValueError: If there are no visible [`columns`][(c).].
|
|
286
|
+
ValueError: If any visible row does not contain exactly as many visible
|
|
283
287
|
[`DataRow.cells`][flet.] as there are visible [`columns`][(c).].
|
|
284
|
-
|
|
288
|
+
ValueError: If [`data_row_min_height`][(c).] is greater than
|
|
285
289
|
[`data_row_max_height`][(c).].
|
|
286
|
-
|
|
287
|
-
|
|
290
|
+
ValueError: If [`divider_thickness`][(c).] is negative.
|
|
291
|
+
ValueError: If [`sort_column_index`][(c).] is out of range.
|
|
288
292
|
"""
|
|
289
293
|
|
|
290
294
|
columns: list[DataColumn]
|
|
@@ -488,34 +492,37 @@ class DataTable(LayoutControl):
|
|
|
488
492
|
list(filter(lambda column: column.visible, self.columns))
|
|
489
493
|
)
|
|
490
494
|
visible_rows = list(filter(lambda row: row.visible, self.rows))
|
|
491
|
-
|
|
492
|
-
"columns must contain at minimum one visible DataColumn"
|
|
493
|
-
|
|
494
|
-
assert all(
|
|
495
|
+
if visible_columns_count == 0:
|
|
496
|
+
raise ValueError("columns must contain at minimum one visible DataColumn")
|
|
497
|
+
if not all(
|
|
495
498
|
[
|
|
496
499
|
len([c for c in row.cells if c.visible]) == visible_columns_count
|
|
497
500
|
for row in visible_rows
|
|
498
501
|
]
|
|
499
|
-
)
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
502
|
+
):
|
|
503
|
+
raise ValueError(
|
|
504
|
+
f"each visible DataRow must contain exactly as many visible DataCells "
|
|
505
|
+
f"as there are visible DataColumns ({visible_columns_count})"
|
|
506
|
+
)
|
|
507
|
+
if (
|
|
508
|
+
self.data_row_min_height is not None
|
|
509
|
+
and self.data_row_max_height is not None
|
|
510
|
+
and self.data_row_min_height > self.data_row_max_height
|
|
511
|
+
):
|
|
512
|
+
raise ValueError(
|
|
513
|
+
f"data_row_min_height ({self.data_row_min_height}) must be less than "
|
|
514
|
+
f"or equal to data_row_max_height ({self.data_row_max_height})"
|
|
515
|
+
)
|
|
516
|
+
if self.divider_thickness is not None and self.divider_thickness < 0:
|
|
517
|
+
raise ValueError(
|
|
518
|
+
f"divider_thickness must be greater than or equal to 0, "
|
|
519
|
+
f"got {self.divider_thickness}"
|
|
520
|
+
)
|
|
521
|
+
if self.sort_column_index is not None and not (
|
|
516
522
|
0 <= self.sort_column_index < visible_columns_count
|
|
517
|
-
)
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
523
|
+
):
|
|
524
|
+
raise ValueError(
|
|
525
|
+
f"sort_column_index ({self.sort_column_index}) must be greater than or "
|
|
526
|
+
f"equal to 0 and less than the "
|
|
527
|
+
f"number of visible columns ({visible_columns_count})"
|
|
528
|
+
)
|
|
@@ -11,6 +11,12 @@ __all__ = ["Divider"]
|
|
|
11
11
|
class Divider(Control):
|
|
12
12
|
"""
|
|
13
13
|
A thin horizontal line (divider), with padding on either side.
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
ValueError: If [`height`][(c).] is negative.
|
|
17
|
+
ValueError: If [`thickness`][(c).] is negative.
|
|
18
|
+
ValueError: If [`leading_indent`][(c).] is negative.
|
|
19
|
+
ValueError: If [`trailing_indent`][(c).] is negative.
|
|
14
20
|
"""
|
|
15
21
|
|
|
16
22
|
color: Optional[ColorValue] = None
|
|
@@ -58,17 +64,21 @@ class Divider(Control):
|
|
|
58
64
|
|
|
59
65
|
def before_update(self):
|
|
60
66
|
super().before_update()
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
if self.height is not None and self.height < 0:
|
|
68
|
+
raise ValueError(
|
|
69
|
+
f"height must be greater than or equal to 0, got {self.height}"
|
|
70
|
+
)
|
|
71
|
+
if self.thickness is not None and self.thickness < 0:
|
|
72
|
+
raise ValueError(
|
|
73
|
+
f"thickness must be greater than or equal to 0, got {self.thickness}"
|
|
74
|
+
)
|
|
75
|
+
if self.leading_indent is not None and self.leading_indent < 0:
|
|
76
|
+
raise ValueError(
|
|
77
|
+
f"leading_indent must be greater than or equal to 0, "
|
|
78
|
+
f"got {self.leading_indent}"
|
|
79
|
+
)
|
|
80
|
+
if self.trailing_indent is not None and self.trailing_indent < 0:
|
|
81
|
+
raise ValueError(
|
|
82
|
+
f"trailing_indent must be greater than or equal to 0, "
|
|
83
|
+
f"got {self.trailing_indent}"
|
|
84
|
+
)
|
|
@@ -30,6 +30,9 @@ class DropdownOption(Control):
|
|
|
30
30
|
"""
|
|
31
31
|
Represents an item in a dropdown. Either `key` or `text` must be specified, else an
|
|
32
32
|
`AssertionError` will be raised.
|
|
33
|
+
|
|
34
|
+
Raises:
|
|
35
|
+
ValueError: If neither [`key`][(c).] nor [`text`][(c).] are provided.
|
|
33
36
|
"""
|
|
34
37
|
|
|
35
38
|
key: Optional[str] = None
|
|
@@ -66,9 +69,8 @@ class DropdownOption(Control):
|
|
|
66
69
|
|
|
67
70
|
def before_update(self):
|
|
68
71
|
super().before_update()
|
|
69
|
-
|
|
70
|
-
"key or text must be specified"
|
|
71
|
-
)
|
|
72
|
+
if self.key is None and self.text is None:
|
|
73
|
+
raise ValueError("key or text must be specified")
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
Option = DropdownOption
|
|
@@ -33,6 +33,9 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
|
|
|
33
33
|
"""
|
|
34
34
|
A single-line ListTile with an expansion arrow icon that expands or collapses the
|
|
35
35
|
tile to reveal or hide its controls.
|
|
36
|
+
|
|
37
|
+
Raises:
|
|
38
|
+
ValueError: If [`title`][(c).] is neither a string nor a visible Control.
|
|
36
39
|
"""
|
|
37
40
|
|
|
38
41
|
title: StrOrControl
|
|
@@ -108,28 +111,22 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
|
|
|
108
111
|
initially_expanded: bool = False
|
|
109
112
|
"""
|
|
110
113
|
A boolean value which defines whether the tile is initially expanded or collapsed.
|
|
111
|
-
|
|
112
|
-
Defaults to `False`.
|
|
113
114
|
"""
|
|
114
115
|
|
|
115
116
|
maintain_state: bool = False
|
|
116
117
|
"""
|
|
117
118
|
A boolean value which defines whether the state of the `controls` is maintained
|
|
118
119
|
when the tile expands and collapses.
|
|
119
|
-
|
|
120
|
-
Defaults to `False`.
|
|
121
120
|
"""
|
|
122
121
|
|
|
123
122
|
text_color: Optional[ColorValue] = None
|
|
124
123
|
"""
|
|
125
|
-
The color of the tile's titles when the
|
|
126
|
-
sublist is expanded.
|
|
124
|
+
The color of the tile's titles when the sublist is expanded.
|
|
127
125
|
"""
|
|
128
126
|
|
|
129
127
|
icon_color: Optional[ColorValue] = None
|
|
130
128
|
"""
|
|
131
|
-
The icon color of tile's expansion arrow
|
|
132
|
-
icon when the sublist is expanded.
|
|
129
|
+
The icon color of tile's expansion arrow icon when the sublist is expanded.
|
|
133
130
|
"""
|
|
134
131
|
|
|
135
132
|
shape: Optional[OutlinedBorder] = None
|
|
@@ -139,26 +136,22 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
|
|
|
139
136
|
|
|
140
137
|
bgcolor: Optional[ColorValue] = None
|
|
141
138
|
"""
|
|
142
|
-
The color to display behind the sublist
|
|
143
|
-
when expanded.
|
|
139
|
+
The color to display behind the sublist when expanded.
|
|
144
140
|
"""
|
|
145
141
|
|
|
146
142
|
collapsed_bgcolor: Optional[ColorValue] = None
|
|
147
143
|
"""
|
|
148
|
-
Defines the background color of tile when
|
|
149
|
-
the sublist is collapsed.
|
|
144
|
+
Defines the background color of tile when the sublist is collapsed.
|
|
150
145
|
"""
|
|
151
146
|
|
|
152
147
|
collapsed_icon_color: Optional[ColorValue] = None
|
|
153
148
|
"""
|
|
154
|
-
The icon color of tile's expansion arrow
|
|
155
|
-
icon when the sublist is collapsed.
|
|
149
|
+
The icon color of tile's expansion arrow icon when the sublist is collapsed.
|
|
156
150
|
"""
|
|
157
151
|
|
|
158
152
|
collapsed_text_color: Optional[ColorValue] = None
|
|
159
153
|
"""
|
|
160
|
-
The color of the tile's titles when the
|
|
161
|
-
sublist is collapsed.
|
|
154
|
+
The color of the tile's titles when the sublist is collapsed.
|
|
162
155
|
"""
|
|
163
156
|
|
|
164
157
|
collapsed_shape: Optional[OutlinedBorder] = None
|
|
@@ -179,16 +172,12 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
|
|
|
179
172
|
Whether detected gestures should provide acoustic and/or haptic feedback. For
|
|
180
173
|
example, on Android a tap will produce a clicking sound and a long-press will
|
|
181
174
|
produce a short vibration, when feedback is enabled.
|
|
182
|
-
|
|
183
|
-
Defaults to `True`.
|
|
184
175
|
"""
|
|
185
176
|
|
|
186
177
|
show_trailing_icon: bool = True
|
|
187
178
|
"""
|
|
188
179
|
Whether to show the trailing icon (be it the default icon or the custom `trailing`,
|
|
189
180
|
if specified and visible).
|
|
190
|
-
|
|
191
|
-
Defaults to `True`.
|
|
192
181
|
"""
|
|
193
182
|
|
|
194
183
|
min_tile_height: Optional[Number] = None
|
|
@@ -208,5 +197,5 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
|
|
|
208
197
|
|
|
209
198
|
def before_update(self):
|
|
210
199
|
super().before_update()
|
|
211
|
-
if isinstance(self.title, Control):
|
|
212
|
-
|
|
200
|
+
if isinstance(self.title, Control) and not self.title.visible:
|
|
201
|
+
raise ValueError("title must be visible")
|
|
@@ -27,9 +27,9 @@ class FloatingActionButton(LayoutControl):
|
|
|
27
27
|
place on a page.
|
|
28
28
|
|
|
29
29
|
Raises:
|
|
30
|
-
|
|
30
|
+
ValueError: If neither [`icon`][(c).] nor a valid [`content`][(c).]
|
|
31
31
|
(string or visible Control) is provided.
|
|
32
|
-
|
|
32
|
+
ValueError: If [`elevation`][(c).],
|
|
33
33
|
[`disabled_elevation`][(c).], [`focus_elevation`][(c).],
|
|
34
34
|
[`highlight_elevation`][(c).], or [`hover_elevation`][(c).]
|
|
35
35
|
is negative.
|
|
@@ -161,27 +161,36 @@ class FloatingActionButton(LayoutControl):
|
|
|
161
161
|
|
|
162
162
|
def before_update(self):
|
|
163
163
|
super().before_update()
|
|
164
|
-
|
|
164
|
+
if not (
|
|
165
165
|
self.icon
|
|
166
166
|
or isinstance(self.content, str)
|
|
167
167
|
or (isinstance(self.content, Control) and self.content.visible)
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
168
|
+
):
|
|
169
|
+
raise ValueError(
|
|
170
|
+
"at minimum, icon or a content (string or visible Control) "
|
|
171
|
+
"must be provided"
|
|
172
|
+
)
|
|
173
|
+
if self.elevation is not None and self.elevation < 0:
|
|
174
|
+
raise ValueError(
|
|
175
|
+
f"elevation must be greater than or equal to 0, got {self.elevation}"
|
|
176
|
+
)
|
|
177
|
+
if self.disabled_elevation is not None and self.disabled_elevation < 0:
|
|
178
|
+
raise ValueError(
|
|
179
|
+
"disabled_elevation must be greater than or equal to 0, "
|
|
180
|
+
f"got {self.disabled_elevation}"
|
|
181
|
+
)
|
|
182
|
+
if self.focus_elevation is not None and self.focus_elevation < 0:
|
|
183
|
+
raise ValueError(
|
|
184
|
+
"focus_elevation must be greater than or equal to 0, "
|
|
185
|
+
f"got {self.focus_elevation}"
|
|
186
|
+
)
|
|
187
|
+
if self.highlight_elevation is not None and self.highlight_elevation < 0:
|
|
188
|
+
raise ValueError(
|
|
189
|
+
"highlight_elevation must be greater than or equal to 0, "
|
|
190
|
+
f"got {self.highlight_elevation}"
|
|
191
|
+
)
|
|
192
|
+
if self.hover_elevation is not None and self.hover_elevation < 0:
|
|
193
|
+
raise ValueError(
|
|
194
|
+
"hover_elevation must be greater than or equal to 0, "
|
|
195
|
+
f"got {self.hover_elevation}"
|
|
196
|
+
)
|
|
@@ -34,6 +34,9 @@ class IconButton(LayoutControl, AdaptiveControl):
|
|
|
34
34
|
|
|
35
35
|
Icon buttons are commonly used in the toolbars, but they can be used in many other
|
|
36
36
|
places as well.
|
|
37
|
+
|
|
38
|
+
Raises:
|
|
39
|
+
ValueError: If [`splash_radius`][(c).] is not greater than `0`.
|
|
37
40
|
"""
|
|
38
41
|
|
|
39
42
|
icon: Optional[IconDataOrControl] = None
|
|
@@ -200,9 +203,10 @@ class IconButton(LayoutControl, AdaptiveControl):
|
|
|
200
203
|
|
|
201
204
|
def before_update(self):
|
|
202
205
|
super().before_update()
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
if self.splash_radius is not None and self.splash_radius <= 0:
|
|
207
|
+
raise ValueError(
|
|
208
|
+
f"splash_radius must be greater than 0, got {self.splash_radius}"
|
|
209
|
+
)
|
|
206
210
|
if (
|
|
207
211
|
self.style is not None
|
|
208
212
|
or self.bgcolor is not None
|
|
@@ -28,7 +28,7 @@ class NavigationRailLabelType(Enum):
|
|
|
28
28
|
@control("NavigationRailDestination")
|
|
29
29
|
class NavigationRailDestination(Control):
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
Represents a destination in a `NavigationRail`.
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
icon: Optional[IconDataOrControl] = None
|
|
@@ -81,6 +81,11 @@ class NavigationRail(LayoutControl):
|
|
|
81
81
|
"""
|
|
82
82
|
A material widget that is meant to be displayed at the left or right of an app to
|
|
83
83
|
navigate between a small number of views, typically between three and five.
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
ValueError: If [`elevation`][(c).] is negative.
|
|
87
|
+
ValueError: If [`min_width`][(c).] is negative.
|
|
88
|
+
ValueError: If [`min_extended_width`][(c).] is negative.
|
|
84
89
|
"""
|
|
85
90
|
|
|
86
91
|
destinations: list[NavigationRailDestination] = field(default_factory=list)
|
|
@@ -130,14 +135,12 @@ class NavigationRail(LayoutControl):
|
|
|
130
135
|
|
|
131
136
|
bgcolor: Optional[ColorValue] = None
|
|
132
137
|
"""
|
|
133
|
-
Sets the color of the Container that holds
|
|
134
|
-
all of the NavigationRail's contents.
|
|
138
|
+
Sets the color of the Container that holds all of the NavigationRail's contents.
|
|
135
139
|
"""
|
|
136
140
|
|
|
137
141
|
indicator_color: Optional[ColorValue] = None
|
|
138
142
|
"""
|
|
139
|
-
The color of the navigation rail's
|
|
140
|
-
indicator.
|
|
143
|
+
The color of the navigation rail's indicator.
|
|
141
144
|
"""
|
|
142
145
|
|
|
143
146
|
indicator_shape: Optional[OutlinedBorder] = None
|
|
@@ -241,9 +244,9 @@ class NavigationRail(LayoutControl):
|
|
|
241
244
|
|
|
242
245
|
def before_update(self):
|
|
243
246
|
super().before_update()
|
|
244
|
-
if self.elevation is not None:
|
|
245
|
-
|
|
246
|
-
if self.min_width is not None:
|
|
247
|
-
|
|
248
|
-
if self.min_extended_width is not None:
|
|
249
|
-
|
|
247
|
+
if self.elevation is not None and self.elevation < 0:
|
|
248
|
+
raise ValueError("elevation cannot be negative")
|
|
249
|
+
if self.min_width is not None and self.min_width < 0:
|
|
250
|
+
raise ValueError("min_width cannot be negative")
|
|
251
|
+
if self.min_extended_width is not None and self.min_extended_width < 0:
|
|
252
|
+
raise ValueError("min_extended_width cannot be negative")
|
|
@@ -21,8 +21,11 @@ __all__ = ["OutlinedButton"]
|
|
|
21
21
|
class OutlinedButton(LayoutControl, AdaptiveControl):
|
|
22
22
|
"""
|
|
23
23
|
Outlined buttons are medium-emphasis buttons. They contain actions that are
|
|
24
|
-
important, but aren
|
|
24
|
+
important, but aren't the primary action in an app. Outlined buttons pair well with
|
|
25
25
|
filled buttons to indicate an alternative, secondary action.
|
|
26
|
+
|
|
27
|
+
Raises:
|
|
28
|
+
ValueError: If neither [`icon`][(c).] nor [`content`][(c).] is provided.
|
|
26
29
|
"""
|
|
27
30
|
|
|
28
31
|
content: Optional[StrOrControl] = None
|
|
@@ -95,11 +98,12 @@ class OutlinedButton(LayoutControl, AdaptiveControl):
|
|
|
95
98
|
|
|
96
99
|
def before_update(self):
|
|
97
100
|
super().before_update()
|
|
98
|
-
|
|
101
|
+
if not (
|
|
99
102
|
self.icon
|
|
100
103
|
or isinstance(self.content, str)
|
|
101
104
|
or (isinstance(self.content, Control) and self.content.visible)
|
|
102
|
-
)
|
|
105
|
+
):
|
|
106
|
+
raise ValueError("at minimum, icon or a visible content must be provided")
|
|
103
107
|
|
|
104
108
|
async def focus(self):
|
|
105
109
|
await self._invoke_method("focus")
|
|
@@ -14,6 +14,11 @@ class ProgressBar(LayoutControl):
|
|
|
14
14
|
A material design linear progress indicator, also known as a progress bar.
|
|
15
15
|
|
|
16
16
|
A control that shows progress along a line.
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
ValueError: If [`value`][(c).] is negative.
|
|
20
|
+
ValueError: If [`bar_height`][(c).] is negative.
|
|
21
|
+
ValueError: If [`semantics_value`][(c).] is negative.
|
|
17
22
|
"""
|
|
18
23
|
|
|
19
24
|
value: Optional[Number] = None
|
|
@@ -114,13 +119,16 @@ class ProgressBar(LayoutControl):
|
|
|
114
119
|
|
|
115
120
|
def before_update(self):
|
|
116
121
|
super().before_update()
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if self.value is not None and self.value < 0:
|
|
123
|
+
raise ValueError(
|
|
124
|
+
f"value must be greater than or equal to 0, got {self.value}"
|
|
125
|
+
)
|
|
126
|
+
if self.bar_height is not None and self.bar_height < 0:
|
|
127
|
+
raise ValueError(
|
|
128
|
+
f"bar_height must be greater than or equal to 0, got {self.bar_height}"
|
|
129
|
+
)
|
|
130
|
+
if self.semantics_value is not None and self.semantics_value < 0:
|
|
131
|
+
raise ValueError(
|
|
132
|
+
f"semantics_value must be greater than or equal to 0, "
|
|
133
|
+
f"got {self.semantics_value}"
|
|
134
|
+
)
|
|
@@ -11,6 +11,9 @@ __all__ = ["RadioGroup"]
|
|
|
11
11
|
class RadioGroup(Control):
|
|
12
12
|
"""
|
|
13
13
|
Radio buttons let people select a single option from two or more choices.
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
ValueError: If [`content`][(c).] is not visible.
|
|
14
17
|
"""
|
|
15
18
|
|
|
16
19
|
content: Control
|
|
@@ -33,4 +36,5 @@ class RadioGroup(Control):
|
|
|
33
36
|
|
|
34
37
|
def before_update(self):
|
|
35
38
|
super().before_update()
|
|
36
|
-
|
|
39
|
+
if not self.content.visible:
|
|
40
|
+
raise ValueError("content must be visible")
|
|
@@ -20,6 +20,11 @@ class RangeSlider(LayoutControl):
|
|
|
20
20
|
A range slider can be used to select from either a continuous or a discrete
|
|
21
21
|
set of values.
|
|
22
22
|
The default is to use a continuous range of values from min to max.
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
ValueError: If [`end_value`][(c).] is greater than [`max`][(c).].
|
|
26
|
+
ValueError: If [`start_value`][(c).] is less than [`min`][(c).].
|
|
27
|
+
ValueError: If [`start_value`][(c).] is greater than [`end_value`][(c).].
|
|
23
28
|
"""
|
|
24
29
|
|
|
25
30
|
start_value: Number
|
|
@@ -124,17 +129,12 @@ class RangeSlider(LayoutControl):
|
|
|
124
129
|
"""
|
|
125
130
|
|
|
126
131
|
def before_update(self):
|
|
127
|
-
if self.max is not None:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
assert self.start_value <= self.end_value, (
|
|
138
|
-
"start_value must be less than or equal to end_value"
|
|
139
|
-
)
|
|
132
|
+
if self.max is not None and self.end_value > self.max:
|
|
133
|
+
raise ValueError("end_value must be less than or equal to max")
|
|
134
|
+
|
|
135
|
+
if self.min is not None and self.start_value < self.min:
|
|
136
|
+
raise ValueError("start_value must be greater than or equal to min")
|
|
137
|
+
|
|
138
|
+
if self.start_value > self.end_value:
|
|
139
|
+
raise ValueError("start_value must be less than or equal to end_value")
|
|
140
140
|
pass
|