Skip to main content

AlertDialog

The Stac AlertDialog allows you to build a Flutter alert dialog widget using JSON. To know more about the alert dialog widget in Flutter, refer to the official documentation.

Properties​

PropertyTypeDescription
iconMap<String, dynamic>?The icon to display in the alert dialog.
iconPaddingStacEdgeInsets?The padding around the icon.
iconColorString?The color of the icon.
titleMap<String, dynamic>?The title widget of the alert dialog.
titlePaddingStacEdgeInsets?The padding around the title.
titleTextStyleStacTextStyle?The text style of the title.
contentMap<String, dynamic>?The content widget of the alert dialog.
contentPaddingStacEdgeInsets?The padding around the content.
contentTextStyleStacTextStyle?The text style of the content.
actionsList<Map<String, dynamic>>?The actions to display in the alert dialog.
actionsPaddingStacEdgeInsets?The padding around the actions.
actionsAlignmentMainAxisAlignment?The alignment of the actions.
actionsOverflowAlignmentOverflowBarAlignment?The overflow alignment of the actions.
actionsOverflowDirectionVerticalDirection?The overflow direction of the actions.
actionsOverflowButtonSpacingdouble?The spacing between overflow buttons.
buttonPaddingStacEdgeInsets?The padding around the buttons.
backgroundColorString?The background color of the alert dialog.
elevationdouble?The elevation of the alert dialog.
shadowColorString?The shadow color of the alert dialog.
surfaceTintColorString?The surface tint color of the alert dialog.
semanticLabelString?The semantic label for the alert dialog.
insetPaddingStacEdgeInsetsThe padding around the alert dialog. Defaults to left: 40, right: 40, top: 24, bottom: 24.
clipBehaviorClipThe clip behavior of the alert dialog. Defaults to Clip.none.
shapeStacShapeBorder?The shape of the alert dialog.
alignmentStacAlignmentGeometry?The alignment of the alert dialog.
scrollableboolWhether the alert dialog is scrollable. Defaults to false.

Example JSON​

{
"type": "alertDialog",
"content": {
"type": "padding",
"padding": {
"top": 0,
"left": 12,
"right": 12,
"bottom": 8
},
"child": {
"type": "text",
"data": "Discard draft?",
"align": "center",
"style": {
"fontSize": 14
}
}
},
"actions": [
{
"type": "textButton",
"child": {
"type": "text",
"data": "CANCEL"
},
"onPressed": {
"actionType": "navigate",
"navigationStyle": "pop"
}
},
{
"type": "sizedBox",
"width": 8
},
{
"type": "textButton",
"child": {
"type": "text",
"data": "DISCARD"
},
"onPressed": {
"actionType": "navigate",
"navigationStyle": "pop"
}
},
{
"type": "sizedBox",
"width": 12
}
]
}