fluttertoast 4.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 99

fluttertoast #

Android and iOS Toast Library for Flutter

Supported Platforms

If you dont want to use androidx then use fluttertoast version 2.2.11

How to Use #

# add this line to your dependencies
fluttertoast: ^4.0.0
import 'package:fluttertoast/fluttertoast.dart';
Fluttertoast.showToast(
        msg: "This is Center Short Toast",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0
    );
propertydescriptiondefault
msgString (Not Null)(required)required
toastLengthToast.LENGTH_SHORT or Toast.LENGTH_LONG (optional)Toast.LENGTH_SHORT
gravityToastGravity.TOP (or) ToastGravity.CENTER (or) ToastGravity.BOTTOM (Web Only supports top, bottom)ToastGravity.BOTTOM
timeInSecForIosWebint (only for ios)1
bgcolorColors.redColors.black
textcolorColors.whiteColors.white
fontSize16.0 (float)16.0
webShowClosefalse (bool)false
webBgColorString (hex Color)linear-gradient(to right, #00b09b, #96c93d)
webPositionString (left, center or right)right

To cancel all the toasts call #

Fluttertoast.cancel()

Preview Images #

If you need any features suggest #

[4.0.1] #

  • ReadMe Fixes

[4.0.0] #

  • Added Web Support

[3.1.3] #

  • Toast optimized for Android

[3.1.2] #

  • Flutter analysis failed fixed

[3.1.1] #

  • Not Compiling in android (issue with AndroidX)

[3.1.0] #

  • Migrated to AndroidX

##[3.0.6]

  • iOS build failed fixed

[3.0.5] #

  • deprecation fixed
  • hope ios notch fixed

[3.0.4] #

  • Android Color fix

[3.0.3] #

  • fixed Android Toast.LENGTH_*

[3.0.2] #

  • fixed #70 #71

[3.0.1] #

  • Release build failed fix
  • Multiline text android fix

[3.0.0] #

  • Migrated to AndroidX

[2.2.12] #

  • Incomplete Text Fix

[2.2.11] #

  • Incomplete Text Fix

[2.2.10] #

  • iOS build Failed fix

[2.2.9] #

  • iOS build Failed fix

[2.2.8] #

  • Fluttertoast.cancel() added
  • FlutterToast Implementation revert back to previous

[2.2.7] #

  • FontSize Can be changed
  • FlutterToast Implementation Changed to FlutterToast.instance

[2.2.6] #

  • removed androidx

[2.2.5] #

  • Cannot build because of dependency w/ v28 #47

[2.2.4] #

  • androidX crash fix #45

[2.2.3] #

  • iOS Crash fix #41 & #39

[2.2.1] #

  • default toast style fix #38

[2.2.0] #

  • Background color fixed #29

[2.1.5] #

  • Merged PR #36 - Fix Number Cast Error for issue #35

[2.1.4] #

  • Merged PR #32

[2.1.2] #

  • iOS Color Fix
  • Background color fix in PIE

[2.1.1] #

  • Background color does not fill the whole Toast fixed

[2.1.0] #

  • build error fixed

[2.0.9] #

  • fix error in flutter 0.9.7

[2.0.8] #

  • Build failed with an exception fixed
  • The plugin calls the build of the previous widget fixed
  • Screenshots added

[2.0.7] #

  • Text background fix for android

[2.0.6] #

  • iOS Release build error fixed

[2.0.3] #

  • iOs run time error fixed

[2.0.2] #

  • iOs build error fixed

[2.0.1] #

  • Ios Support added
  • option for setting toast gravity (top, center, bottom)

[1.0.1] #

  • Initial Open Sources
  • show Toast in Android

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
  }

  void showLongToast() {
    Fluttertoast.showToast(
      msg: "This is Long Toast",
      toastLength: Toast.LENGTH_LONG,
    );
  }

  void showWebColoredToast() {
    
    Fluttertoast.showToast(
        msg: "This is Colored Toast with android duration of 5 Sec",
        toastLength: Toast.LENGTH_SHORT,
        webBgColor: "#e74c3c",
        timeInSecForIosWeb: 5,
        );
  }

  void showColoredToast() {
    Fluttertoast.showToast(
        msg: "This is Colored Toast with android duration of 5 Sec",
        toastLength: Toast.LENGTH_SHORT,
        backgroundColor: Colors.red,
        textColor: Colors.white);
  }

  void showShortToast() {
    Fluttertoast.showToast(
        msg: "This is Short Toast",
        toastLength: Toast.LENGTH_SHORT,
        timeInSecForIosWeb: 1);
  }

  void showTopShortToast() {
    Fluttertoast.showToast(
        msg: "This is Top Short Toast",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.TOP,
        timeInSecForIosWeb: 1);
  }

  void showCenterShortToast() {
    Fluttertoast.showToast(
        msg: "This is Center Short Toast",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        timeInSecForIosWeb: 1);
  }

  void cancelToast() {
    Fluttertoast.cancel();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Flutter Toast'),
        ),
        body: new Center(
          child: new Column(
            children: <Widget>[
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show Long Toast'),
                    onPressed: showLongToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show Short Toast'),
                    onPressed: showShortToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show Center Short Toast'),
                    onPressed: showCenterShortToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show Top Short Toast'),
                    onPressed: showTopShortToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show Colored Toast'),
                    onPressed: showColoredToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Show  Web Colored Toast'),
                    onPressed: showWebColoredToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                  child: new Text('Cancel Toasts'),
                  onPressed: cancelToast,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  fluttertoast: ^4.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:fluttertoast/fluttertoast.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
99
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
99
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:fluttertoast/fluttertoast.dart] that declares support for platforms: android, ios, web

Package does not support Flutter platform macos

Because of import path [package:fluttertoast/fluttertoast.dart] that declares support for platforms: android, ios, web

Package does not support Flutter platform windows

Because of import path [package:fluttertoast/fluttertoast.dart] that declares support for platforms: android, ios, web

Package not compatible with SDK dart

because of import path [fluttertoast] that is in a package requiring null.

Health suggestions

Fix lib/fluttertoast_web.dart. (-1.49 points)

Analysis of lib/fluttertoast_web.dart reported 3 hints:

line 3 col 8: Unused import: 'dart:ui'.

line 4 col 8: Unused import: 'dart:js'.

line 36 col 16: This function has a return type of 'Future

Format lib/fluttertoast.dart.

Run flutter format to format lib/fluttertoast.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
flutter_web_plugins 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8