Widgets

AlertDialog

AlertDialog

A Material modal dialog for confirmation and information flows.

Example

dialog = nil
dialog = alert_dialog(
  open: false,
  modal: true,
  title: text(value: "Hello"),
  content: text(value: "Hello from Ruflet"),
  actions: [
    text_button(
      content: text(value: "OK"),
      on_click: ->(_e) { page.pop_dialog }
    )
  ]
)

Common properties

  • open
  • modal
  • title
  • content
  • actions
  • icon
  • bgcolor
  • on_dismiss

Usage

Show the dialog with:

page.show_dialog(dialog)

Notes

  • actions takes an array of controls
  • title and content are usually text(...) controls
  • use page.pop_dialog to close the latest open dialog

Complete API

Helpers

  • alert_dialog(**props)
  • alertdialog(**props)

Accepted properties

  • action_button_padding — Action button padding.
  • actions — Controls shown in the trailing action area.
  • actions_alignment — Actions alignment.
  • actions_overflow_button_spacing — Sets the actions overflow button spacing property.
  • actions_padding — Actions padding.
  • adaptive — Adapts to the platform (Material/Cupertino) when true.
  • alignment — Alignment of the content within the control.
  • badge — Badge drawn on the corner of the control.
  • barrier_color — Barrier color.
  • bgcolor — Background color.
  • clip_behavior — How content overflowing the bounds is clipped.
  • col — Responsive column span (1-12) per breakpoint.
  • content — The single child control rendered inside this control.
  • content_padding — Content padding.
  • content_text_style — Content text style.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • disabled — Disables interaction when true.
  • elevation — Shadow depth (z-height).
  • expand — Fills the available space along the parent's main axis when true.
  • expand_loose — Like expand, but only grows up to the child's natural size.
  • icon — Icon name shown by the control.
  • icon_color — Color of the icon.
  • icon_padding — Icon padding.
  • inset_padding — Inset padding.
  • key — Stable identity used to preserve state across rebuilds.
  • modal — Sets the modal property.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • open — Whether the control (dialog/sheet/menu) is open.
  • rtl — Renders right-to-left when true.
  • scrollable — Sets the scrollable property.
  • semantics_label — Sets the semantics label property.
  • shadow_color — Color of the drop shadow.
  • shape — Shape/border of the control.
  • title — The control shown as the title.
  • title_padding — Title padding.
  • title_text_style — Title text style.
  • tooltip — Text shown on hover/long-press.
  • visible — Hides the control when false.

Events

  • on_dismiss — Fired when the control is dismissed.

Wire reference

  • Family: materials
  • Widget type: alertdialog