Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lanarsinc/top-snackbar-flutter
Modern UI snackbar widget
https://github.com/lanarsinc/top-snackbar-flutter
dart flutter flutter-package ui-challenge ui-components
Last synced: 5 days ago
JSON representation
Modern UI snackbar widget
- Host: GitHub
- URL: https://github.com/lanarsinc/top-snackbar-flutter
- Owner: LanarsInc
- License: other
- Created: 2020-11-28T19:56:51.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T03:39:11.000Z (5 months ago)
- Last Synced: 2025-01-12T11:07:36.751Z (12 days ago)
- Topics: dart, flutter, flutter-package, ui-challenge, ui-components
- Language: Dart
- Homepage:
- Size: 15.3 MB
- Stars: 156
- Watchers: 1
- Forks: 58
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)
Made in [lanars.com](https://lanars.com).
[![pub package](https://img.shields.io/pub/v/top_snackbar_flutter.svg)](https://pub.dev/packages/top_snackbar_flutter)
If you need to show the user some information in a nice way, you can use this package. The API is as simple
as API for regular Material method `showDialog`. If you need to use your own widget to display, you
can pass it into `showTopSnackBar` function.# Getting Started
In order to show a CustomSnackBar you need to call a showTopSnackBar function. You can pass there any widget you want
but we have a CustomSnackBar for example.```dart
showTopSnackBar(
Overlay.of(context),
CustomSnackBar.success(
message:
"Good job, your release is successful. Have a nice day",
),
);
``````dart
showTopSnackBar(
Overlay.of(context),
CustomSnackBar.info(
message:
"There is some information. You need to do something with that",
),
);
``````dart
showTopSnackBar(
Overlay.of(context),
CustomSnackBar.error(
message:
"Something went wrong. Please check your credentials and try again",
),
);
```# Persistent snackbar
There is a usage example demo `example/main.dart`
```dart
AnimationController localAnimationController;
TapBounceContainer(
onTap: () {
showTopSnackBar(
Overlay.of(context),
CustomSnackBar.info(
message: "Persistent SnackBar",
),
persistent: true,
onAnimationControllerInit: (controller) =>
localAnimationController = controller,
);
},
child: buildButton(context, "Show persistent SnackBar"),
),
TapBounceContainer(
onTap: () => localAnimationController.reverse(),
child: buildButton(context, "Dismiss"),
),
```