load_toast 2.0.0+1 copy "load_toast: ^2.0.0+1" to clipboard
load_toast: ^2.0.0+1 copied to clipboard

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

example/lib/main.dart

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

void main() {
  runApp(
    LoadToast(
      child: MaterialApp(
        home: Example(),
      ),
    ),
  );
}

final textStyle =
    TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold);

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

class _ExampleState extends State<Example> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Wrap(
          spacing: 8.0,
          runSpacing: 8.0,
          crossAxisAlignment: WrapCrossAlignment.center,
          alignment: WrapAlignment.center,
          direction: Axis.horizontal,
          children: <Widget>[
            RaisedButton(
              color: Colors.blue,
              child: Text(
                'Show LoadToast',
                style: textStyle,
              ),
              onPressed: () {
                showLoadToast(
                    backgroundColor: Colors.white,
                    indicatorColor: Colors.blue,
                    text: 'Please wait...');
              },
            ),
            RaisedButton(
              color: Colors.green,
              child: Text(
                'LoadToast Success',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithSuccess();
              },
            ),
            RaisedButton(
              color: Colors.red,
              child: Text(
                'LoadToast Error',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithError();
              },
            ),
            RaisedButton(
              color: Colors.orange,
              child: Text(
                'LoadToast Warning',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithWarning();
              },
            ),
            RaisedButton(
              color: Colors.orange,
              child: Text(
                'Go to new page',
                style: textStyle,
              ),
              onPressed: () {
                Navigator.of(context).push(CupertinoPageRoute(
                    builder: (BuildContext context) => NewPage()));
              },
            ),
          ],
        ),
      ),
    );
  }
}

class NewPage extends StatefulWidget {
  @override
  _NewPageState createState() => _NewPageState();
}

class _NewPageState extends State<NewPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Wrap(
          spacing: 8.0,
          runSpacing: 8.0,
          crossAxisAlignment: WrapCrossAlignment.center,
          alignment: WrapAlignment.center,
          direction: Axis.horizontal,
          children: <Widget>[
            Text(
              'Second page',
              style: textStyle,
            ),
            RaisedButton(
              color: Colors.blue,
              child: Text(
                'Show LoadToast',
                style: textStyle,
              ),
              onPressed: () {
                showLoadToast();
              },
            ),
            RaisedButton(
              color: Colors.green,
              child: Text(
                'LoadToast Success',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithSuccess();
              },
            ),
            RaisedButton(
              color: Colors.red,
              child: Text(
                'LoadToast Error',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithError();
              },
            ),
            RaisedButton(
              color: Colors.orange,
              child: Text(
                'LoadToast Warning',
                style: textStyle,
              ),
              onPressed: () {
                hideLoadToastWithWarning();
              },
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
40
pub points
0%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on load_toast