status_snackbar 1.0.0
status_snackbar: ^1.0.0 copied to clipboard
Beautiful, customizable snackbars with multiple states (success, error, warning, info). Supports dark mode, subtitles, and easy BuildContext extensions.
Status Snackbar #
Beautiful, customizable snackbars with multiple states for Flutter. Supports success, error, warning, and info states with automatic dark mode support.
Features #
- 4 built-in states: Success, Error, Warning, Info
- Automatic dark mode support
- Optional subtitle for additional details
- Close button to dismiss
- Context extension for easy access
- Customizable duration
- Beautiful, modern design
Preview #
| Light Mode | Dark Mode |
|---|---|
| Success (green) | Success (dark green) |
| Error (red) | Error (dark red) |
| Warning (amber) | Warning (dark amber) |
| Info (blue) | Info (dark blue) |
Installation #
Add this to your pubspec.yaml:
dependencies:
status_snackbar: ^1.0.0
Then run:
flutter pub get
Usage #
Import #
import 'package:status_snackbar/status_snackbar.dart';
Using Static Methods #
// Success snackbar
StatusSnackbar.showSuccess(context, 'Saved successfully!');
// Error snackbar
StatusSnackbar.showError(context, 'Something went wrong');
// Warning snackbar
StatusSnackbar.showWarning(context, 'Please check your input');
// Info snackbar
StatusSnackbar.showInfo(context, 'New update available');
Using Context Extension #
// Success
context.showSuccessSnackbar('Done!');
// Error with subtitle
context.showErrorSnackbar(
'Failed to save',
subTitle: 'Please check your connection',
);
// Warning
context.showWarningSnackbar('Low battery');
// Info
context.showInfoSnackbar('Syncing...');
With Subtitle #
StatusSnackbar.showError(
context,
'Upload failed',
subTitle: 'File size exceeds 10MB limit',
);
Custom Duration #
StatusSnackbar.showSuccess(
context,
'Auto-saving...',
durationSeconds: 5,
);
Generic Show Method #
StatusSnackbar.show(
context,
'Custom message',
SnackbarState.info,
subTitle: 'Additional details',
durationSeconds: 4,
);
Customization #
The package uses predefined color schemes that automatically adapt to light/dark themes:
| State | Light Background | Dark Background | Icon |
|---|---|---|---|
| Success | Green 100 | Green 900 | check_circle |
| Error | Red 100 | Red 900 | error |
| Warning | Amber 100 | Amber 900 | warning |
| Info | Blue 100 | Blue 900 | info |
Example #
See the example folder for a complete example app.
import 'package:flutter/material.dart';
import 'package:status_snackbar/status_snackbar.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
context.showSuccessSnackbar('Hello, World!');
},
child: const Text('Show Snackbar'),
),
),
),
);
}
}
License #
MIT License - see the LICENSE file for details.
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
Author #
Made with love by Aravinthkannan2002