components/alerts/flutstrap_alert library Components

Flutstrap Alert

A high-performance, flexible alert component for displaying contextual feedback messages with comprehensive theming and animation support.

Usage Examples

// Basic alert with auto-dismiss
FlutstrapAlert.success(
  message: 'Operation completed successfully!',
  autoDismissDuration: Duration(seconds: 5),
)

// Error alert with custom title
FlutstrapAlert.error(
  title: 'Upload Failed',
  message: 'Please check your connection and try again.',
  dismissible: true,
)

// Custom alert with action button
FlutstrapAlert(
  variant: FSAlertVariant.warning,
  message: 'Your session will expire soon.',
  trailing: FlutstrapButton(
    onPressed: extendSession,
    child: Text('Extend'),
  ),
)

Accessibility

  • Uses Semantics widget with live region for screen readers
  • Provides proper semantic labels for alert content and type
  • Supports keyboard navigation and screen reader announcements
  • Follows WCAG contrast guidelines

Usage Examples

// Basic alert with auto-dismiss
FlutstrapAlert.success(
  message: 'Operation completed successfully!',
  autoDismissDuration: Duration(seconds: 5),
)

// Error alert with custom title
FlutstrapAlert.error(
  title: 'Upload Failed',
  message: 'Please check your connection and try again.',
  dismissible: true,
)

// Custom alert with action button
FlutstrapAlert(
  variant: FSAlertVariant.warning,
  message: 'Your session will expire soon.',
  trailing: FlutstrapButton(
    onPressed: extendSession,
    child: Text('Extend'),
  ),
)

Accessibility

  • Uses Semantics widget with live region for screen readers
  • Provides proper semantic labels for alert content and type
  • Supports keyboard navigation and screen reader announcements
  • Follows WCAG contrast guidelines

Classes

FlutstrapAlert
Flutstrap Alert Component

Enums

FSAlertVariant
Flutstrap Alert Variants