prism_adaptive_dialog 0.1.0
prism_adaptive_dialog: ^0.1.0 copied to clipboard
Adaptive dialogs for Flutter — bottom sheets on phones, centered dialogs on desktop, from one call. The companion to prism_adaptive_scaffold. Pure Flutter, works on all six platforms.
prism_adaptive_dialog #
Adaptive dialogs for Flutter — modal bottom sheets on phones, centered
dialogs on tablets and desktops, from a single call. The companion to
prism_adaptive_scaffold.
Pure Flutter — no platform channels, works on all six platforms.
Features #
- ✅ One call → bottom sheet on compact, centered dialog on medium+
- ✅ Full override control per window class (
PresentationStyle) - ✅ Pre-styled actions:
cancel,primary,destructive - ✅ Optional
title, barrier dismissal, safe areas, max width - ✅ Material 3 by default; adapts to your
ThemeData - ✅ All six Flutter platforms: Android, iOS, macOS, Windows, Linux, Web
Installation #
dependencies:
prism_adaptive_dialog: ^0.1.0
Usage #
final confirmed = await PrismAdaptiveDialog.show<bool>(
context,
title: 'Delete item?',
builder: (context) => const Text('This cannot be undone.'),
actions: [
AdaptiveDialogAction.cancel(context),
AdaptiveDialogAction.destructive(
context,
label: 'Delete',
onPressed: () => Navigator.pop(context, true),
),
],
);
On a 400px-wide phone this opens as a bottom sheet; on a 1200px desktop it opens as a centered dialog. Same code, correct UX everywhere.
Force a specific presentation #
PrismAdaptiveDialog.show(
context,
presentation: PresentationStyle.dialog, // always centered
// presentation: PresentationStyle.bottomSheet, // always a sheet
builder: (context) => const Text('Content'),
);
With prism_adaptive_scaffold #
Breakpoints are shared, so dialogs inside PrismAdaptiveScaffold layouts
automatically pick the right presentation for the current window class.
License #
MIT — see LICENSE.