Skip to content

Commit 8182720

Browse files
committed
update cupertino controls
1 parent fbe0c1b commit 8182720

21 files changed

Lines changed: 299 additions & 337 deletions

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_action_sheet.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,48 @@
1212
class CupertinoActionSheet(LayoutControl):
1313
"""
1414
An iOS-style action sheet.
15+
16+
Action sheets are generally used to give the user a choice between
17+
two or more choices for the current context.
1518
"""
1619

1720
title: Optional[StrOrControl] = None
1821
"""
1922
A control containing the title of the action sheet.
2023
21-
Typically a [`Text`][flet.Text] control.
24+
Typically a [`Text`][flet.] control.
2225
"""
2326

2427
message: Optional[StrOrControl] = None
2528
"""
2629
A control containing a descriptive message that provides more details about the
2730
reason for the alert.
2831
29-
Typically a [`Text`][flet.Text] control.
32+
Typically a [`Text`][flet.] control.
3033
"""
3134

3235
actions: Optional[list[Control]] = None
3336
"""
3437
A list of action buttons to be shown in the sheet.
3538
36-
These actions are typically
37-
[`CupertinoActionSheetAction`][flet.CupertinoActionSheetAction]s.
38-
39-
This list must have at least one action.
39+
These actions are typically [`CupertinoActionSheetAction`][flet.]s.
4040
"""
4141

4242
cancel: Optional[Control] = None
4343
"""
4444
An optional control to be shown below the actions but grouped separately from them.
4545
46-
Typically a [`CupertinoActionSheetAction`][flet.CupertinoActionSheetAction]
47-
button.
46+
Typically a [`CupertinoActionSheetAction`][flet.] button.
4847
"""
48+
49+
def before_update(self):
50+
super().before_update()
51+
assert (
52+
self.actions is not None
53+
or self.title is not None
54+
or self.message is not None
55+
or self.cancel is not None
56+
), (
57+
"This action sheet must have a non-None value for at least one of the "
58+
"following arguments: `actions`, `title`, `message`, or `cancel`"
59+
)

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_activity_indicator.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,25 @@ class CupertinoActivityIndicator(LayoutControl):
1313
An iOS-style activity indicator that spins clockwise.
1414
1515
Raises:
16-
ValueError: If `radius` is not strictly greater than 0.
16+
ValueError: If [`radius`][(c).] is not strictly greater than `0`.
1717
"""
1818

1919
radius: Number = 10
2020
"""
21-
The radius of the activity indicator.
21+
The radius of this indicator.
2222
2323
Note:
24-
Must be strictly greater than 0.
24+
Must be strictly greater than `0`.
2525
"""
2626

2727
color: Optional[ColorValue] = None
2828
"""
29-
Defines the color of the activity
30-
indicator.
29+
Defines the color of this indicator.
3130
"""
3231

3332
animating: bool = True
3433
"""
35-
Whether the activity indicator is running its animation.
34+
Whether this indicator is running its animation.
3635
"""
3736

3837
def before_update(self):

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_alert_dialog.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,24 @@ class CupertinoAlertDialog(DialogControl):
2828

2929
title: Optional[StrOrControl] = None
3030
"""
31-
The (optional) title of the dialog is displayed in a large font at the top of the
32-
dialog.
31+
The title of this dialog, displayed in a large font at the top of this dialog.
3332
34-
Typically a [`Text`][flet.Text] control.
33+
Typically a [`Text`][flet.] control.
3534
"""
3635

3736
content: Optional[Control] = None
3837
"""
39-
The (optional) content of the dialog is displayed in the center of the dialog in a
40-
lighter font.
38+
The content of this dialog, displayed in a light font at the center of this dialog.
4139
42-
Typically this is a [`Column`][flet.Column] that contains
43-
the dialog's [`Text`][flet.Text] message.
40+
Typically a [`Column`][flet.] that contains
41+
the dialog's [`Text`][flet.] message.
4442
"""
4543

4644
actions: list[Control] = field(default_factory=list)
4745
"""
48-
The (optional) set of actions that are displayed at the bottom of the dialog.
46+
A set of actions that are displayed at the bottom of the dialog.
4947
50-
Typically this is a list of
51-
[`CupertinoDialogAction`][flet.CupertinoDialogAction] controls.
48+
Typically this is a list of [`CupertinoDialogAction`][flet.] controls.
5249
"""
5350

5451
inset_animation: Animation = field(

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_app_bar.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ class CupertinoAppBar(Control):
1515
An iOS-styled app bar.
1616
1717
Note:
18-
The alignment of the [`title`][(c).] depends on whether this app bar is [`large`][(c).] or not.
19-
If it is `True`, the `title` is left-aligned and if it is `False` (the default),
20-
the `title` is centered.
18+
The alignment of the [`title`][(c).] depends on whether
19+
this app bar is [`large`][(c).] or not.
20+
If it is `True`, the [`title`][(c).] is left-aligned and if it
21+
is `False` (the default), the [`title`][(c).] is centered.
2122
"""
2223

