JxModal class

A modal dialog built on the native <dialog> element.

It opens and closes without JavaScript, through HTML command buttons: JxModalTrigger opens it, and any button carrying JxModal.closeAttributes closes it. The browser traps the focus inside, closes it with Escape, makes the rest of the page inert and gives the focus back to the trigger on close. With dismissible, a click on the backdrop closes it too.

JxModalTrigger(target: 'delete', [.text('Delete')]),
JxModal(
  id: 'delete',
  title: 'Delete this project?',
  actions: [
    JxButton(variant: JxButtonVariant.ghost,
        attributes: JxModal.closeAttributes('delete'), [.text('Cancel')]),
    JxButton(variant: JxButtonVariant.danger,
        onClick: delete, [.text('Delete')]),
  ],
  [p([.text('This cannot be undone.')])],
)

Constructors

JxModal(List<Component> children, {required String id, required String title, String? description, List<Component>? actions, JxModalSize size = JxModalSize.md, bool dismissible = true, String closeLabel = 'Close', String? classes, Key? key})
const

Properties

actions → List<Component>?
Buttons shown at the bottom, aligned to the end.
final
children → List<Component>
final
classes → String?
final
closeLabel → String
Accessible name of the close button in the corner.
final
description → String?
final
dismissible → bool
Closes on a click outside the dialog (closedby="any").
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Referenced by JxModalTrigger.target.
final
key → Key?
Controls how one component replaces another component in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → JxModalSize
final
title → String
final

Methods

build(BuildContext context) → Component
Describes the part of the user interface represented by this component.
createElement() → Element
Creates a StatelessElement to manage this component's location in the tree.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRebuild(covariant Component newComponent) → bool
Implement this method to determine whether a rebuild can be skipped.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

closeAttributes(String id) → Map<String, String>
Attributes that make a button close the dialog id.