awesome_snackbar_content 0.0.4 awesome_snackbar_content: ^0.0.4 copied to clipboard
Uplift your snackbar experience
A package that lets you uplift your SnackBar experience in the app.
🛠 Attributes #
title
: Top label that will be shown in the bodymessage
: Body message reflecting some error message, success message etc.color
: Color of SnackBar bodycontentType
: ContentType class reflecting failure, success, help or warning.
📱 Usage #
To use the package:
- add the dependency to your pubspec.yaml file
dependencies:
flutter:
sdk: flutter
awesome_snackbar_content:
Then import it in your flutter project:
import 'package:awesome_snackbar_content/awesome_snackbar_content.dart';
👀 Looks #
Below are the looks of various types in package
🔴 Failure #
✅ Success #
❔ Help #
⚠ Warning #
💻 Example #
Below is a basic example usage of the awesome_snackbar_content
import 'package:flutter/material.dart';
import 'package:awesome_snackbar_content/awesome_snackbar_content.dart';
class AweseomSnackBarExample extends StatelessWidget {
const AweseomSnackBarExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
child: const Text('Show Awesome SnackBar'),
onPressed: () {
var snackBar = SnackBar(
elevation: 0,
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
content: AwesomeSnackbarContent(
title: 'On Snap!',
message:
'This is an example error message that will be shown in the body of snackbar!',
contentType: ContentType.failure,
),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
),
),
);
}
}
🧑 Credits #
This packages has been created in reference to Abu Anwar (GDE Flutter) YouTube video. So, make sure to check his work!