M3EDialog class

A Material 3 Expressive basic dialog plus helpers to present dialogs.

Use M3EDialog.show for a basic dialog over a scrim, M3EDialog.showFullScreen for compact full-screen tasks and M3EDialog.showAdaptive to swap between them at the compact breakpoint. The headline and actions stay pinned while the content scrolls.

Inheritance

Constructors

M3EDialog({required String title, Widget? icon, Widget? content, EdgeInsets? contentPadding, List<Widget> actions = const <Widget>[], bool topDivider = false, bool bottomDivider = false, String? subhead, Widget? leadingAction, ScrollController? scrollController, int? titleMaxLines, String? semanticLabel, Key? key})
M3EDialog.
const

Properties

actions → List<Widget>
Dismissive first, confirming last (closest to the trailing edge). At most two are recommended; they stack when they don't fit.
final
bottomDivider → bool
Full-bleed divider above the actions row.
final
content → Widget?
Supporting content. Scrolls between the pinned headline and actions.
final
contentPadding → EdgeInsets?
Null uses 24 left / right with spec gaps above and below.
final
hashCode → int
The hash code for this object.
no setterinherited
icon → Widget?
Optional hero icon. Centres the headline when set.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leadingAction → Widget?
Optional third action at the leading edge (e.g. Learn more).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollController → ScrollController?
Controller for the scrolling content.
final
semanticLabel → String?
Null uses title.
final
subhead → String?
Optional subhead under the headline.
final
title → String
Headline. Also the dialog's accessibility label.
final
titleMaxLines → int?
Headline lines before truncation. Null wraps without limit. A truncated headline expands on tap.
final
topDivider → bool
Full-bleed divider between the header and the section below it.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

show<T>(BuildContext context, {required Widget dialog, bool barrierDismissible = true, bool? resizeToAvoidBottomInset, M3EDialogPosition position = M3EDialogPosition.center, M3EDialogController? controller, Future<bool> onDismissRequest()?, bool autofocusFirst = true}) → Future<T?>
Presents a basic dialog and completes with the popped result.
showAdaptive<T>(BuildContext context, {required String title, required Widget content, required String confirmLabel, required VoidCallback? onConfirm, String dismissLabel = M3EDialogStrings.cancel, Widget? icon, M3EDialogPosition position = M3EDialogPosition.center, bool barrierDismissible = true, M3EDialogController? controller, Future<bool> onDismissRequest()?, bool autofocusFirst = true, String? semanticLabel}) → Future<T?>
Presents an M3EAdaptiveDialog: full-screen below the compact breakpoint, basic above it, morphing when the width crosses it.
showDiscardConfirmation(BuildContext context, {M3EDialogDiscardLabels labels = const M3EDialogDiscardLabels()}) → Future<bool>
Asks to discard unsaved changes. Resolves true to discard.
showFullScreen<T>(BuildContext context, {required String title, required Widget body, Widget? action, String? confirmLabel, VoidCallback? onConfirm, List<Widget> bottomActions = const <Widget>[], String? contentHeadline, EdgeInsetsGeometry? contentPadding, M3EDialogController? controller, Future<bool> onDismissRequest()?, bool autofocusFirst = true, String? semanticLabel}) → Future<T?>
Presents a full-screen dialog with a header of title and action.
showSelectionScreen(BuildContext context, {required String title, required List<String> options, bool multiSelect = false, List<String> initialSelection = const <String>[], String cancelLabel = M3EDialogStrings.cancel, String confirmLabel = M3EDialogStrings.confirm, Widget? icon, bool barrierDismissible = true, bool? resizeToAvoidBottomInset}) → Future<List<String>?>
Presents a centred M3EDialog with selectable options.