BottomSheet

class BottomSheet(pointer: <Error class: unknown class><<Error class: unknown class>>) : Swipeable

A bottom sheet with an optional bottom bar.

bottom-sheet

AdwBottomSheet has three child widgets. property@BottomSheet:content is shown persistently. property@BottomSheet:sheet is displayed above it when it's open, and property@BottomSheet:bottom-bar is displayed when it's not.

Bottom sheet and bottom bar are attached to the bottom edge of the widget. They take the full width by default, but can only take a portion of it if property@BottomSheet:full-width is set to FALSE. In this case, property@BottomSheet:align determines where along the bottom edge they are placed.

AdwBottomSheet can be useful for applications such as music players, that want to have a persistent bottom bar that expands into a bottom sheet when clicked. It's meant for cases where a bottom sheet is tightly integrated into the UI. For more transient bottom sheets, see class@Dialog.

To open or close the bottom sheet, use the property@BottomSheet:open property.

By default, the bottom sheet has an overlaid drag handle. It can be disabled by setting property@BottomSheet:show-drag-handle to FALSE. Note that the handle also controls whether the sheet can be dragged using a pointer.

Bottom sheets are modal by default, meaning that the content is dimmed and cannot be accessed while the sheet is open. Set property@BottomSheet:modal to FALSE if this behavior is unwanted.

To disable user interactions for opening or closing the bottom sheet (such as swipes or clicking the bottom bar or close button), set property@BottomSheet:can-open or property@BottomSheet:can-close to FALSE.

In some cases, particularly when using a full-width bottom bar, it may be necessary to shift property@BottomSheet:content upwards. Use the property@BottomSheet:bottom-bar-height and property@BottomSheet:sheet-height for that.

AdwBottomSheet is not adaptive, and for larger window sizes applications may want to replace it with another UI, such as a sidebar. This can be done using class@MultiLayoutView.

Sizing

Unlike class@Dialog presented as a bottom sheet, AdwBottomSheet just follows the content's natural size, and it's up to the applications to make sure their content provides one. For example, when using class@Gtk.ScrolledWindow, make sure to set property@Gtk.ScrolledWindow:propagate-natural-height to TRUE.

Header Bar Integration

When placed inside an AdwBottomSheet, class@HeaderBar will not show the title when property@BottomSheet:show-drag-handle is TRUE, regardless of property@HeaderBar:show-title. This only applies to the default title, titles set with property@HeaderBar:title-widget will still be shown.

AdwBottomSheet as GtkBuildable:

The AdwBottomSheet implementation of the iface@Gtk.Buildable interface supports setting the sheet widget by specifying “sheet” as the “type” attribute of a <child> element, and the bottom bar by specifying “bottom-bar”. Specifying “content” or omitting the child type results in setting the content child.

Since

1.6

Constructors

Link copied to clipboard
constructor()

Creates a new AdwBottomSheet.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val adwBottomSheetPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val adwSwipeablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Horizontal alignment of the bottom sheet.

Link copied to clipboard
var bottomBar: <Error class: unknown class>?

The bottom bar widget.

Link copied to clipboard

The current bottom bar height.

Link copied to clipboard

Whether the bottom sheet can be closed by user.

Link copied to clipboard

Whether the bottom sheet can be opened by user.

Link copied to clipboard
var content: <Error class: unknown class>?

The content widget.

Link copied to clipboard

Whether the bottom sheet takes the full width.

Link copied to clipboard
open val gtkAccessiblePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkBuildablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkConstraintTargetPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether the bottom sheet is modal.

Link copied to clipboard

Whether the bottom sheet is open.

Link copied to clipboard
var sheet: <Error class: unknown class>?

The bottom sheet widget.

Link copied to clipboard

The current bottom sheet height.

Link copied to clipboard

Whether to overlay a drag handle in the bottom sheet.

Functions

Link copied to clipboard
fun connectCloseAttempt(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the close button or shortcut is used while property@Dialog:can-close is set to FALSE.

Link copied to clipboard

Gets horizontal alignment of the bottom sheet.

Link copied to clipboard
fun getBottomBar(): <Error class: unknown class>?

Gets the bottom bar widget for @self.

Link copied to clipboard

Gets the current bottom bar height.

Link copied to clipboard

Gets the progress @self will snap back to after the gesture is canceled.

Link copied to clipboard

Gets whether the bottom sheet can be closed by user.

Link copied to clipboard

Gets whether the bottom sheet can be opened by user.

Link copied to clipboard
fun getContent(): <Error class: unknown class>?

Gets the content widget for @self.

Link copied to clipboard
open fun getDistance(): Double

Gets the swipe distance of @self.

Link copied to clipboard

Gets whether the bottom sheet takes the full width.

Link copied to clipboard

Gets whether the bottom sheet is modal.

Link copied to clipboard

Gets whether the bottom sheet is open.

Link copied to clipboard
open fun getProgress(): Double

Gets the current progress of @self.

Link copied to clipboard
fun getSheet(): <Error class: unknown class>?

Gets the bottom sheet widget for @self.

Link copied to clipboard

Gets the current bottom sheet height.

Link copied to clipboard

Gets whether to show a drag handle in the bottom sheet.

Link copied to clipboard
open fun getSwipeArea(navigationDirection: NavigationDirection, isDrag: Boolean, rect: <Error class: unknown class>)

Gets the area @self can start a swipe from for the given direction and gesture type.

Link copied to clipboard
fun setAlign(align: Float)

Sets horizontal alignment of the bottom sheet.

Link copied to clipboard
fun setBottomBar(bottomBar: <Error class: unknown class>? = null)

Sets the bottom bar widget for @self.

Link copied to clipboard
fun setCanClose(canClose: Boolean)

Sets whether the bottom sheet can be closed by user.

Link copied to clipboard
fun setCanOpen(canOpen: Boolean)

Sets whether the bottom sheet can be opened by user.

Link copied to clipboard
fun setContent(content: <Error class: unknown class>? = null)

Sets the content widget for @self.

Link copied to clipboard
fun setFullWidth(fullWidth: Boolean)

Sets whether the bottom sheet takes the full width.

Link copied to clipboard
fun setModal(modal: Boolean)

Sets whether the bottom sheet is modal.

Link copied to clipboard
fun setOpen(open: Boolean)

Sets whether the bottom sheet is open.

Link copied to clipboard
fun setSheet(sheet: <Error class: unknown class>? = null)

Sets the bottom sheet widget for @self.

Link copied to clipboard
fun setShowDragHandle(showDragHandle: Boolean)

Sets whether to show a drag handle in the bottom sheet.