Sheet
PaymentSheet lays out a header, a scrolling body and a fixed footer, with safe-area and keyboard insets handled. Open it as a bottom sheet or as a side panel from the end edge.



Minimal
Section titled “Minimal”Add the published package, then paste this complete example into lib/main.dart.
import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
void main() => runApp(MaterialApp( home: Scaffold( appBar: AppBar(title: const Text('Example')), body: Builder(builder: (context) => Padding( padding: const EdgeInsets.all(16), child: PaymentButton( label: 'Note actions', variant: PaymentButtonVariant.secondary, onPressed: () => showPaymentSheet<void>( context: context, builder: (sheetContext) => PaymentSheet( header: PaymentSheetHeader( title: 'Note actions', onClose: () => Navigator.of(sheetContext).pop(), ), body: const Text('Choose what to do with this note.'), footer: PaymentButton( label: 'Done', onPressed: () => Navigator.of(sheetContext).pop(), ), ), ), ), )), ),));Bounded sheet for a long list
Section titled “Bounded sheet for a long list”Use PaymentSheet.scrollable when the body is already a scroll view. Pass a
ListView.builder for rows built on demand, or a CustomScrollView to scroll a
search field and its results together. Set body padding on the scroll view;
the sheet keeps its usual header, footer, and theme.
Future<void> openContents(BuildContext context, List<String> sections) async { await showPaymentSheet<void>( context: context, builder: (sheet) => PaymentSheet.scrollable( height: MediaQuery.sizeOf(sheet).height * 0.7, header: PaymentSheetHeader( title: 'Contents', onClose: () => Navigator.pop(sheet), ), body: ListView.builder( padding: EdgeInsets.symmetric( horizontal: PaymentTheme.of(sheet).space(PaymentSpace.group), ), itemCount: sections.length, itemBuilder: (_, index) => PaymentListItem(title: sections[index]), ), ), );}height requests a positive, finite height in logical pixels. It excludes the
route’s drag handle and the keyboard inset. When there is less room, the sheet
uses the available height above the keyboard. In short, wide layouts with the
keyboard open, the scrollable variant moves the header and footer beside the
body so a focused field and the action can stay in view. The footer stays
mounted, so closing the keyboard doesn’t unlock a pending button action.
Without height, use a vertically bounded parent, such as the sheet route
or an Expanded slot. The default constructor still wraps ordinary content
and hugs it.
Try Bounded contents sheet under Sheets & drawers in the example app.
Variants
Section titled “Variants”Variants: bottom sheet, side sheet.
Behavior
Section titled “Behavior”- The header’s Close only closes the panel. Cancelling a payment is a separate footer action, behind
showPaymentConfirmDialog, and your host decides the result. The payment stays pending until then. showPaymentSheetsizes the sheet to its content, up to the full height. Swipe down, the scrim, Back and Escape dismiss it whileisDismissibleis true.- Use
PaymentSheetas the direct body ofshowPaymentSideSheetto fill the panel and pin the footer. If you wrap it, the wrapper’s constraints apply. The scrim, Back and Escape close it, and focus returns to whatever opened it. - Both presenters keep the theme around the code that opens them: a
PaymentThemeorPaymentButtonThemescoped to one feature also styles that feature’s sheet surface and buttons. - Pass
isDismissible: false/barrierDismissible: falsewhile a host call that must finish is running. - Sheets open in 280 ms and close in 200 ms on the drawer curve; zero under reduced motion.
- The header’s title centres its first line on the 48 dp close button at every text scale. The header keeps that height while
onCloseis null, so hiding Close during a host call does not move the title. - On phones,
showPaymentConfirmDialogandPaymentMenuopen as sheets too. A confirmation opened from a sheet stacks on top of it.
Footer: one primary
Section titled “Footer: one primary”The footer’s completion action is the sheet’s one primary button (“Done”, “Apply”). The button that opened the sheet stays secondary. Use a quiet button for “Cancel” or “Not now”.
Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| Supporting source or field choice | bottom sheet | Use the provided presentation functions; close never cancels a payment operation. |
| Long list or search results | bottom sheet with PaymentSheet.scrollable |
Browse a long list of statements with the header kept in view. |
Use Focus view for a focused task with its own footer.
States
Section titled “States”The host supplies content and handles actions. Closing a sheet dismisses its UI; it does not cancel a payment.
Do and don’t
Section titled “Do and don’t”Do: Use the provided presentation functions; close never cancels a payment operation.
Don’t: Attach a destructive payment action to the close affordance.
Content guidelines
Section titled “Content guidelines”- Title the sheet with what it shows or asks: “Pending payment”, “Filter transactions”.
- Use
subtitlefor one line of context, such as a reference or a date. - Put the actions in the footer, the main one as the primary. Keep the footer to one or two buttons.
- Never label the close button or any footer action in a way that suggests closing cancels a payment. Write the cancel request as its own action, such as “Request cancellation”.
Accessibility
Section titled “Accessibility”Keep the close control labeled and the footer reachable with the keyboard open. Dismissal returns focus to the opener.
PaymentSheet
class PaymentSheet extends StatelessWidget · lib/src/overlay/sheets.dart
Layout for bottom sheets and side panels: a fixed header, a body that scrolls when it is taller than the space, and a fixed footer for actions. Respects the safe area and moves above the software keyboard.
As the direct body of showPaymentSideSheet, it fills the panel. In a bottom sheet the default constructor hugs its content unless height is set. PaymentSheet.scrollable gives a caller-owned scrollable the remaining space directly.
| Parameter | Type | Default | Description |
|---|---|---|---|
header: | Widget? | — | Optional fixed content above the scrolling body. |
body:required | Widget | — | The content to scroll, or the scrollable itself in PaymentSheet.scrollable. |
footer: | Widget? | — | Optional fixed actions below the scrolling body. |
height: | double? | — | Requested height in logical pixels, excluding the keyboard inset and route drag handle. Must be finite and positive, with room for the header and footer. Parent constraints can limit it or require the sheet to fill the panel. |
PaymentSheet.scrollable(…) — Gives body a finite viewport without wrapping it in a scroll view or adding gutters. Pass a ListView or CustomScrollView and set its padding as needed. Without height, the parent must bound the height. When a keyboard leaves a short, wide viewport, the header and footer move beside the body to leave room for editing.
| Parameter | Type | Default | Description |
|---|---|---|---|
header: | Widget? | — | Optional fixed content above the scrolling body. |
body:required | Widget | — | The content to scroll, or the scrollable itself in PaymentSheet.scrollable. |
footer: | Widget? | — | Optional fixed actions below the scrolling body. |
height: | double? | — | Requested height in logical pixels, excluding the keyboard inset and route drag handle. Must be finite and positive, with room for the header and footer. Parent constraints can limit it or require the sheet to fill the panel. |
PaymentSheetHeader
class PaymentSheetHeader extends StatelessWidget · lib/src/overlay/sheets.dart
Title row for a PaymentSheet with an optional close button.
"Close" only dismisses the panel. It never cancels a payment or any other host operation; put such actions in the footer, behind a confirmation.
| Parameter | Type | Default | Description |
|---|---|---|---|
title:required | String | — | — |
subtitle: | String? | — | — |
onClose: | VoidCallback? | — | Null hides the close button (for example while a host call runs). |
showPaymentSheet
Future<T?> showPaymentSheet<T>(…) · lib/src/overlay/sheets.dart
Opens a modal bottom sheet sized to its content, up to the full height. Use PaymentSheet.height to request a shorter panel.
Swipe down, the scrim, Back and Escape dismiss it when isDismissible is true; pass false while a host call that must finish is running.
| Parameter | Type | Default | Description |
|---|---|---|---|
context:required | BuildContext | — | — |
builder:required | WidgetBuilder | — | — |
isDismissible: | bool | true | — |
showPaymentSideSheet
Future<T?> showPaymentSideSheet<T>(…) · lib/src/overlay/sheets.dart
Opens a panel from the end edge (right in left-to-right languages), for filters or details on wide screens. The scrim, Back and Escape close it; focus returns to whatever opened it.
| Parameter | Type | Default | Description |
|---|---|---|---|
context:required | BuildContext | — | — |
builder:required | WidgetBuilder | — | — |
barrierDismissible: | bool | true | — |
maxWidth: | double | 420 | — |
See also
Section titled “See also”- Dialog to confirm a destructive footer action.
- Navigation shell for the app’s own sidebar and drawer.
- Transaction history, which opens transaction details in a sheet.
Close uses PaymentIconButton with a tooltip and circular focus ring.
Full page view is a host scaffold body. Focus view composes the existing sheets for a focused task.