fossui
Components

Drawer

An edge-anchored modal panel with a title, body, and action slots that slides in from any side and drags off to dismiss.

A drawer slides a panel in from an edge and dims the page behind it. Open one with showFossDrawer, which draws the scrim, traps focus, and returns whatever you pass to Navigator.pop. The panel reads its colors, radius, and shadow from the theme.

import 'package:fossui/fossui.dart';

showFossDrawer<void>(
  context: context,
  builder: (context) => const FossDrawer(
    title: Text('Details'),
    content: Text('A panel that slides up from the bottom edge.'),
  ),
);

Sides

side picks the edge the panel anchors to. bottom (the default) and top run full width; left and right are side panels that respect text direction.

showFossDrawer<void>(
  context: context,
  side: FossDrawerSide.right,
  builder: (context) => const FossDrawer(
    title: Text('Filters'),
    content: FilterForm(),
  ),
);

Header and body

title and description fill the header; content is the scrollable body between the header and footer. Each slot is optional, so a bare panel with only a body is fine.

showFossDrawer<void>(
  context: context,
  builder: (context) => const FossDrawer(
    title: Text('Notifications'),
    description: Text('Choose what reaches you.'),
    content: NotificationSettings(),
  ),
);

Actions

actions render in a trailing-aligned footer row. Pass FossButtons and call Navigator.pop with the result you want showFossDrawer to resolve to.

final applied = await showFossDrawer<bool>(
  context: context,
  builder: (context) => FossDrawer(
    title: const Text('Filters'),
    content: const FilterForm(),
    actions: [
      FossButton(
        variant: FossButtonVariant.ghost,
        onPressed: () => Navigator.pop(context, false),
        child: const Text('Cancel'),
      ),
      FossButton(
        onPressed: () => Navigator.pop(context, true),
        child: const Text('Apply'),
      ),
    ],
  ),
);

Set footerVariant to filled to sit the actions on a bordered, muted bar instead of the plain surface.

FossDrawer(
  footerVariant: FossDrawerFooterVariant.filled,
  content: const CheckoutSummary(),
  actions: [
    FossButton(onPressed: pay, child: const Text('Pay')),
  ],
);

Handle and close button

showHandle adds a drag handle on the exposed edge. The surface can be dragged back off its edge to dismiss regardless. showCloseButton adds a close affordance in the top corner, and closeIcon replaces the default glyph.

const FossDrawer(
  showHandle: true,
  showCloseButton: true,
  title: Text('Share'),
  content: ShareOptions(),
);

Corners

variant sets the corner treatment. rounded (the default) rounds the exposed corners where the panel meets the page; straight squares every corner.

const FossDrawer(
  variant: FossDrawerVariant.straight,
  title: Text('Menu'),
  content: MenuList(),
);

API

showFossDrawer

PropTypeDefaultDescription
contextBuildContextrequiredThe context used to find the navigator.
builderWidgetBuilderrequiredBuilds the panel, typically a FossDrawer.
sideFossDrawerSidebottomThe edge the panel slides in from.
barrierDismissiblebooltrueWhether a scrim tap closes the drawer.
barrierLabelString?nullAccessibility label for the scrim.
useRootNavigatorbooltrueWhether to push onto the root navigator.

Returns a Future<T?> that resolves to the value passed to Navigator.pop.

FossDrawer

PropTypeDefaultDescription
titleWidget?nullTitle at the top of the header.
descriptionWidget?nullLine below the title.
contentWidget?nullScrollable body between header and footer.
actionsList<Widget>const []Footer actions; empty hides the footer.
variantFossDrawerVariantroundedCorner treatment.
footerVariantFossDrawerFooterVariantbareFooter treatment.
showHandleboolfalseShows a drag handle on the exposed edge.
showCloseButtonboolfalseShows a close affordance in the top corner.
closeIconWidget?nullReplaces the default close glyph.
styleFossDrawerStyle?nullPer-instance overrides on the theme.

FossDrawerSide

bottom, top, left, right.

FossDrawerVariant

rounded, straight.

FossDrawerFooterVariant

bare, filled.

Live demo

Open the interactive gallery to try every variant, size, and state with live knobs.

On this page