sileo_flutter

An opinionated toast notification library for Flutter, ported from sileo-vue. Pure Dart/Flutter UI, no platform channels — works on Android, iOS, web, Windows, macOS and Linux.


License
MIT

Documentation

sileo_flutter

An opinionated, highly expressive toast notification library for Flutter.

Credits

sileo_flutter is a native Flutter port of sileo-vue (which was itself an improved fork of Sileo for React). This package reproduces all visual aesthetics, gooey animations, grouping behaviors, promise flows, swipe gestures, and lifecycle hooks as pure Dart/Flutter widgets without platform channels. Works seamlessly on Android, iOS, Web, Windows, macOS, and Linux.


Documentation

Complete usage guides, API tables, styling techniques, and advanced behaviors are documented in the docs directory:

  1. Getting Started: Installation, basic stack mounting, and emitting your first notifications.
  2. API Reference: Complete specifications of sileo methods, SileoOptions, SileoButton, Toaster parameters, and lifecycle context payloads.
  3. Styling and Theming: Custom coloring, colored theme mappings, custom layouts, and corners roundness.
  4. Advanced Features: Details on the GPU-accelerated gooey metaball union, swipe-to-dismiss drag calculations, and persistent hover mechanics.

Quick Start

  1. Mount the Toaster: Add the Toaster widget at the root of your application (usually inside a top-level Stack under MaterialApp):

    import 'package:flutter/material.dart';
    import 'package:sileo_flutter/sileo_flutter.dart';
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: Stack(
              children: [
                const MyMainPage(),
                const Toaster(position: SileoPosition.topRight),
              ],
            ),
          ),
        );
      }
    }
  2. Trigger Notifications: Call sileo methods from anywhere in your codebase without passing a context:

    import 'package:sileo_flutter/sileo_flutter.dart';
    
    void onSave() {
      sileo.success(const SileoOptions(
        title: 'Saved successfully',
        description: 'Your user profile details were written to the cloud.',
      ));
    }
  3. Resolve Futures Inline: Manage asynchronous operation feedback easily with promise:

    await sileo.promise<Profile>(
      () => apiService.fetchProfile(),
      SileoPromiseOptions(
        loading: const SileoOptions(title: 'Loading profile...'),
        success: (profile) => SileoOptions(title: 'Welcome back, ${profile.name}!'),
        error: (error) => SileoOptions(title: 'Failed to load profile', description: '$error'),
      ),
    );

Example Playground

Check out the example/ directory for a fully-featured, interactive playground application. It allows you to trigger all notification states, tweak themes and colors, toggle grouping options, test promise loading, and inspect swipe dismissal parameters in real-time.