https://github.com/deb-sahu/top-snackbar
A lightweight, highly customizable and easy-to-use flutter package tailored for top snackbar notifications.
https://github.com/deb-sahu/top-snackbar
android-flutter dart dart-3 flutter ios-flutter snackbar
Last synced: about 1 month ago
JSON representation
A lightweight, highly customizable and easy-to-use flutter package tailored for top snackbar notifications.
- Host: GitHub
- URL: https://github.com/deb-sahu/top-snackbar
- Owner: deb-sahu
- License: mit
- Created: 2024-04-11T16:38:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T00:58:06.000Z (about 2 years ago)
- Last Synced: 2026-03-21T16:43:53.786Z (2 months ago)
- Topics: android-flutter, dart, dart-3, flutter, ios-flutter, snackbar
- Language: C++
- Homepage: https://pub.dev/packages/top_snackbar
- Size: 296 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Features
- Customizable styles including text, background color, leading icons and more
- Responsive layout design, uses Media Queries to adapt on various screen sizes
- Pre-defined methods for various message types with default styles and icons
- Being an overlay, it doesn't disturb the widget tree or get affected by context change
## Demo

## Usage
### Installation
Add `top_snackbar` to your `pubspec.yaml` file:
```yaml
dependencies:
top_snackbar: ^0.0.6 # Use the latest version
```
### Import
```dart
import 'package:flutter/material.dart';
import 'package:top_snackbar/top_snackbar.dart';
```
### Custom Top Snackbar Widget
To show a custom top snackbar message, use the `CustomTopSnackbar.show` method:
```dart
CustomTopSnackbar.show(
context,
'Your message here',
// Customize more additional properties as required (optional)
leadingIcon: Icons.copy,
backgroundColor: Colors.blue,
);
```
### Pre-defined Message Types
The library provides pre-defined methods for different message types with default styles and icons:
- **Info**: Display an informational message.
```dart
CustomTopSnackbar.showInfo(context, 'Info message');
```
- **Success**: Display a success message.
```dart
CustomTopSnackbar.showSuccess(context, 'Success message');
```
- **Error**: Display an error message.
```dart
CustomTopSnackbar.showError(context, 'Error message');
```
- **Warning**: Display a warning message.
```dart
CustomTopSnackbar.showWarning(context, 'Warning message');
```