Skip to main content
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
iconStacWidgetThe icon to display in the alert dialog.
iconPaddingStacEdgeInsetsThe padding around the icon.
iconColorStacColorThe color of the icon.
titleStacWidgetThe title widget of the alert dialog.
titlePaddingStacEdgeInsetsThe padding around the title.
titleTextStyleStacTextStyleThe text style of the title.
contentStacWidgetThe content widget of the alert dialog.
contentPaddingStacEdgeInsetsThe padding around the content.
contentTextStyleStacTextStyleThe text style of the content.
actionsList<StacWidget>The actions to display in the alert dialog.
actionsPaddingStacEdgeInsetsThe padding around the actions.
actionsAlignmentStacMainAxisAlignmentThe alignment of the actions.
actionsOverflowAlignmentStacOverflowBarAlignmentThe overflow alignment of the actions.
actionsOverflowDirectionStacVerticalDirectionThe overflow direction of the actions.
actionsOverflowButtonSpacingdoubleThe spacing between overflow buttons.
buttonPaddingStacEdgeInsetsThe padding around the buttons.
backgroundColorStacColorThe background color of the alert dialog.
elevationdoubleThe elevation of the alert dialog.
shadowColorStacColorThe shadow color of the alert dialog.
surfaceTintColorStacColorThe surface tint color of the alert dialog.
semanticLabelStringThe semantic label for the alert dialog.
insetPaddingStacEdgeInsetsThe padding around the alert dialog. Defaults to left: 40, right: 40, top: 24, bottom: 24.
clipBehaviorStacClipThe clip behavior of the alert dialog. Defaults to Clip.none.
shapeStacShapeBorderThe shape of the alert dialog.
alignmentStacAlignmentGeometryThe alignment of the alert dialog.
scrollableboolWhether the alert dialog is scrollable. Defaults to false.

Example

StacAlertDialog(
  content: StacPadding(
    padding: StacEdgeInsets(
      top: 0,
      left: 12,
      right: 12,
      bottom: 8,
    ),
    child: StacText(
      data: 'Discard draft?',
      textAlign: StacTextAlign.center,
      style: StacTextStyle(fontSize: 14),
    ),
  ),
  actions: [
    StacTextButton(
      child: StacText(data: 'CANCEL'),
      onPressed: StacNavigateAction(navigationStyle: NavigationStyle.pop),
    ),
    StacSizedBox(width: 8),
    StacTextButton(
      child: StacText(data: 'DISCARD'),
      onPressed: StacNavigateAction(navigationStyle: NavigationStyle.pop),
    ),
    StacSizedBox(width: 12),
  ],
)