GithubHelp home page GithubHelp logo

thanhchelsea / awesome_snackbar_content Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhmzdev/awesome_snackbar_content

0.0 0.0 1.0 42 KB

A beautiful dart package to uplift your SnackBar experiences in the application

Home Page: https://pub.dev/packages/awesome_snackbar_content

License: MIT License

Dart 100.00%

awesome_snackbar_content's Introduction

A package that lets you uplift your SnackBar or MaterialBanner experience in the app.

๐Ÿ›  Attributes

  • title: Top label that will be shown in the body
  • message: Body message reflecting some error message, success message etc.
  • color: Color of SnackBar body
  • contentType: ContentType class reflecting failure, success, help or warning.
  • inMaterialBanner: Simply configure the working according to showMaterialBanner

Overall Look'n Feel

example.mov

๐Ÿ“ฑ Usage

To use the package:

  • add the dependency to your pubspec.yaml file
dependencies:
  flutter:
      sdk: flutter

  awesome_snackbar_content: <latest-package>

Then import it in your flutter project:

import 'package:awesome_snackbar_content/awesome_snackbar_content.dart';

๐Ÿ‘€ SnackBar Looks

Below are the looks of various types in package used as Snackbar

๐Ÿ”ด Failure

โœ… Success

โ” Help

โš  Warning

๐Ÿ‘€ Material Banner Looks

Below are the looks of various types in package used as Snackbar

๐Ÿ”ด 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: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              child: const Text('Show Awesome SnackBar'),
              onPressed: () {
                final snackBar = SnackBar(
                  /// need to set following properties for best effect of awesome_snackbar_content
                  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!',

                    /// change contentType to ContentType.success, ContentType.warning or ContentType.help for variants
                    contentType: ContentType.failure,
                  ),
                );

                ScaffoldMessenger.of(context)
                  ..hideCurrentSnackBar()
                  ..showSnackBar(snackBar);
              },
            ),
            const SizedBox(height: 10),
            ElevatedButton(
              child: const Text('Show Awesome Material Banner'),
              onPressed: () {
                final materialBanner = MaterialBanner(
                  /// need to set following properties for best effect of awesome_snackbar_content
                  elevation: 0,
                  backgroundColor: Colors.transparent,
                  forceActionsBelow: true,
                  content: AwesomeSnackbarContent(
                    title: 'Oh Hey!!',
                    message:
                        'This is an example error message that will be shown in the body of materialBanner!',

                    /// change contentType to ContentType.success, ContentType.warning or ContentType.help for variants
                    contentType: ContentType.success,
                    // to configure for material banner
                    inMaterialBanner: true,
                  ),
                  actions: const [SizedBox.shrink()],
                );

                ScaffoldMessenger.of(context)
                  ..hideCurrentMaterialBanner()
                  ..showMaterialBanner(materialBanner);
              },
            ),
          ],
        ),
      ),
    );
  }
}

๐Ÿง‘ Credits

This packages has been created in reference to Abu Anwar (GDE Flutter) YouTube video. So, make sure to check his work!

awesome_snackbar_content's People

Contributors

mhmzdev avatar adebayogit avatar johnf17 avatar thanhchelsea avatar sidhu-patil avatar

Forkers

quanbkit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.