toast_widget 0.1.0 copy "toast_widget: ^0.1.0" to clipboard
toast_widget: ^0.1.0 copied to clipboard

discontinued

Shwoing Toast in Flutter Widgets.

Toast Widget #

Why did I create this? #

As you know Flutter does not support Toast by default and Snackbar needs "context" object to show message. That hinders our ability to show a global Toast message from anywhere.

What does it do? #

With toast_widget we can simply call

Toast.show("Hello world");

From anywhere in the app and it will show Toast like shown in the Image Above.

How to use it? #

  1. Add toast_widget to pubspec.yml

    toast_widget: ^0.1

  2. Import Toast Wiget import 'package:toast_widget/toast.dart';

  3. Now wrap your widget inside Toast Widget

    a. Just Wrap any Widget with ToastWidget() like this

     child: ToastWidget(
         child: SettingPage(),
     ),
    

    b. You can also use the extension method .enableToast() on any Widget:

     child: SettingPage().enableToast(),
    
  4. Finally, call Toast.show() from anywhere in the app.

    a. Just Show Text :

     Toast.show("Hello Toast");
    

    b. Show Toast with additional setting:

     Toast.show(
     "Hello Toast",
     mode: ToastMode.INFO,
     duration: Duration(milliseconds: 500)
     );
    

Parameter info :

Mode #

mode:

// ToastMode.INF0 - Green Background
// ToastMode.DEBUG - Blue Background
// ToastMode.ERROR - Red Background

Duration #

duration:

// Give Duration for how long do you want the toast to show and disappear itself.

// User can also click the 'X' icon on the Toast to close.
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Shwoing Toast in Flutter Widgets.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on toast_widget