Toast constructor

Toast({
  1. required String title,
  2. String? message,
  3. Tone tone = Tone.info,
  4. Object? action,
  5. String? className,
  6. Map<String, Object?> props = const {},
  7. Map<String, Object?> style = const {},
  8. DartStyle? dartStyle,
})

Creates a toast notification.

Implementation

Toast({
  required String title,
  String? message,
  Tone tone = Tone.info,
  Object? action,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
}) : super(
       'div',
       props: mergeComponentProps(
         {...props, 'role': props['role'] ?? 'status'},
         className: className,
         defaultStyle: {
           'display': 'grid',
           'gap': '6px',
           'min-width': '280px',
           'border': '1px solid ${toneBorder(tone)}',
           'border-radius': '8px',
           'padding': '12px',
           'background': '#ffffff',
           'color': toneText(tone),
           'box-shadow': '0 12px 24px rgba(16, 24, 40, 0.14)',
         },
         dartStyle: dartStyle,
         style: style,
       ),
       children: [
         FlintElement('strong', children: normalizeChildren(title, const [])),
         if (message != null)
           FlintElement('p', children: normalizeChildren(message, const [])),
         if (action != null) toFlintNode(action),
       ],
     );