top-snackbar-flutter - Modern UI snackbar widget

Overview

top-snackbar-flutter

Made in lanars.com.

pub package

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.

showTopSnackBar(
    context,
    CustomSnackBar.success(
      message:
          "Good job, your release is successful. Have a nice day",
    ),
);
showTopSnackBar(
    context,
    CustomSnackBar.info(
      message:
          "There is some information. You need to do something with that",
    ),
);
showTopSnackBar(
    context,
    CustomSnackBar.error(
      message:
          "Something went wrong. Please check your credentials and try again",
    ),
);
Comments
  • Simplify snackbar removal and adjust dismissable behaviour

    Simplify snackbar removal and adjust dismissable behaviour

    Closes #35

    Independent removal of snackbars helps when they are not being removed and stuck on app bar. Also Dismissable widget should start an animation, but just straight dismiss snack bar.

    opened by vikmind 3
  • [Feature request] Persisting snackbar

    [Feature request] Persisting snackbar

    I really liked the package (compared with showing Android styled snack bar)

    I have a use case to show persisting messages until removed manually, something like "No internet connection" I want to keep the snack bar showing until the network state change.

    What I tried:-

    1. I was able to change the displayDuration to const Duration(days: 365) which seems fine till now
    2. I was not able to override the default dismiss on click, where I want the snack bar to not be dismissible (even with adding my own onTap it is still dismissible with user clicks)
    3. I was not able to dismiss the widget programmatically after showing it (this may be related to #16)

    Based on the use case above, I believe these features will most likely resolve it:-

    • Add bool isInfiniteDuration which default to false; However, when set to true it disables the dismiss completely.
    • Add bool isDismissible which default to true; However, when set to true the user clicks won't dismiss the snack bar
    • (I'm not sure if this is the best approach) Return the TopSnackBar widget with the showTopSnackBar and expose a public method to dismiss the widget
    enhancement help wanted 
    opened by a7md0 3
  • Snackbar stuck on status bar android

    Snackbar stuck on status bar android

    After dismiss snackbar stuck on statusbar android. Im using ModalProgressHud In my condition, a modal progress show up and close after that modal close then calling showSnackbar and snackbar dismiss but stuck on statusbar. if not using modalHud no problem, carbon

    Note im using newest version 2.1.1

    bug 
    opened by hpi-rifal 2
  • Can we shrink snackbar to wrap its content or to some custom width?

    Can we shrink snackbar to wrap its content or to some custom width?

    I want the snackbar to be placed on top center of my application and not to expand through screen width. I tried wrapping my custom snackbar with a Row widget but it throws bunch of following exceptions:

    Assertion failed:
    !_debugDuringDeviceUpdate
    is not true
    
    opened by rasitayaz 2
  • Fix dismissed widget and add text align

    Fix dismissed widget and add text align

    • Fix issue related to dismiss top snake bar. When user dismiss the snake bar and immediately navigate to another pages, it's show up snake bar for very short time.

    • Add text align

    opened by ayoubrajabi 1
  • [Feature] Enable multi direction swipe dismissible SnackBar

    [Feature] Enable multi direction swipe dismissible SnackBar

    Change parameter from dismissDirection to dismissDirections with default value is [DismissDirection.up]

    This PR will allow dismissing snack-bar with a multi-direction swipe.

    Demo:

    https://user-images.githubusercontent.com/17402674/183585800-e5c2e033-c614-45f2-a803-197aed96848c.mov

    opened by mofadillah 1
  • New swipe to dismiss action

    New swipe to dismiss action

    New dismissType and dismissDirection parameters

    This PR Allow to dismiss the snackbar throughout swipe action. (similar to push notification).

    User can still choose the dismiss behavior (TopSnackBarDismissType.onTap like now, TopSnackBarDismissType.onSwipe or TopSnackBarDismissType.none)

    I updated the example.

    | DismissDirection.up | DismissDirection.endToStart | | -------------------- | ---------------------------- | | https://user-images.githubusercontent.com/22376981/176822421-631ccb37-5e63-4d55-9402-53547dca4f93.MP4 | https://user-images.githubusercontent.com/22376981/176822453-3fd4749c-bb79-4452-a27b-1e122f164460.MP4 |

    opened by LeGoffMael 1
  • how to set duration for showTopSnackBar

    how to set duration for showTopSnackBar

    I encountered a bug while using the feature: if I force too many notifications to appear on the screen, the shadows leave a blurry smear on the top screen, which doesn't disappear. I thought about decreasing the display time of this notification, but the property not found in the plugin.

    opened by kleber-rr 1
  • [bug] bug on text default style

    [bug] bug on text default style

    Code

    import 'package:flutter/material.dart';
    import 'package:top_snackbar_flutter/top_snack_bar.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Builder(builder: (context) {
            return Scaffold(
              body: Center(
                child: TextButton(
                  onPressed: () => showTopSnackBar(
                    context,
                    Container(
                      width: double.infinity,
                      margin: const EdgeInsets.only(top: 47),
                      height: 41,
                      padding: const EdgeInsets.all(12),
                      decoration: BoxDecoration(
                        color: const Color(0xffFF277F),
                        borderRadius: BorderRadius.circular(8),
                      ),
                      child: const Text(
                        'Testing testing testing',
                        // minFontSize: 10,
                        maxLines: 1,
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 14,
                          height: 17 / 14,
                          fontWeight: FontWeight.w500,
                        ),
                      ),
                    ),
                    displayDuration: const Duration(seconds: 10000),
                  ),
                  child: const Text('click'),
                ),
              ),
            );
          }),
        );
      }
    }
    

    image

    image

    There are underlines on text. And, font family works wrong too, even if I've set default font family on MaterialApp. So, I need to override every text style to show properly.

    flutter doctor -v

    [✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
        en-KR)
        • Flutter version 2.8.1 at /Users/suhwancha/development/GitHub/flutter
        • Upstream repository [email protected]:SuhwanCha/flutter.git
        • Framework revision 77d935af4d (2 weeks ago), 2021-12-16 08:37:33 -0800
        • Engine revision 890a5fca2e
        • Dart version 2.15.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
        • Android SDK at /Users/suhwancha/Library/Android/sdk
        • Platform android-32, build-tools 32.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2020.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (2 available)
        • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12
          (API 31) (emulator)
        • Chrome (web)                • chrome        • web-javascript • Google
          Chrome 96.0.4664.110
    
    opened by SuhwanCha 1
  • Call

    Call "close/remove/dismiss" method from outside?

    I have a message for the user: "You can't select more. Edit your current selections OR tap on the 'Next' button." When I click on the next button, I would like to "force remove"/"force start the reverse animation" of the active message because it is not actual anymore.

    Is there any way to do this?

    opened by fchris82 1
  • Timer.periodic not work

    Timer.periodic not work

    new Timer.periodic(Duration(milliseconds: 10000), (timer) { showTopSnackBar( context, CustomSnackBar.info( message: "There is some information. You need to do something with that", ), ); });

    opened by frankcheng2020 1
  • type 'StatelessObserverElement' is not a subtype of type 'OverlayState'

    type 'StatelessObserverElement' is not a subtype of type 'OverlayState'

    I understand that version 3 has a breaking change, "Remove BuildContext in favor of OverlayState", but how to migrate from existing code? showTopSnackBar() now throws type 'StatelessObserverElement' is not a subtype of type 'OverlayState' in the console.

    opened by wiradikusuma 0
  • Limit height of showTopSnackBar

    Limit height of showTopSnackBar

    Dear, Currently the height of showTopSnackBar is fixed by 80, in my case the content is overflow that height. Could you change the height of showTopSnackBar, I think the minimum height of showTopSnackBar is 80, maximum is unlimit.

    Thank you so much

    opened by LoiNH 0
  • OverlayState should be nullable

    OverlayState should be nullable

    When using sdk >= 2.12.0 Overlay.of(context) can return null.

    You can check it by changing the sdk in the example.

    environment:
      sdk: ">=2.12.0 <3.0.0"
    

    This PR makes showTopSnackBar accept a nullable OverlayState argument and handle the logic internally. If it is null the TopSnackbar won't be displayed but there is no error nor exception

    opened by LeGoffMael 0
  • Update examples in README

    Update examples in README

    The first example is:

    showTopSnackBar(
        context,
        CustomSnackBar.success(
          message:
              "Good job, your release is successful. Have a nice day",
        ),
    );
    

    This does not build because the first argument requires OverlayState instead of BuildContext. Other examples should be updated too.

    documentation 
    opened by alexeyinkin 7
  • Verify publisher

    Verify publisher

    Currently pub.dev shows "Unverified publisher" for this package:

    image

    If we use this package, it makes code reviews harder in our company. Can you please verify your publishing account to show your domain name like this?

    image

    Here is how to do this: https://dart.dev/tools/pub/verified-publishers

    documentation 
    opened by alexeyinkin 0
