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.3
// 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,
  );

<br/>

Toasty.showToast() property :

propertydescription
messageString (required)
lengthTOAST_LENGTH.LENGTH_SHORT or TOAST_LENGTH.LENGTH_LONG <br/>(optional but defualt is TOAST_LENGTH.LENGTH_SHORT)
gravityTOAST_GRAVITY.BOTTOM or TOAST_GRAVITY.CENTER or TOAST_GRAVITY.TOP <br/>(optional but defualt is TOAST_GRAVITY.BOTTOM )
fontColorColors.white <br/> (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
backgroundColorColors.grey <br/> (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
fontSize16.0 (double) <br/> (defualt value is 15.0)
timeInSecForIosfor length of toast in iOS (second) (defualt value is 1)

<br/>

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 :

propertydescription
messageString (required)
lengthTOAST_LENGTH.LENGTH_SHORT or TOAST_LENGTH.LENGTH_LONG <br/>(optional but defualt is TOAST_LENGTH.LENGTH_SHORT)
gravityTOAST_GRAVITY.BOTTOM or TOAST_GRAVITY.CENTER or TOAST_GRAVITY.TOP <br/>(optional but defualt is TOAST_GRAVITY.BOTTOM )
fontColorColors.white <br/> (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
fontSize16.0 (double) <br/> (defualt value is 15.0)
iconSizethe size of the icon in toast (double) <br/> (defualt value is 16.0)
iconColorcolor of the icon in toast <br/> (defualt value is Colors.white)

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

<br/>

To cancel all the toasts call

Toasty.cancel()

<br/>

Preview Images

<br/>

Functions

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

Libraries

toasty