Liquid Glass Easy

Dialogs

An alert on glass, and the presenter that animates it in.

Two widgets and one presenter. LiquidGlassAlertDialog has the Material 3 slots you already know — icon, title, content, actions — sitting on a glass lens instead of a filled surface. LiquidGlassDialog is the same card with nothing in it but your own child.

Dart
showLiquidGlassDialog(
  context: context,
  builder: (context) => LiquidGlassAlertDialog(
    icon: const Icon(Icons.delete_outline_rounded),
    title: const Text('Delete this album?'),
    content: const Text('The photos in it stay in your library.'),
    actions: [
      LiquidGlassButton(label: 'Cancel', onPressed: () => pop(context)),
      LiquidGlassButton(label: 'Delete', onPressed: () => confirm(context)),
    ],
  ),
);

showLiquidGlassDialog is showGeneralDialog with a tuned scale-and-fade transition already set: transitionDuration, transitionCurve and reverseTransitionCurve are yours to change, and barrierDismissible, barrierColor, useRootNavigator, routeSettings and the rest behave exactly as Flutter's do.

The slots#

ParameterDefaultWhat it does
icon / iconColornullA leading glyph above the title.
title / contentnullThe two text slots, each with its own padding and text style.
actionsnullThe button row. It overflows to a column when the buttons do not fit, with actionsOverflow* controlling how.
width340Maximum width of the card.
scrollablefalseLets a long title and content scroll instead of overflowing.
stylenullThe glass, same as everywhere else.

Comments

Comments are GitHub Discussions — reply from either place.