Skip to main content
Different from other Neo widgets: Modal is used as a method call (NeoModal.show()) rather than a widget you place in your build tree. Use it for important interactions that require user attention—confirmations, forms, or critical information that must be acknowledged.

Examples

Methods

NeoModal.show()

Displays a modal overlay with customizable content and actions.

Required Parameters

WidgetRef
required
The widget reference from a ConsumerWidget or HookConsumerWidget, used to access the modal provider.
String
required
The title text displayed at the top of the modal.
Widget Function(BuildContext)
required
A builder function that returns the main content of the modal. Use this to create forms, display information, or any custom content.
List<Widget> Function(BuildContext)
required
A builder function that returns a list of action buttons displayed at the bottom of the modal. Typically contains confirm/cancel buttons.

Optional Parameters

bool
default:"true"
Whether users can dismiss the modal by clicking the background or close button. Set to false for critical modals that require explicit user action.
NeoModalSize
default:".small"
The size of the modal. Controls the maximum width.

NeoModal.dismissAll()

Dismisses all currently visible modals.
WidgetRef
required
The widget reference to access the modal provider.

NeoModal.dismissCount()

Dismisses a specific number of modals from the top of the stack.
WidgetRef
required
The widget reference to access the modal provider.
int
required
The number of modals to dismiss from the stack.

Enums

NeoModalSize

Controls the maximum width of the modal.
  • small (400px): Use for a short confirmation.
  • medium (640px): Use for a form.
  • large (896px): Use for long content, such as a detailed form.
  • extraLarge (1536px): Use for wide content, such as a table.
All sizes have a minimum width of 320px and automatically adapt to smaller screen sizes.

Behavior

  • The backdrop blurs the content behind the modal.
  • Modals stack. dismissCount removes that many from the top.
  • Escape dismisses the top modal when it is dismissable.
Last modified on September 30, 2026