Skip to content
Get started
Menu
Get started

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.

Payment sheet examples with headers, content and close controls.Payment sheet examples with headers, content and close controls.
Light and dark variants
Payment sheet examples with headers, content and close controls at 200 percent text.
200% text

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(),
),
),
),
),
)),
),
));

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: bottom sheet, side sheet.

  • 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.
  • showPaymentSheet sizes the sheet to its content, up to the full height. Swipe down, the scrim, Back and Escape dismiss it while isDismissible is true.
  • Use PaymentSheet as the direct body of showPaymentSideSheet to 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 PaymentTheme or PaymentButtonTheme scoped to one feature also styles that feature’s sheet surface and buttons.
  • Pass isDismissible: false / barrierDismissible: false while 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 onClose is null, so hiding Close during a host call does not move the title.
  • On phones, showPaymentConfirmDialog and PaymentMenu open as sheets too. A confirmation opened from a sheet stacks on top of it.

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”.

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.

The host supplies content and handles actions. Closing a sheet dismisses its UI; it does not cancel a payment.

Do: Use the provided presentation functions; close never cancels a payment operation.

Don’t: Attach a destructive payment action to the close affordance.

  • Title the sheet with what it shows or asks: “Pending payment”, “Filter transactions”.
  • Use subtitle for 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”.

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.

ParameterTypeDefaultDescription
header:Widget?—Optional fixed content above the scrolling body.
body:requiredWidget—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.

ParameterTypeDefaultDescription
header:Widget?—Optional fixed content above the scrolling body.
body:requiredWidget—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.

ParameterTypeDefaultDescription
title:requiredString——
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.

ParameterTypeDefaultDescription
context:requiredBuildContext——
builder:requiredWidgetBuilder——
isDismissible:booltrue—

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.

ParameterTypeDefaultDescription
context:requiredBuildContext——
builder:requiredWidgetBuilder——
barrierDismissible:booltrue—
maxWidth:double420—

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.