MinimalDialog class

Minimal's confirm dialog — the kit's only modal question: a compact card centred over the scrim, its title in MinimalThemeData.h3, the message in the quiet 13 px ink, and small buttons right-aligned in a footer under a hairline (stacked, the confirm on top, when they do not share a line). showMinimalDialog raises it; raised, the confirm answers true and the cancel false (after onConfirm or onCancel, when given), and a tap on the scrim or Escape answers null. Raised, focus opens on the safe answer: the cancel when the confirm is destructive (Enter then keeps), else the confirm (Enter confirms). The layout and the focus are ui_core's (DesignDialog); Minimal paints them.

The widget itself is the card, for a page that shows the question in place (a preview, an inline guard) rather than modally. In place it is border only, like anything else on the page, and its buttons do only what onConfirm and onCancel say; elevated gives it the floating shadow, which a raised card takes by default.

style dresses one card, components.dialog every one: fill, edge or side, shape (else shapes.large) and padding (round the question). The buttons keep their own styles, as Material's do.

final sure = await showMinimalDialog<bool>(context, builder: (context) => const MinimalDialog(title: 'Delete habit?', message: 'Its history goes too.', confirmLabel: 'Delete', cancelLabel: 'Keep', destructive: true));
Inheritance

Constructors

MinimalDialog({Key? key, required String title, String? message, String? confirmLabel, String? cancelLabel, bool destructive = false, VoidCallback? onConfirm, VoidCallback? onCancel, bool? autofocus, bool? elevated, MinimalStyle? style})
A dialog asking about title.
const

Properties

autofocus → bool?
In place, take the keyboard focus on arrival, so Enter confirms at once; null leaves the page's focus alone. Raised, the focus opens on the safe answer whatever this says.
final
cancelLabel → String?
The way out without acting; null offers the confirm alone (an acknowledgement).
final
confirmLabel → String?
What the confirming button says; null: OK, in the app's language.
final
destructive → bool
The destructive register: the confirm wears the destructive fill.
final
elevated → bool?
Cast MinimalThemeData.shadowLg, the floating register. Null casts it when raised: nothing on the page casts a shadow, so a card standing in place leaves it off.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
message → String?
One or two sentences on what confirming does; null keeps the title alone.
final
onCancel → VoidCallback?
Called by the cancel; a raised card's cancel answers false either way.
final
onConfirm → VoidCallback?
Called by the confirm. In place, null leaves the confirm out of use; a raised card's confirm answers true either way.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
style → MinimalStyle?
This card's style, over components.dialog.
final
title → String
The question, which names a raised card's route for a screen reader.
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.
override
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

Constants

maxWidth → const double
The card's widest measure from MinimalLayout.compact up; on a phone it runs from the page's gutter to the gutter, as a floating surface starts on the page's margin.