Toast Service A beautiful and customizable toast notification service for Flutter applications. Features
🎨 Highly customizable toast notifications 🔄 Multiple toast types (success, error, warning, message) 🎯 Simple API for displaying toasts 💫 Elegant animations and design 🧩 Easy integration
Installation Add this to your package's pubspec.yaml file: yamlCopydependencies: toast_service: ^0.0.1 Then run: Copyflutter pub get Usage Initialize the service First, initialize the toast service with your app's navigator key: dartCopyimport 'package:flutter/material.dart'; import 'package:toast_service/toast_service.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { // Create a navigation key final GlobalKey
// Initialize the toast service
ToastService.init(navigatorKey);
return MaterialApp(
navigatorKey: navigatorKey,
// Rest of your app...
);
} } Display a toast dartCopy// Success toast ToastService.success('Success', 'Your operation completed successfully!');
// Error toast ToastService.error('Error', 'Something went wrong. Please try again.');
// Warning toast ToastService.warning('Warning', 'Please check your input and try again.');
// Information message ToastService.message('Message', 'This is an information message.'); Customization You can also use the showToast method for full customization: dartCopyToastService.showToast( title: 'Custom Toast', message: 'This is a fully customized toast message', backgroundColor: Colors.purple, textColor: Colors.white, bubbleColor: Colors.deepPurple, leadingIcon: 'path/to/your/icon.svg', trailingIcon: 'path/to/close/icon.svg', duration: Duration(seconds: 5), ); Additional Information For custom SVG icons, make sure to add them to your assets and declare them in your pubspec.yaml file. License This project is licensed under the MIT License - see the LICENSE file for details.