fluttertoast2 0.0.8 copy "fluttertoast2: ^0.0.8" to clipboard
fluttertoast2: ^0.0.8 copied to clipboard

Toast for FLutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast2/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 showToast() {
    Fluttertoast.showToast(
      msg: "Toast",
      toastDuration: ToastDuration.LENGTH_LONG,
              backgroundColor: Colors.black54,
    );
  }

  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 Toast'),
                    onPressed: showToast),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                    child: new Text('Cancel Toast'),
                    onPressed: cancelToast,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

Toast for FLutter

Homepage

License

Apache-2.0 (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on fluttertoast2