fluttertoast2 0.0.8 fluttertoast2: ^0.0.8 copied to clipboard
Toast for FLutter
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,
),
),
],
),
),
),
);
}
}