DialogAction<T> class

Class to represent an action (button) of dialogs.

The actions are used in the following dialogs:

Below is an example of a dialog with actions.

const result = showBasicDialog<bool>(context,
    title: Text('Do you want to activate your location?'),
    actions: [
        DialogAction(title: Text('NO'), value: (context) => false),
        DialogAction(title: Text('YES'), value: (context) => true)
    ]
);

Constructors

DialogAction({@required Widget title, @required T action(BuildContext context)})
Standard constructor of the DialogAction class

Properties

action → T Function(BuildContext context)
Function that must be executed when the button is clicked, the function should return the value expected by the dialog.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
title Widget
Icon to be listed in the button action.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
performClick(BuildContext context) → dynamic
Execute the action of the button click. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

abortRetryIgnore(BuildContext context) List<DialogAction<DialogResult>>
Returns a list of DialogAction with returns of type DialogResult.abort, DialogResult.retry, and DialogResult.ignore to be used in the showBasicDialog method.
okCancel(BuildContext context) List<DialogAction<DialogResult>>
Returns a list of DialogAction with returns of type DialogResult.ok and DialogResult.cancel to be used in the showBasicDialog method.
retryCancel(BuildContext context) List<DialogAction<DialogResult>>
Returns a list of DialogAction with returns of type DialogResult.retry and DialogResult.cancel to be used in the showBasicDialog method.
yesNo(BuildContext context) List<DialogAction<DialogResult>>
Returns a list of DialogAction with returns of type DialogResult.yes and DialogResult.no to be used in the showBasicDialog method.
yesNoCancel(BuildContext context) List<DialogAction<DialogResult>>
Returns a list of DialogAction with returns of type DialogResult.yes, DialogResult.no and DialogResult.cancel to be used in the showBasicDialog method.