CupertinoAlertDialog class

An iOS-style alert dialog.

An alert dialog informs the user about situations that require acknowledgment. An alert dialog has an optional title, optional content, and an optional list of actions. The title is displayed above the content and the actions are displayed below the content.

This dialog styles its title and content (typically a message) to match the standard iOS title and message dialog text style. These default styles can be overridden by explicitly defining TextStyles for Text widgets that are part of the title or content.

To display action buttons that look like standard iOS dialog buttons, provide CupertinoDialogActions for the actions given to this dialog.

Typically passed as the child widget to showDialog, which displays the dialog.

This sample shows how to use a CupertinoAlertDialog. The CupertinoAlertDialog shows an alert with a set of two choices when CupertinoButton is pressed.
link

To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoAlertDialog.1 mysample

See also:

Inheritance

Constructors

CupertinoAlertDialog({Key? key, Widget? title, Widget? content, List<Widget> actions = const <Widget>[], ScrollController? scrollController, ScrollController? actionScrollController, Duration insetAnimationDuration = const Duration(milliseconds: 100), Curve insetAnimationCurve = Curves.decelerate})
Creates an iOS-style alert dialog.
const

Properties

actions List<Widget>
The (optional) set of actions that are displayed at the bottom of the dialog.
final
actionScrollController ScrollController?
A scroll controller that can be used to control the scrolling of the actions in the dialog.
final
content Widget?
The (optional) content of the dialog is displayed in the center of the dialog in a lighter font.
final
hashCode int
The hash code for this object.
no setterinherited
insetAnimationCurve Curve
The curve to use for the animation shown when the system keyboard intrudes into the space that the dialog is placed in.
final
insetAnimationDuration Duration
The duration of the animation to show when the system keyboard intrudes into the space that the dialog is placed in.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
A scroll controller that can be used to control the scrolling of the content in the dialog.
final
title Widget?
The (optional) title of the dialog is displayed in a large font at the top of the dialog.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CupertinoAlertDialog>
Creates the mutable state for this widget at a given location in the tree.
override
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}) 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