my_toastify 0.0.1
my_toastify: ^0.0.1 copied to clipboard
A customizable toast notification system for Flutter. Supports banners, snackbars, and advanced styling.
Toastify #
A beautiful, customizable toast notification system for Flutter.
Supports banners, snackbars, custom icons, actions, and multiple stacking positions.
đŧī¸ Demo Preview #
[Toastify Demo]
đ Features #
- Overlay-based toast notifications
- Top or bottom stacking
- Two styles: snackBarStyle & bannerStyle
- Custom icons, actions, and colors
- Auto-dismiss with animation
- Multiple toasts at once
- Swipe-to-dismiss gesture
đĻ Installation #
flutter pub add toastify
đ§ API Reference #
ToastDetails #
| Property | Type | Default | Description |
|---|---|---|---|
message |
String |
â | Message text displayed in toast |
title |
String? |
null |
Optional title above message |
type |
ToastType |
ToastType.info |
Defines color/icon scheme |
position |
ToastPosition |
ToastPosition.bottom |
Where toast appears |
style |
ToastStyle |
ToastStyle.snackBarStyle |
Toast UI layout |
titleTextStyle |
TextStyle? |
Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.white) |
Custom title style |
messageTextStyle |
TextStyle? |
Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.white) |
Custom message style |
leading |
Widget? |
null |
Optional icon widget |
action |
Widget? |
null |
Optional action button |
backgroundColor |
Color? |
null |
Override default color |
borderColor |
Color? |
null |
Adds custom border |
boxShadow |
List<BoxShadow>? |
null |
Shadow customization |
duration |
Duration |
3 seconds |
Auto dismiss time |
đĄ Example Usage #
import 'package:flutter/material.dart';
import 'package:toastify/my_toastify.dart';
void main() {
runApp(const ToastifyDemo());
}
class ToastifyDemo extends StatelessWidget {
const ToastifyDemo({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Toastify Example')),
body: Center(
child: ElevatedButton(
onPressed: () {
Toastify.show(
context: context,
title: 'Success',
message: 'Profile updated successfully!',
type: ToastType.success,
position: ToastPosition.top,
style: ToastStyle.bannerStyle,
);
},
child: const Text('Show Toast'),
),
),
),
);
}
}
âī¸ Advanced Usage Examples #
â With Leading Icon #
Toastify.show(
context: context,
title: 'Upload Complete',
message: 'Your photo has been uploaded successfully.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBarStyle,
leading: const Icon(Icons.check_circle, color: Colors.white),
);
đĢī¸ With Shadow #
Toastify.show(
context: context,
title: 'File Saved',
message: 'Document saved to local storage.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBarStyle,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
);
đĒ With Action Button #
Toastify.show(
context: context,
title: 'Undo Action',
message: 'File deleted successfully.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBarStyle,
action: TextButton(
onPressed: () {
debugPrint('Undo pressed');
},
child: const Text('Undo', style: TextStyle(color: Colors.white)),
),
);
đŦ Without Title #
Toastify.show(
context: context,
message: 'Settings have been updated.',
type: ToastType.info,
position: ToastPosition.bottom,
style: ToastStyle.snackBarStyle,
);
â¤ī¸ Author #
Created by Thant Zin
- GitHub Home: https://github.com/tz-thantzin
- Repository: https://github.com/tz-thantzin/toastify
Copyright (Šī¸) 2025 Thant Zin