Skip to main content

Drawer

A side panel that slides in from the edge of the screen.

When to use it

Use Drawer for a side panel of secondary navigation or contextual actions — account menus, filters, or detail panels that slide in from the edge. Present it with showDrawer rather than placing it directly in the widget tree. A close button is automatically shown in the header row.

Import

import 'package:catalyst_ui/catalyst_ui.dart';

Usage

showDrawer<void>(
context,
(context) => Drawer(
title: const Text('Account'),
body: const Text('Drawer content goes here.'),
),
);

Parameters

ParameterTypeDefaultDescription
titleWidgetrequiredThe header title, shown next to the close button.
bodyWidgetrequiredThe scrollable content area.
footerWidget?nullAn optional footer widget pinned below the body.
closeIconIconData?nullIcon to display on the close button. Falls back to Iconography.closeIcon.

Showing it

showDrawer<T>(BuildContext context, WidgetBuilder builder, {bool barrierDismissible = true, bool useRootNavigator = true}), defined in lib/src/utils/show_modal.dart, displays a drawer panel sliding in from the right edge of the screen with a fade + slide transition (300ms). Returns a Future that resolves to the value passed to Navigator.pop, or null if dismissed.

Iconography

The close button in the header row uses closeIcon, falling back to context.iconography.closeIcon.