2324
leading: Optional[Control] = None
2425
"""
2526
A control to display at the start of this app bar.
2627
27-
Typically the leading control is an [`Icon`][flet.Icon] or an
28-
[`IconButton`][flet.IconButton].
28+
Typically the leading control is an [`Icon`][flet.] or an [`IconButton`][flet.] .
2929
30-
If it is `None` and [`automatically_imply_leading = True`][flet.CupertinoAppBar.automatically_imply_leading],
30+
If it is `None` and [`automatically_imply_leading`][(c).] is `True`,
3131
an appropriate button will be automatically created.
3232
"""
3333

3434
title: Optional[StrOrControl] = None
3535
"""
3636
A string or a control to display in the middle of this app bar.
3737
38-
Typically a [`Text`][flet.Text].
38+
Typically a [`Text`][flet.].
3939
"""
4040

4141
trailing: Optional[Control] = None
@@ -54,20 +54,21 @@ class CupertinoAppBar(Control):
5454

5555
automatically_imply_leading: Optional[bool] = None
5656
"""
57-
Whether we should try to imply the [`leading`][flet.CupertinoAppBar.leading]
58-
control if `None`.
57+
Whether we should try to imply the [`leading`][(c).] control if `None`.
5958
60-
- If `True` and `leading` is `None`, the app bar will automatically determine an appropriate leading control.
61-
- If `False` and `leading` is `None`, the space is allocated to the `title`.
62-
- If a `leading` control is provided, this parameter has no effect.
59+
- If `True` and [`leading`][(c).] is `None`, the app bar will automatically
60+
determine an appropriate leading control.
61+
- If `False` and [`leading`][(c).] is `None`,
62+
the space is allocated to the [`title`][(c).].
63+
- If a [`leading`][(c).] control is provided, this parameter has no effect.
6364
"""
6465

6566
automatically_imply_title: Optional[bool] = None
6667
"""
6768
Whether we should try to imply the `title` control if `None`.
6869
69-
- If True and `title` is `None`, a [`Text`][flet.Text] control containing the
70-
current route's title will be automatically filled in.
70+
- If True and `title` is `None`, a [`Text`][flet.] control containing the
71+
current route's title will be automatically filled in.
7172
- If the `title` is not `None`, this parameter has no effect.
7273
"""
7374