Owner
null
Crypto Trading UI - A Crypto Trading App with a modern UI using the latest features offered by Flutter

Crypto Trading UI This project is all about designing a Crypto Trading App with a modern UI using the latest features offered by Flutter. In a total o

DebugErrorX 7 Dec 28, 2022
modern e-commerce store built in flutter with help of GetX.

Shoe Commerce Modern looking shoe store app built in flutter and help of GetX :) Design source: https://www.figma.com/community/file/11473970061435204

ƳƠƲƧƠƑ 6 Nov 24, 2022
DirectSelect is a selection widget with an ethereal, full-screen modal popup displaying the available choices when the widget is interact with. https://dribbble.com/shots/3876250-DirectSelect-Dropdown-ux

direct-select-flutter DirectSelect is a selection widget with an ethereal, full-screen modal popup displaying the available choices when the widget is

null 582 Jan 4, 2023
A simple animated radial menu widget for Flutter.

flutter_radial_menu A radial menu widget for Flutter. . Installation Install the latest version from pub. Quick Start Import the package, create a Rad

Victor Choueiri 434 Jan 7, 2023
Custom widget for Flutter

Flushbar Use this package if you need more customization when notifying your user. For Android developers, it is made to substitute toasts and snackba

Andre Haueisen 899 Dec 30, 2022
flutter stepper_touch widget

