Alert constructor

Alert({
  1. String? title,
  2. String? message,
  3. Object? child,
  4. List<Object?> children = const [],
  5. Object? actions,
  6. String? className,
  7. Map<String, Object?> props = const {},
  8. Map<String, Object?> style = const {},
  9. DartStyle? dartStyle,
  10. Tone tone = Tone.info,
})

Creates an alert with optional title, message, content, and actions.

Implementation

Alert({
  String? title,
  String? message,
  Object? child,
  List<Object?> children = const [],
  Object? actions,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  Tone tone = Tone.info,
}) : super(
       'div',
       props: mergeComponentProps(
         {...props, 'role': props['role'] ?? 'alert'},
         className: className,
         defaultStyle: {
           'display': 'grid',
           'gap': '6px',
           'border': '1px solid ${toneBorder(tone)}',
           'border-radius': '8px',
           'padding': '12px 14px',
           'background': toneSoft(tone),
           'color': toneText(tone),
         },
         dartStyle: dartStyle,
         style: style,
       ),
       children: [
         if (title != null)
           FlintElement(
             'strong',
             props: const {
               'style': {'font-weight': 700},
             },
             children: normalizeChildren(title, const []),
           ),
         if (message != null)
           FlintElement(
             'p',
             props: const {
               'style': {'margin': 0},
             },
             children: normalizeChildren(message, const []),
           ),
         ...normalizeChildren(child, children),
         if (actions != null) toFlintNode(actions),
       ],
     );