@@ -84,10 +85,10 @@ class CupertinoAppBar(Control):
8485
If `None`, the app bar will adopt the following defaults:
8586
8687
- vertically, contents will be sized to the same height as the app bar itself minus
87-
the status bar.
88+
the status bar.
8889
- horizontally, padding will be `16` pixels according to iOS specifications unless
89-
the leading widget is an automatically inserted back button, in which case the
90-
padding will be `0`.
90+
the leading widget is an automatically inserted back button, in which case the
91+
padding will be `0`.
9192
9293
Note:
9394
Vertical padding (`top` and `bottom`) won't change the height of this app bar.
@@ -97,8 +98,8 @@ class CupertinoAppBar(Control):
9798
"""
9899
Determines whether the app bar transitions between routes.
99100
100-
If `True`, this app bar will animate on top of route transitions when the destination
101-
route also contains a `CupertinoAppBar` or `CupertinoSliverAppBar` with
101+
If `True`, this app bar will animate on top of route transitions when the
102+
destination route also contains a `CupertinoAppBar` or `CupertinoSliverAppBar` with
102103
`transition_between_routes` set to `True`.
103104
104105
This transition also occurs during edge back swipe gestures, mimicking native iOS
@@ -111,49 +112,48 @@ class CupertinoAppBar(Control):
111112

112113
previous_page_title: Optional[str] = None
113114
"""
114-
Manually specify the previous route's title when automatically implying the leading back button.
115+
Manually specify the previous route's title when automatically implying
116+
the leading back button.
115117
116118
Overrides the text shown with the back chevron instead of automatically showing the
117-
previous route's title when [`automatically_imply_leading`][flet.CupertinoAppBar.automatically_imply_leading]
118-
is `True`.
119+
previous route's title when [`automatically_imply_leading`][(c).] is `True`.
119120
120121
Note:
121122
Has no effect if `leading` is not `None` or if
122-
[`automatically_imply_leading`][flet.CupertinoAppBar.automatically_imply_leading] is `False`.
123+
[`automatically_imply_leading`][(c).] is `False`.
123124
"""
124125

125126
brightness: Optional[Brightness] = None
126127
"""
127-
The brightness of the specified [`bgcolor`][flet.CupertinoAppBar.bgcolor].
128+
The brightness of the specified [`bgcolor`][(c).].
128129
129130
Setting this value changes the style of the system status bar. It is typically used
130-
to increase the contrast ratio of the system status bar over `bgcolor`.
131+
to increase the contrast ratio of the system status bar over [`bgcolor`][(c).].
131132
132133
If `None` (the default), its value will be inferred from the relative luminance of
133-
the `bgcolor`.
134+
the [`bgcolor`][(c).].
134135
"""
135136

136137
automatic_background_visibility: Optional[bool] = None
137138
"""
138-
Whether the navigation bar should appear transparent when content is scrolled under
139-
it.
139+
Whether the navigation bar should appear transparent
140+
when content is scrolled under it.
140141
141-
If `False`, the navigation bar will display its [`bgcolor`][flet.CupertinoAppBar.bgcolor].
142+
If `False`, the navigation bar will display its [`bgcolor`][(c).].
142143
"""
143144

144145
enable_background_filter_blur: Optional[bool] = None
145146
"""
146-
Whether to have a blur effect when a non-opaque [`bgcolor`][flet.CupertinoAppBar.bgcolor] is used.
147+
Whether to have a blur effect when a non-opaque [`bgcolor`][(c).] is used.
147148
148-
This will only be respected when
149-
[`automatic_background_visibility`][flet.CupertinoAppBar.automatic_background_visibility]
149+
This will only be respected when [`automatic_background_visibility`][(c).]
150150
is `False` or until content scrolls under the navigation bar.
151151
"""
152152

153153
large: bool = False
154154
"""
155155
Whether to use a large app bar layout.
156156
157-
If `True`, the title will be left-aligned and if it is `False`, the title will be
158-
centered.
157+
If `True`, the [`title`][(c).] is left-aligned;
158+
if `False`, the [`title`][(c).] is centered.
159159
"""

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_bottom_sheet.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
@control("CupertinoBottomSheet")
1313
class CupertinoBottomSheet(DialogControl):
1414
"""
15-
A Cupertino version of modal bottom sheet.
15+
A Cupertino bottom sheet.
1616
"""
1717

1818
content: Control
1919
"""
20-
The control to be displayed.
20+
The control to be displayed in this bottom sheet.
2121
"""
2222

2323
modal: bool = False
2424
"""
25-
Whether this bottom sheet can be dismissed/closed by clicking the area outside of
26-
it.
25+
Whether this bottom sheet can be dismissed/closed by
26+
clicking the area outside of it.
2727
"""
2828

2929
bgcolor: Optional[ColorValue] = None
3030
"""
31-
The sheet's background color.
31+
The background color of this bottom sheet.
3232
"""
3333

3434
height: Optional[Number] = None

sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_button.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CupertinoButton(LayoutControl):
4949

5050
icon_color: Optional[ColorValue] = None
5151
"""
52-
The foreground color of the [`icon`][flet.CupertinoButton.icon].
52+
The foreground color of the [`icon`][(c).].
5353
"""
5454

5555
bgcolor: Optional[ColorValue] = None
@@ -110,7 +110,7 @@ class CupertinoButton(LayoutControl):
110110
"""
111111
The URL to open when this button is clicked.
112112
113-
Additionally, if [`on_click`][flet.CupertinoButton.on_click] event callback is
113+
Additionally, if [`on_click`][(c).] event callback is
114114
provided, it is fired after that.
115115
"""
116116

@@ -124,9 +124,9 @@ class CupertinoButton(LayoutControl):
124124
"""
125125
The color to use for the focus highlight for keyboard interactions.
126126
127-
Defaults to a slightly transparent [`bgcolor`][flet.CupertinoButton.bgcolor].
127+
Defaults to a slightly transparent [`bgcolor`][(c).].
128128
If `bgcolor` is `None`, defaults to a slightly transparent
129-
[`CupertinoColors.ACTIVE_BLUE`][flet.CupertinoColors.ACTIVE_BLUE].
129+
[`CupertinoColors.ACTIVE_BLUE`][flet.].
130130
'Slightly transparent' in this context means the color is used with an opacity
131131
of `0.80`, a brightness of `0.69` and a saturation of `0.835`.
132132
"""

0 commit comments

Comments
 (0)