bot_toast 4.1.3 bot_toast: ^4.1.3 copied to clipboard
A really easy to use flutter toast library.Easy to use and feature rich.
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'all.dart';
import 'attached_toast/attached_toast.dart';
import 'custom/custom_animation.dart';
import 'custom/custom_widget.dart';
import 'loading/custom_loading.dart';
import 'loading/loading.dart';
import 'notification/custom_notification.dart';
import 'notification/simple_notification.dart';
import 'notification/notification.dart' as notification;
import 'text/custom_text.dart';
import 'text/text.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
primary: Colors.grey[300],
onPrimary: Colors.black,
),
)),
builder: BotToastInit(),
title: 'BotToast Demo',
navigatorObservers: [BotToastNavigatorObserver()],
home: EnterPage(),
);
}
}
class EnterPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("BotToast"),
centerTitle: true,
),
body: Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(top: 30),
child: Column(children: <Widget>[
const Text(
"Notification",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
const Divider(),
Row(
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => SimpleNotification()));
},
child: const Text("SimpleNotification"),
),
),
),
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
notification.Notification()));
},
child: const Text("Notification"),
),
),
)
],
),
Container(
width: double.infinity,
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CustomNotification()));
},
child: const Text("CustomNotification"),
),
),
Container(
height: 40,
),
const Text(
"TextToast",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
const Divider(),
Row(
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => TextSample()));
},
child: const Text("TextToast"),
),
),
),
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CustomText()));
},
child: const Text("CustomText"),
),
),
)
],
),
Container(
height: 40,
),
const Text(
"Load",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
const Divider(),
Row(
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => Loading()));
},
child: const Text("Loading"),
),
),
),
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CustomLoading()));
},
child: const Text("CustomLoading"),
),
),
),
],
),
const Text(
'Other',
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
const Divider(),
Row(
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => AttachedToast()));
},
child: const Text('AttachedToast'),
),
),
),
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => All()));
},
child: const Text("All"),
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CustomAnimation()));
},
child: const Text('CustomAnimation'),
),
),
),
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CustomWidget()));
},
child: const Text('CustomWidget'),
),
),
)
],
)
]),
),
),
));
}
}