Skip to main content

CupertinoBottomSheet: a picker needs a height

note

This guide is accurate as of Flet 1.2.0. Later releases might add new APIs or additional migration paths.

The breaking changes and deprecations index lists the guides created for each release.

Summary​

CupertinoBottomSheet no longer treats pickers differently from other content. A CupertinoPicker, CupertinoDatePicker or CupertinoTimerPicker passed as content used to get a sheet of 220 pixels with a background automatically. Now, like any other content, it is placed on a sheet only when height, padding or bgcolor is set.

A picker fills the height it is given, so without a sheet it covers the screen with no background.

Context​

The sheet only applied height, padding and bgcolor when content was one of these three pickers, recognized by its type. With any other content, these properties were ignored. A picker inside a layout, such as a Column with a Cancel/Done toolbar above it, didn't get a sheet either, and stretched over the whole screen.

The sheet now works like Flutter's showCupertinoModalPopup(): content is shown as it is, and the three properties place any content on a sheet of that height, with that padding and background, kept above the on-screen keyboard and the bottom safe area.

Migration guide​

Set a height on a CupertinoBottomSheet that shows a picker. 220 keeps the previous size; iOS pickers usually use 216 with a small top padding:

page.show_dialog(
ft.CupertinoBottomSheet(
height=216,
padding=ft.Padding.only(top=6),
content=ft.CupertinoDatePicker(),
)
)

A sheet that shows a picker and already sets height needs no change. In dark mode, its default background is the elevated system background iOS uses for popups, a little lighter than before.

height, padding and bgcolor used to be ignored for any other content. A sheet that sets them around content with its own surface, such as a CupertinoActionSheet, now applies them: remove them to keep that content's own size and look.

Timeline​

  • Changed in: 1.2.0

References​