toasty

a flutter package for show toast


License
MIT

Documentation

toasty

pub package

A Flutter Library For Show Toast In Android And Ios

Supported Platforms

  • Android
  • IOS

How Use Toasty

# add the below line to your pubspec.yaml dependencies
toasty: 0.0.1
// add the below line in your dart code
import 'package:toasty/toasty.dart';
Toasty.showToast(
    message: 'this is a message',
    length: TOAST_LENGTH.LENGTH_SHORT,
    gravity: TOAST_GRAVITY.BOTTOM,
    fontColor: Colors.white,
    backgroundColor: Colors.grey.shade300,
    fontSize: 15,
  );

Toasty.showToast() property :

property description
message String (required)
length TOAST_LENGTH.LENGTH_SHORT or TOAST_LENGTH.LENGTH_LONG
(optional but defualt is TOAST_LENGTH.LENGTH_SHORT)
gravity TOAST_GRAVITY.BOTTOM or TOAST_GRAVITY.CENTER or TOAST_GRAVITY.TOP
(optional but defualt is TOAST_GRAVITY.BOTTOM )
fontColor Colors.white
(if passing null to fontColor if your device is iOs defualt fontColor is White but if your device is Android your defualt fontColor is Black
backgroundColor Colors.grey
(if passing null to backgroundColor if your device is iOs defualt backgroundColor is Colors.black.withOpacity(0.9) but if your device is Android your defualt backgroundColor is Colors.grey.shade300
fontSize 16.0 (double)
(defualt value is 15.0)
timeInSecForIos for length of toast in iOS (second) (defualt value is 1)

if you want to use show success message you can use Toasty.successToast() this function show a green toast with a success icon in left of the text and for error and warning also you can use Toasty.errorToast() and Toasty.warningToast().

Toasty.successToast() property :

property description
message String (required)
length TOAST_LENGTH.LENGTH_SHORT or TOAST_LENGTH.LENGTH_LONG
(optional but defualt is TOAST_LENGTH.LENGTH_SHORT)
gravity TOAST_GRAVITY.BOTTOM or TOAST_GRAVITY.CENTER or TOAST_GRAVITY.TOP
(optional but defualt is TOAST_GRAVITY.BOTTOM )
fontColor Colors.white
(if passing null to fontColor if your device is iOs defualt fontColor is White but if your device is Android your defualt fontColor is Black
fontSize 16.0 (double)
(defualt value is 15.0)
iconSize the size of the icon in toast (double)
(defualt value is 16.0)
iconColor color of the icon in toast
(defualt value is Colors.white)

this properties also use for Toasty.errorToast() and Toasty.warningToast()


To cancel all the toasts call

Toasty.cancel()

Preview Images


Functions

Future<void> cancel();
Future<void> showToast();
Future<void> successToast();
Future<void> errorToast();
Future<void> warningToast();