stepper_touch the concept of the widget inspired from Nikolay Kuchkarov. i extended the functionality to be more useful in real world applications Tha

Raouf Rahiche 271 Dec 30, 2022
A TypeAhead widget for Flutter, where you can show suggestions to users as they type

Flutter TypeAhead A TypeAhead (autocomplete) widget for Flutter, where you can show suggestions to users as they type Features Shows suggestions in an

null 661 Jan 5, 2023
A highly customisable Flutter widget for entering pin code. Suitable for use cases such as login and OTP.

pin_code_text_field It's a beautiful and highly customizable Flutter widget for entering pin code. Suitable for use cases such as login and OTP. Usage

Liew Jun Tung 309 Dec 28, 2022
Flutter FoldingCell widget

Simple FoldingCell widget Simple folding cell widget, pass frontWidget and innerWidget to fold and unfold. Installation Add dependency in pubspec.yaml

Farrukh 513 Dec 30, 2022
A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.

emoji_picker_flutter Yet another Emoji Picker for Flutter ?? Note: This package is based on emoji_picker which has been deprecated and not maintained

Stefan Humm 99 Dec 24, 2022
A Flutter Widget Approach for using HTML tags & CSS styles in your upcoming Apps.

html_widgets A Flutter Widget Approach for using HTML tags & CSS styles in your upcoming Apps. Text Widgets *text property is required for all the tex

XenonLabz 7 Jul 14, 2022
Flutter widget with pond ripple effect!

Ripple pond effect This project contains Ripple pond effect widget. It makes wave when you click on it! There is still many things to improve in this

null 24 Dec 19, 2021
A flutter widget where a card is expanded ontap.

Expansion card This package provides an easy implementation of a Expansion type card where you can also add gif at the background. How to use import '

null 127 Dec 6, 2022
Scratch card widget which temporarily hides content from user.

scratcher Scratch card widget which temporarily hides content from user. Features Android and iOS support Cover content with full color or custom imag

Kamil Rykowski 405 Dec 27, 2022
A simple widget for animating a set of images with full custom controls as an alternative to using a GIF file.

image_sequence_animator A simple widget for animating a set of images with full custom controls as an alternative to using a GIF file. If you have a G

AliYigitBireroglu 134 Dec 22, 2022
Animated Selection Slide Sezgin BilgetayAnimated Selection Slide An animated selection widget by swiping by Sezgin Bilgetay.

Animated Selection Slide This flutter project allows you to make your choices with animation in inbox. For UI, it's inspired by the great example on d

null 340 Jan 7, 2023
A Very Good Infinite List Widget created by Very Good Ventures. Great for activity feeds, news feeds, etc. 🦄

InfiniteList comes in handy when building features like activity feeds, news feeds, or anywhere else where you need to lazily fetch and render content for users to consume.

Very Good Open Source 102 Dec 12, 2022
Allows widgets to be zoomed in and out by inserting a OverlayEntry which allows the widget to be on the front at all times.

zoom_pinch_overlay An instagram style pinch and zoom widget for all platform completely written in pure dart! All other "zoom_pinch" package doesnt di

Samuel 18 Nov 29, 2022
A customizable shadow for any widget

simple_shadow A customizable shadow for any widget Getting Started import: import 'package:simple_shadow/simple_shadow.dart'; example: SimpleShadow(

Marcelo Pinheiro Montanher 27 Nov 23, 2022