load_toast 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

load_toast #

A plugin that would really help you show some cool animated widget, describing your app is busy.

How does it look like #

Supported Dart Versions #

Dart SDK version >=2.1.0 <3.0.0

Installation #

Add the Package

dependencies:
  load_toast: ^0.0.1

How to use #

Import the package in your dart file

import 'package:load_toast/load_toast.dart';

Create an instance of it, maybe a static variable widget can really help as it would be an optimized choice. Wrap it in a MaterialApp->Stack->[YourApp(), loadtoast]

Create an instance of LoadToast

LoadToast loadToast = LoadToast();

You can specify the optional parameters to the above constructor, backgroundColor: Colors.greenAccent, circularIndicatorColor: Colors.white

Plug it into your widget tree in a Stack parent

  Widget build(BuildContext context) {
    return Scaffold(
        body: Stack(children: <Widget>[
      //... your children
      loadToast
    ]));
  }

That's it, you're done, lets show it

loadToast.show();

Note: You can specify the optional parameter to the above method, text: "Hello there!"

Handle the cases now

  • The operation ended up in Success
loadToast.success();
  • Unfortuantely it has failed
loadToast.error();
  • Hmm... Succeeded but there's something tricky
loadToast.warning();

Want to contribute? #

Pull requests and issues are always welcome!

How to contribute?

  1. Fork the repository
  2. Clone it to your local machine
  3. Open the project in your favourite editor
  4. Open cmd/terminal and run flutter clean and then flutter packages get
  5. Make the changes
  6. Create a Pull Request

View the issues here

Inspired by loadToast - android

[1.0.0] - Initial release of package #

Initial release of load_toast package

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:load_toast/load_toast.dart';

void main() {
  runApp(MaterialApp(debugShowCheckedModeBanner: false, home: Example()));
}

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {

  LoadToast load_toast = LoadToast(backgroundColor: Colors.greenAccent,circularIndicatorColor: Colors.white,);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          Positioned(
              top: 190.0,
              left: 20.0,
              right: 20.0,
              child: RaisedButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0)),
                onPressed: () {
                  load_toast.show();
                },
                child: SizedBox(
                  height: 50.0,
                  child: Center(
                    child: Text(
                      'Show toast',
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 18.0,
                          fontWeight: FontWeight.w600),
                    ),
                  ),
                ),
                color: Colors.blueAccent,
              )),
          Positioned(
              top: 260.0,
              left: 20.0,
              right: 20.0,
              child: RaisedButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0)),
                onPressed: () {
                  load_toast.success();
                },
                child: SizedBox(
                  height: 50.0,
                  child: Center(
                    child: Text('Success',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 18.0,
                            fontWeight: FontWeight.w600)),
                  ),
                ),
                color: Colors.green,
              )),
          Positioned(
              top: 320.0,
              left: 20.0,
              right: 20.0,
              child: RaisedButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0)),
                onPressed: () {
                  load_toast.error();
                },
                child: SizedBox(
                  height: 50.0,
                  child: Center(
                    child: Text('Error',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 18.0,
                            fontWeight: FontWeight.w600)),
                  ),
                ),
                color: Colors.red,
              )),
          Positioned(
              top: 380.0,
              left: 20.0,
              right: 20.0,
              child: RaisedButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0)),
                onPressed: () {
                  load_toast.warning();
                },
                child: SizedBox(
                  height: 50.0,
                  child: Center(
                    child: Text('Warning',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 18.0,
                            fontWeight: FontWeight.w600)),
                  ),
                ),
                color: Colors.yellow,
              )),
          load_toast
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  load_toast: ^1.0.0

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:load_toast/load_toast.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test