flet 0.70.0.dev6491__py3-none-any.whl → 0.70.0.dev6519__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 CHANGED
@@ -311,7 +311,6 @@ from flet.controls.material.navigation_bar import (
311
311
  from flet.controls.material.navigation_drawer import (
312
312
  NavigationDrawer,
313
313
  NavigationDrawerDestination,
314
- NavigationDrawerPosition,
315
314
  )
316
315
  from flet.controls.material.navigation_rail import (
317
316
  NavigationRail,
@@ -778,7 +777,6 @@ __all__ = [
778
777
  "NavigationBarTheme",
779
778
  "NavigationDrawer",
780
779
  "NavigationDrawerDestination",
781
- "NavigationDrawerPosition",
782
780
  "NavigationDrawerTheme",
783
781
  "NavigationRail",
784
782
  "NavigationRailDestination",
@@ -86,6 +86,16 @@ class Animation:
86
86
 
87
87
  @dataclass
88
88
  class AnimationStyle:
89
+ """
90
+ Used to override the default parameters of an animation.
91
+
92
+ Note:
93
+ If [`duration`][(c).] and [`reverse_duration`][(c).] are set to
94
+ [`Duration()`][flet.Duration], the corresponding animation will be disabled.
95
+ See [`no_animation()`][(c).no_animation] method for a convenient way to create
96
+ such an instance.
97
+ """
98
+
89
99
  duration: Optional[DurationValue] = None
90
100
  """
91
101
  The duration of the animation.
@@ -106,6 +116,16 @@ class AnimationStyle:
106
116
  The curve to use for the reverse animation.
107
117
  """
108
118
 
119
+ @staticmethod
120
+ def no_animation() -> "AnimationStyle":
121
+ """
122
+ Creates an instance of `AnimationStyle` with no animation.
123
+ """
124
+ return AnimationStyle(
125
+ duration=Duration(),
126
+ reverse_duration=Duration(),
127
+ )
128
+
109
129
  def copy(
110
130
  self,
111
131
  *,
@@ -116,6 +116,7 @@ class BaseControl:
116
116
  """
117
117
  Arbitrary data of any type.
118
118
  """
119
+
119
120
  key: Optional[KeyValue] = None
120
121
 
121
122
  ref: InitVar[Optional[Ref["BaseControl"]]] = None
@@ -124,6 +125,9 @@ class BaseControl:
124
125
  _internals: dict = field(
125
126
  default_factory=dict, init=False, repr=False, compare=False
126
127
  )
128
+ """
129
+ A dictionary for storing internal control configuration.
130
+ """
127
131
 
128
132
  def __post_init__(self, ref: Optional[Ref[Any]]):
129
133
  self.__class__.__hash__ = BaseControl.__hash__
@@ -372,6 +372,36 @@ class BasePage(AdaptiveControl):
372
372
  dialog.update()
373
373
  return dialog
374
374
 
375
+ async def show_drawer(self):
376
+ """
377
+ Show the drawer.
378
+
379
+ Raises:
380
+ ValueError: If no [`drawer`][(c).] is defined.
381
+ """
382
+ await self.__default_view().show_drawer()
383
+
384
+ async def close_drawer(self):
385
+ """
386
+ Close the drawer.
387
+ """
388
+ await self.__default_view().close_drawer()
389
+
390
+ async def show_end_drawer(self):
391
+ """
392
+ Show the end drawer.
393
+
394
+ Raises:
395
+ ValueError: If no [`end_drawer`][(c).] is defined.
396
+ """
397
+ await self.__default_view().show_end_drawer()
398
+
399
+ async def close_end_drawer(self):
400
+ """
401
+ Close the end drawer.
402
+ """
403
+ await self.__default_view().close_end_drawer()
404
+
375
405
  async def take_screenshot(
376
406
  self,
377
407
  pixel_ratio: Optional[Number] = None,
@@ -29,7 +29,7 @@ class Image(LayoutControl):
29
29
 
30
30
  ```python
31
31
  ft.Image(
32
- src_base64="iVBORw0KGgoAAAANSUhEUgAAABkAAAAgCAYAAADnnNMGAAAACXBIWXMAAAORAAADkQFnq8zdAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAA6dJREFUSImllltoHFUYx3/fzOzm0lt23ZrQ1AQbtBehNpvQohgkBYVo410RwQctNE3Sh0IfiiBoIAjqi6TYrKnFy4O3oiiRavDJFi3mXomIBmOxNZe63ay52GR3Zj4f2sTEzmx3m//TYf7/c35zvgPnO6KqrESXqpq3muocAikv6m+/zytj3ejik1VN21G31YA9CgJ6xC+bMyQZPVCuarciPAMYC99V6Vw5pLbFSibHmlVoRVj9P3cmPBM8tSJI/M6mzabpfoAQ9fIF7WK4bd5vvuFnLGgy2vi0abg94A0AcJGvMq3hDxGRyar9r4F+iLAm0yIiRk8m37tctS1WsrIhhrI30+Srmg+J87OXUf3lWGS1q89dC6ltsSanxk4Aj2QBABii96300g87P/rtlrWr8l+vyDMfdlXSyyEikqxsiOUAQJCBhfHdXRfCq1LSsSlcWG+KBAGStvvrMkgiuv8lUc2mREukPwLUfHG+uTQv8Eown7VL3XlbBxYhf1c17hbVF3MDwA9bts280TnaU1YYqPby07aeFlUlHt27wSQ4CLo+F8AvoTCvHmyKF+ZbEb/M77P2LgvAwmrTHAHflN3KZxVbMC2jMFNOpgPnrMSOhvvFkMezXdwV4ePbtvHtxnJAMQ0j4JtVnO+eLb5oiSlt5HDbv7t1O90lpYCCCKbhfzW5kAIwUAazR0BlfII8Ow0I6uoVmI9MyAMwbMs8CExmDbk4zgu931MyO4OI4KrYflkRjOoTI+uM9d1vjotwKPu9QMk/sxzuO8POiVFcdZ1M2YBVsMEAKOqLvaPIe7mACuw0z/80SMH58SMplxlfiDhVi7dw2pltRhjKBQTQdrSja2KKTfE551NHuaZ0QVPvWYQUn31/Vm2nDvgjF4grVJx6suSvrvrSJ/6cSW2Oz9mf264uNrB806xZ1k/CZ49dUKgDEtlCROX2hfHpx8pGuuo3PpqYulw8fjndOp1yhgtNKRevJ1FyR2Ola+jXAjdnwTkZ6o896GdWdxDw7IxFg+0DpmXchTKSBWQnIuJn9u4j7dt+13UfHXEkXQOcuQ4kMhVtqsgUyPiQiPQfHw1NB2sRjmXKuTg1NwwBYLhtPtQX26eqTwGXPDOqvmcC4Hnwfrrad94GrVsOYTqUTkQY+iTlNe/6O1miSP/x0VB/+wMIDwHn/vtV1iQC4Xv95uUEWVCoL9Y5Z+gdovoyMHUFJHv88jmVy0vTuw7cZNv2YaA61Bfb7ZX5F8SaUv2xwZevAAAAAElFTkSuQmCC",
32
+ src="https://flet.dev/img/logo.svg",
33
33
  width=100,
34
34
  height=100,
35
35
  )
@@ -107,27 +107,36 @@ class Pagelet(LayoutControl, AdaptiveControl):
107
107
  if not self.content.visible:
108
108
  raise ValueError("content must be visible")
109
109
 
110
- # todo: deprecate show_* in favor of a open/close methods, or page.open/close
111
- # Drawer
112
- #
113
- def show_drawer(self, drawer: NavigationDrawer):
114
- self.drawer = drawer
115
- self.drawer.open = True
116
- self.update()
117
-
118
- def close_drawer(self):
119
- if self.drawer is not None:
120
- self.drawer.open = False
121
- self.update()
122
-
123
- # End_drawer
124
- #
125
- def show_end_drawer(self, end_drawer: NavigationDrawer):
126
- self.end_drawer = end_drawer
127
- self.end_drawer.open = True
128
- self.update()
129
-
130
- def close_end_drawer(self):
131
- if self.end_drawer is not None:
132
- self.end_drawer.open = False
133
- self.update()
110
+ async def show_drawer(self):
111
+ """
112
+ Show the drawer.
113
+
114
+ Raises:
115
+ ValueError: If no [`drawer`][(c).] is defined.
116
+ """
117
+ if self.drawer is None:
118
+ raise ValueError("No drawer defined")
119
+ await self._invoke_method("show_drawer")
120
+
121
+ async def close_drawer(self):
122
+ """
123
+ Close the drawer.
124
+ """
125
+ await self._invoke_method("close_drawer")
126
+
127
+ async def show_end_drawer(self):
128
+ """
129
+ Show the end drawer.
130
+
131
+ Raises:
132
+ ValueError: If no [`end_drawer`][(c).] is defined.
133
+ """
134
+ if self.end_drawer is None:
135
+ raise ValueError("No end_drawer defined")
136
+ await self._invoke_method("show_end_drawer")
137
+
138
+ async def close_end_drawer(self):
139
+ """
140
+ Close the end drawer.
141
+ """
142
+ await self._invoke_method("close_end_drawer")
@@ -17,6 +17,22 @@ class ShaderMask(LayoutControl):
17
17
 
18
18
  For example, it can be used to gradually fade out the edge of a control by
19
19
  using a [`LinearGradient`][flet.] mask.
20
+
21
+ ```python
22
+ ft.ShaderMask(
23
+ blend_mode=ft.BlendMode.MULTIPLY,
24
+ shader=ft.LinearGradient(
25
+ begin=ft.Alignment.CENTER_LEFT,
26
+ end=ft.Alignment.CENTER_RIGHT,
27
+ colors=[ft.Colors.WHITE, ft.Colors.BLACK],
28
+ tile_mode=ft.GradientTileMode.CLAMP,
29
+ ),
30
+ content=ft.Image(
31
+ src="https://picsum.photos/id/288/300/300",
32
+ height=300,
33
+ fit=ft.BoxFit.FILL,
34
+ )
35
+ ```
20
36
  """
21
37
 
22
38
  shader: Gradient
@@ -158,9 +158,6 @@ class View(ScrollableControl, LayoutControl):
158
158
  can_pop: bool = True
159
159
  on_confirm_pop: Optional[ControlEventHandler["View"]] = None
160
160
 
161
- async def confirm_pop(self, should_pop: bool) -> None:
162
- await self._invoke_method("confirm_pop", {"should_pop": should_pop})
163
-
164
161
  def init(self):
165
162
  super().init()
166
163
  self._internals["host_expanded"] = True
@@ -168,3 +165,40 @@ class View(ScrollableControl, LayoutControl):
168
165
  # Magic methods
169
166
  def __contains__(self, item: Control) -> bool:
170
167
  return item in self.controls
168
+
169
+ async def confirm_pop(self, should_pop: bool) -> None:
170
+ await self._invoke_method("confirm_pop", {"should_pop": should_pop})
171
+
172
+ async def show_drawer(self):
173
+ """
174
+ Show the drawer.
175
+
176
+ Raises:
177
+ ValueError: If no [`drawer`][(c).] is defined.
178
+ """
179
+ if self.drawer is None:
180
+ raise ValueError("No drawer defined")
181
+ await self._invoke_method("show_drawer")
182
+
183
+ async def close_drawer(self):
184
+ """
185
+ Close the drawer.
186
+ """
187
+ await self._invoke_method("close_drawer")
188
+
189
+ async def show_end_drawer(self):
190
+ """
191
+ Show the end drawer.
192
+
193
+ Raises:
194
+ ValueError: If no [`end_drawer`][(c).] is defined.
195
+ """
196
+ if self.end_drawer is None:
197
+ raise ValueError("No end_drawer defined")
198
+ await self._invoke_method("show_end_drawer")
199
+
200
+ async def close_end_drawer(self):
201
+ """
202
+ Close the end drawer.
203
+ """
204
+ await self._invoke_method("close_end_drawer")
@@ -21,12 +21,12 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
21
21
 
22
22
  ```python
23
23
  ft.CupertinoSlidingSegmentedButton(
24
+ selected_index=1,
24
25
  controls=[
25
26
  ft.Text("One"),
26
27
  ft.Text("Two"),
27
28
  ft.Text("Three"),
28
29
  ],
29
- selected_index=1,
30
30
  )
31
31
  ```
32
32
  """
@@ -39,8 +39,7 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
39
39
  Must contain at least two visible Controls.
40
40
 
41
41
  Raises:
42
- ValueError: If [`controls`][(c).] does not contain at least two
43
- visible controls.
42
+ ValueError: If it does not contain at least two visible controls.
44
43
  """
45
44
 
46
45
  selected_index: int = 0
@@ -48,8 +47,7 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
48
47
  The index (starting from 0) of the selected segment in the [`controls`][(c).] list.
49
48
 
50
49
  Raises:
51
- IndexError: If [`selected_index`][(c).] is out of range relative to the
52
- visible controls.
50
+ IndexError: If it is out of range relative to the visible controls.
53
51
  """
54
52
 
55
53
  bgcolor: ColorValue = CupertinoColors.TERTIARY_SYSTEM_FILL
@@ -220,7 +220,7 @@ class Dropdown(LayoutControl):
220
220
  Called when the selected item of this dropdown has changed.
221
221
  """
222
222
 
223
- on_change: Optional[ControlEventHandler["Dropdown"]] = None
223
+ on_text_change: Optional[ControlEventHandler["Dropdown"]] = None
224
224
  """
225
225
  Called when the text input of this dropdown has changed.
226
226
  """
@@ -149,8 +149,8 @@ class ExpansionPanelList(LayoutControl):
149
149
  """
150
150
  Called when an item of [`controls`][(c).] is expanded or collapsed.
151
151
 
152
- The event's [`data`][flet.Event.], contains the index of the
153
- child panel (in [`controls`][(c).]) which triggered this event.
152
+ The [`data`][flet.Event.] property of the event handler argument contains the
153
+ index of the child panel (in [`controls`][(c).]) which triggered this event.
154
154
  """
155
155
 
156
156
  def before_update(self):
@@ -3,6 +3,7 @@ from typing import Optional
3
3
 
4
4
  from flet.controls.adaptive_control import AdaptiveControl
5
5
  from flet.controls.alignment import Alignment
6
+ from flet.controls.animation import AnimationStyle
6
7
  from flet.controls.base_control import control
7
8
  from flet.controls.buttons import OutlinedBorder
8
9
  from flet.controls.control import Control
@@ -23,9 +24,29 @@ __all__ = ["ExpansionTile", "TileAffinity"]
23
24
 
24
25
 
25
26
  class TileAffinity(Enum):
27
+ """
28
+ Where to place a control in controls that use [`ListTile`][flet.] to position a
29
+ control next to a label.
30
+ """
31
+
26
32
  LEADING = "leading"
33
+ """
34
+ Positions the control on the leading edge, and the secondary control, if
35
+ any, on the trailing edge.
36
+ """
37
+
27
38
  TRAILING = "trailing"
39
+ """
40
+ Positions the control on the trailing edge, and the secondary control, if
41
+ any, on the leading edge.
42
+ """
43
+
28
44
  PLATFORM = "platform"
45
+ """
46
+ Positions the control relative to the text in the fashion that is typical
47
+ for the current platform, and place the secondary control on the opposite
48
+ side.
49
+ """
29
50
 
30
51
 
31
52
  @control("ExpansionTile")
@@ -39,145 +60,212 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
39
60
  width=400,
40
61
  title="Account",
41
62
  subtitle="Manage profile and security",
63
+ expanded=True,
42
64
  controls=[
43
65
  ft.ListTile(title=ft.Text("Profile")),
44
66
  ft.ListTile(title=ft.Text("Security")),
45
67
  ],
46
- initially_expanded=True,
47
68
  )
48
69
  ```
49
70
  """
50
71
 
51
72
  title: StrOrControl
52
73
  """
53
- A `Control` to display as primary content of the tile.
74
+ A Control to display as primary content of this tile.
54
75
 
55
76
  Typically a [`Text`][flet.] control.
56
77
 
57
78
  Raises:
58
- ValueError: If [`title`][(c).] is neither a string nor a visible Control.
79
+ ValueError: If it is neither a string nor a visible Control.
59
80
  """
60
81
 
61
82
  controls: Optional[list[Control]] = None
62
83
  """
63
- The controls to be displayed when the tile expands.
84
+ The controls to be displayed when this tile [expands][(c).expanded].
64
85
 
65
86
  Typically a list of [`ListTile`][flet.] controls.
66
87
  """
67
88
 
68
89
  subtitle: Optional[StrOrControl] = None
69
90
  """
70
- Additional content displayed below the title.
91
+ Additional content displayed below the [`title`][(c).].
71
92
 
72
93
  Typically a [`Text`][flet.] control.
73
94
  """
74
95
 
75
96
  leading: Optional[IconDataOrControl] = None
76
97
  """
77
- A `Control` to display before the title.
98
+ A Control to display before the [`title`][(c).].
99
+
100
+ Typically a [`CircleAvatar`][flet.] control.
101
+
102
+ Depending on the value of [`affinity`][(c).], this control
103
+ may replace the rotating expansion arrow icon.
78
104
  """
79
105
 
80
106
  trailing: Optional[IconDataOrControl] = None
81
107
  """
82
- A `Control` to display after the title.
108
+ A Control to display after the [`title`][(c).].
83
109
 
84
110
  Typically an [`Icon`][flet.] control.
111
+
112
+ Depending on the value of [`affinity`][(c).], this control
113
+ may replace the rotating expansion arrow icon.
85
114
  """
86
115
 
87
116
  controls_padding: Optional[PaddingValue] = None
88
117
  """
89
- Defines the padding around the `controls`.
118
+ Defines the padding around the [`controls`][(c).].
119
+
120
+ If `None`, [`ExpansionTileTheme.controls_padding`][flet.] is used;
121
+ if that is also `None`, then defaults to `Padding.all(0)`.
90
122
  """
91
123
 
92
124
  tile_padding: Optional[PaddingValue] = None
93
125
  """
94
- Defines the tile's padding. Default value is `Padding.symmetric(horizontal=16.0)`.
126
+ Defines the tile's padding.
127
+
128
+ Analogous to [`ListTile.content_padding`][flet.], this property defines the
129
+ insets for the [`leading`][(c).], [`title`][(c).], [`subtitle`][(c).] and
130
+ [`trailing`][(c).] controls. It does not inset the expanded
131
+ [`controls`][(c).] widgets.
132
+
133
+ If `None`, [`ExpansionTileTheme.tile_padding`][flet.] is used;
134
+ if that is also `None`, then defaults to `Padding.symmetric(horizontal=16.0)`.
95
135
  """
96
136
 
97
137
  affinity: Optional[TileAffinity] = None
98
138
  """
99
- Typically used to force the expansion arrow icon to the tile's `leading` or
100
- `trailing` edge.
139
+ Typically used to force the expansion arrow icon to the tile's [`leading`][(c).] or
140
+ [`trailing`][(c).] edge.
101
141
 
102
- Defaults to `TileAffinity.PLATFORM`.
142
+ If `None`, [`ListTileTheme.affinity`][flet.] is used;
143
+ if that is also `None`, then defaults to [`TileAffinity.TRAILING`][flet.]
144
+ (the expansion arrow icon appears on the tile's trailing edge).
103
145
  """
104
146
 
105
147
  expanded_alignment: Optional[Alignment] = None
106
148
  """
107
- Defines the alignment of children, which are arranged in a column when the tile is
108
- expanded.
149
+ Defines the alignment of [`controls`][(c).], which are arranged in a column when
150
+ the tile is expanded.
151
+
152
+ If `None`, [`ExpansionTileTheme.expanded_alignment`][flet.] is used;
153
+ if that is also `None`, then defaults to [`Alignment.CENTER`][flet.].
109
154
  """
110
155
 
111
156
  expanded_cross_axis_alignment: CrossAxisAlignment = CrossAxisAlignment.CENTER
112
157
  """
113
- Defines the alignment of each child control within `controls` when the tile is
114
- expanded.
158
+ Defines the alignment of each child control within [`controls`][(c).] when the
159
+ tile is expanded.
160
+
161
+ Raises:
162
+ ValueError: If set to [`CrossAxisAlignment.BASELINE`][flet.].
115
163
  """
116
164
 
117
165
  clip_behavior: Optional[ClipBehavior] = None
118
166
  """
119
- The content will be clipped (or not) according to this option.
167
+ Defines how the content of this tile is clipped.
120
168
 
121
- Defaults to `ClipBehavior.NONE`.
122
- """
169
+ If set and a custom collapsed or expanded shape is provided,
170
+ this value determines how this tile is clipped.
123
171
 
124
- initially_expanded: bool = False
125
- """
126
- A boolean value which defines whether the tile is initially expanded or collapsed.
172
+ If `None`, [`ExpansionTileTheme.clip_behavior`][flet.] is used;
173
+ if that is also `None`, then defaults to [`ClipBehavior.ANTI_ALIAS`][flet.].
127
174
  """
128
175
 
129
176
  maintain_state: bool = False
130
177
  """
131
- A boolean value which defines whether the state of the `controls` is maintained
132
- when the tile expands and collapses.
178
+ A boolean value which defines whether the state of the [`controls`][(c).] is
179
+ maintained when this tile [expands][(c).expanded] and collapses.
180
+
181
+ When `True`, the children are kept in the tree while the tile is collapsed.
182
+ When `False` (default), the [`controls`][(c).] are removed from the tree when
183
+ the tile is collapsed and recreated upon expansion.
133
184
  """
134
185
 
135
186
  text_color: Optional[ColorValue] = None
136
187
  """
137
- The color of the tile's titles when the sublist is expanded.
188
+ The color of this tile's titles when the sublist is [`expanded`][(c).].
189
+
190
+ If `None`, [`ExpansionTileTheme.text_color`][flet.] is used;
191
+ if that is also `None`, then defaults to [`body_large`][flet.TextTheme.]
192
+ of the [`Theme.text_theme`][flet.].
138
193
  """
139
194
 
140
195
  icon_color: Optional[ColorValue] = None
141
196
  """
142
- The icon color of tile's expansion arrow icon when the sublist is expanded.
197
+ The icon color of this tile's expansion arrow icon
198
+ when the sublist is [`expanded`][(c).].
199
+
200
+ If `None`, [`ExpansionTileTheme.icon_color`][flet.] is used;
201
+ if that is also `None`, then defaults to [`ColorScheme.primary`][flet.]
202
+ of the [`Page.theme`][flet.].
143
203
  """
144
204
 
145
205
  shape: Optional[OutlinedBorder] = None
146
206
  """
147
- The tile's border shape when the sublist is expanded.
207
+ The border shape of this tile when the sublist is [`expanded`][(c).].
208
+
209
+ If `None`, [`ExpansionTileTheme.shape`][flet.] is used;
210
+ if that is also `None`, then defaults to a [`Border`][flet.] with vertical sides
211
+ of color [`Theme.divider_color`][flet.].
148
212
  """
149
213
 
150
214
  bgcolor: Optional[ColorValue] = None
151
215
  """
152
- The color to display behind the sublist when expanded.
216
+ The color to display behind the sublist when [`expanded`][(c).].
217
+
218
+ If `None`, [`ExpansionTileTheme.bgcolor`][flet.] is used;
219
+ if that is also `None`, then defaults to [`Colors.TRANSPARENT`][flet.].
153
220
  """
154
221
 
155
222
  collapsed_bgcolor: Optional[ColorValue] = None
156
223
  """
157
- Defines the background color of tile when the sublist is collapsed.
224
+ Defines the background color of this tile when the sublist
225
+ is collapsed ([`expanded`][(c).] is False).
226
+
227
+ If `None`, [`ExpansionTileTheme.collapsed_bgcolor`][flet.] is used;
228
+ if that is also `None`, then defaults to [`Colors.TRANSPARENT`][flet.].
158
229
  """
159
230
 
160
231
  collapsed_icon_color: Optional[ColorValue] = None
161
232
  """
162
- The icon color of tile's expansion arrow icon when the sublist is collapsed.
233
+ The icon color of this tile's expansion arrow icon when the sublist
234
+ is collapsed ([`expanded`][(c).] is False).
235
+
236
+ If `None`, [`ExpansionTileTheme.collapsed_icon_color`][flet.] is used;
237
+ if that is also `None`, then defaults to [`ColorScheme.on_surface`][flet.]
238
+ of the [`Page.theme`][flet.].
163
239
  """
164
240
 
165
241
  collapsed_text_color: Optional[ColorValue] = None
166
242
  """
167
- The color of the tile's titles when the sublist is collapsed.
243
+ The color of this tile's titles when the sublist
244
+ is collapsed ([`expanded`][(c).] is False).
245
+
246
+ If `None`, [`ExpansionTileTheme.collapsed_text_color`][flet.] is used;
247
+ if that is also `None`, then defaults to [`body_large`][flet.TextTheme.]
248
+ of the [`Theme.text_theme`][flet.].
168
249
  """
169
250
 
170
251
  collapsed_shape: Optional[OutlinedBorder] = None
171
252
  """
172
253
  The tile's border shape when the sublist is collapsed.
254
+
255
+ If `None`, [`ExpansionTileTheme.shape`][flet.] is used;
256
+ if that is also `None`, then defaults to a [`Border`][flet.] with vertical sides
257
+ of color [`Colors.TRANSPARENT`][flet.].
173
258
  """
174
259
 
175
260
  dense: Optional[bool] = None
176
261
  """
177
- Whether this list tile is part of a vertically dense list. Dense list tiles default
178
- to a smaller height.
262
+ Whether this list tile is part of a vertically dense list.
263
+
264
+ Dense tiles default to having a smaller height.
179
265
 
180
266
  It is not recommended to set this property to `True` when in Material3.
267
+
268
+ If `None`, then its value is based on [`ListTileTheme.dense`][flet.].
181
269
  """
182
270
 
183
271
  enable_feedback: bool = True
@@ -189,26 +277,75 @@ class ExpansionTile(LayoutControl, AdaptiveControl):
189
277
 
190
278
  show_trailing_icon: bool = True
191
279
  """
192
- Whether to show the trailing icon (be it the default icon or the custom `trailing`,
193
- if specified and visible).
280
+ Whether this tile should build/show a default trailing icon, if
281
+ [`trailing`][(c).] is `None`.
194
282
  """
195
283
 
196
284
  min_tile_height: Optional[Number] = None
197
285
  """
198
- The minimum height of the tile.
286
+ The minimum height of this tile.
287
+
288
+ If `None`, the default tile heights are `56.0`, `72.0`, and `88.0` for one, two,
289
+ and three lines of text respectively. If [`dense`][(c).] is `True`, these defaults
290
+ are changed to `48.0`, `64.0`, and `76.0`. A visual density value or a large title
291
+ will also adjust the default tile heights.
292
+ """
293
+
294
+ expanded: bool = False
295
+ """
296
+ The expansion state of this tile.
297
+
298
+ `True` - expanded, `False` - collapsed.
199
299
  """
200
300
 
201
301
  visual_density: Optional[VisualDensity] = None
202
302
  """
203
- Defines how compact the control's layout will be.
303
+ Defines how compact this tile's layout will be.
304
+ """
305
+
306
+ animation_style: Optional[AnimationStyle] = None
307
+ """
308
+ Defines the animation style (curve and duration) for this tile's expansion and
309
+ collapse.
310
+
311
+ If [`AnimationStyle.duration`][flet.] is provided, it will be used to override
312
+ the expansion animation duration. If it is `None`, then
313
+ [`AnimationStyle.duration`][flet.] from the
314
+ [`ExpansionTileTheme.animation_style`][(c).] will be used. If that is also
315
+ `None`, `Duration(milliseconds=200)` will be used as default.
316
+
317
+ If [`AnimationStyle.curve`][flet.] is provided, it will be used to override
318
+ the expansion animation curve. If it is `None`, then
319
+ [`AnimationStyle.curve`][flet.] from the
320
+ [`ExpansionTileTheme.animation_style`][(c).] will be used. If that is also
321
+ `None`, [`Curves.EASE_IN`][flet.] will be used as default.
322
+
323
+ If [`AnimationStyle.reverse_curve`][flet.] is provided, it will be used to override
324
+ the collapse animation curve. If it is `None`, then
325
+ [`AnimationStyle.reverse_curve`][flet.] from the
326
+ [`ExpansionTileTheme.animation_style`][(c).] will be used. If that is also
327
+ `None`, the expansion curve will be used as default.
328
+
329
+ Tip:
330
+ To disable the animations, use
331
+ [`AnimationStyle.no_animation()`][flet.AnimationStyle.no_animation].
204
332
  """
205
333
 
206
334
  on_change: Optional[ControlEventHandler["ExpansionTile"]] = None
207
335
  """
208
336
  Called when a user clicks or taps the list tile.
337
+
338
+ The [`data`][flet.Event.] property of the event handler argument is a boolean
339
+ representing the [`expanded`][(c).] state of the tile after the change.
209
340
  """
210
341
 
211
342
  def before_update(self):
212
343
  super().before_update()
213
344
  if isinstance(self.title, Control) and not self.title.visible:
214
345
  raise ValueError("title must be visible")
346
+ if self.expanded_cross_axis_alignment == CrossAxisAlignment.BASELINE:
347
+ raise ValueError(
348
+ "expanded_cross_axis_alignment cannot be CrossAxisAlignment.BASELINE "
349
+ "since the expanded controls are aligned in a column, not a row. "
350
+ "Try aligning the controls differently."
351
+ )