Giter VIP home page Giter VIP logo

top-snackbar-flutter's People

Contributors

anisalibegic avatar benyaminbeyzaie avatar gsrocks-lanars avatar oleksii-podolian-lanars avatar sviatmaniuk avatar thefreal avatar vizhan-lanars avatar yuriy-trofimov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

top-snackbar-flutter's Issues

[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

Flutter 2.0.1 compatibility

Got this build error message in one of my apps: "since your app depends on both one_context ^0.5.0 and shared_preferences ^2.0.3, version solving failed". Using older versions of shared_preferences will also result in a "version solving problem" with the other packages.

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.

[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

Support to scaffoldMessengerKey to show snackbar without context.

Is there any way of call top-snackbar-flutter using a GlobalKey for scaffoldMessengerKey?

We have a specific use case in which we don't have access to context, but we do have a instance of scaffoldMessengerKey, I have tried this without success:

    showTopSnackBar(
      scaffoldMessageKey.currentContext!,
      ToastBody(
         ...
      ),
      padding: EdgeInsets.zero,
    );

Is there any way of using top-snack-bar without BuildContext directly?

Gradient background

Very useful package!
Please add a feature to gradient background (like in Container widget)

Tnx!

Can we set a position?

The snackbar appears at the top. Is it possible to center the snackbar or show it at the bottom?

How to Set Max Width Top Snackbar

This package is super-nice. Thank you!

I've noticed that when using showTopSnackBar that it always fills the width of app window when it's displayed. This is fine on a phone, but it's pretty wide on tablets and desktop.

I am passing my own custom widget into the snackbar, but I can't find a way to set a maximum width. I've tried hard-coding the width on the container and also setting a maxWidth using BoxContraints without any luck.

Is it possible to set a max width on this somehow?

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

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.

onTap doesn't work when using onSwipe

I want to let the user to select to tap on the snackBar to go to the main screen, or just dismiss it by swipe, but it doesn't work, the onTap function is working only if i'm not using DismissType.onSwipe

showTopSnackBar(
Overlay.of(context),
Container(child: Text('Text')),
curve: Curves.fastLinearToSlowEaseIn,
dismissDirection: [DismissDirection.up, DismissDirection.horizontal],
dismissType: DismissType.onSwipe, <----------------- when comment it, the goToMainScreen() is working
onTap: () => goToMainScreen(context),
);

Bounce

Hi! Is there an easy way to disable bounce? I would prefer to have a smooth entry and exit of the notification instead of a bounce.

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",
),
);
});

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

All icons are rotated by 32 degrees.

All icons are rotated by 32 degrees, even ones passed as parameters, here.

I think a better feature would be either rotating only default icons, or being able to specify the rotation degree.

Resize element

There's a way to resize (heigh) of this top snack bar?, i think it's to large. I may be a bit shorter should be more pretty.

There's not contributing guideline file?

overwrites

snackbars get overwritten by newer ones
Thanks

message testStyle doesn't work

Доброго ранку

I set the text style in the parameters, but it ignores, in particular, I can’t change the color of the text

Overlay.of(context),
CustomSnackBar.info(
borderRadius: CustomRadius.radius(20),
message: text.isEmpty
? L10n.of(context).error
: '${L10n.of(context).error} $text',
textStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
fontWeight: FontWeight.w400,
color: ColorName.white,
height: 16,
),
icon: SizedBox(),

  Thanks in advance, Перемога за Украиной

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?

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.