flutter_toast_plus 2.0.0 copy "flutter_toast_plus: ^2.0.0" to clipboard
flutter_toast_plus: ^2.0.0 copied to clipboard

A highly customizable Flutter toast package that provides various types of toast notifications with beautiful animations and styles.

Flutter Toast #

pub package likes popularity pub points

A highly customizable Flutter toast package that provides various types of toast notifications with beautiful animations and styles.

Features #

  • 🎨 Multiple toast types (normal, success, error, warning, info)
  • 📍 Flexible positioning (top, bottom, center, corners)
  • ⚡ Smooth animations
  • 🎯 Progress indicator support
  • 🎭 Fully customizable styles
  • 🔄 Auto-dismiss with customizable duration
  • 📱 Safe area aware
  • 🔍 Maximum toast limit to prevent screen cluttering

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_toast_plus: ^1.0.0

Usage #

First, initialize the toast service in your app's root widget:

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) {
          ToastService.init(context);
          return MyHomePage();
        },
      ),
    );
  }
}

Basic Usage #

// Show a normal toast
ToastService.show(message: 'Hello World!');

// Show a success toast
ToastService.success('Operation completed successfully!');

// Show an error toast
ToastService.error('Something went wrong!');

// Show a warning toast
ToastService.warning('Please be careful!');

// Show an info toast
ToastService.info('Here is some information.');

Customizing Position #

ToastService.show(
  message: 'Custom position toast!',
  position: ToastPosition.topRight,
);

Custom Styling #

final customStyle = ToastStyle(
  backgroundColor: Colors.purple,
  textColor: Colors.white,
  icon: Icons.star,
  iconColor: Colors.yellow,
  borderRadius: 12.0,
  padding: EdgeInsets.all(16.0),
  duration: Duration(seconds: 5),
  showProgressIndicator: true,
);

ToastService.show(
  message: 'Customized toast!',
  style: customStyle,
);

Toast Types #

  • ToastType.normal - Default toast with neutral styling
  • ToastType.success - Green toast with check icon
  • ToastType.error - Red toast with error icon
  • ToastType.warning - Orange toast with warning icon
  • ToastType.info - Blue toast with info icon
  • ToastType.custom - Custom styled toast

Toast Positions #

  • ToastPosition.top
  • ToastPosition.center
  • ToastPosition.bottom
  • ToastPosition.topLeft
  • ToastPosition.topRight
  • ToastPosition.bottomLeft
  • ToastPosition.bottomRight

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
160
points
124
downloads

Publisher

verified publishertherohitsoni.in

Weekly Downloads

A highly customizable Flutter toast package that provides various types of toast notifications with beautiful animations and styles.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_toast_plus