toast_message 0.0.1
toast_message: ^0.0.1 copied to clipboard
Toast message flutter package.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:toast_message_example/toast_context.dart';
import 'package:toast_message_example/toast_no_context.dart';
GlobalKey globalKey = GlobalKey();
void main() => runApp(const MaterialApp(home: MyApp(),));
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Scaffold(
key: globalKey,
appBar: AppBar(
title: const Text("Toast"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const ToastNoContext(),
));
},
child: const Text("Flutter Toast No Context"),
),
const SizedBox(
height: 24.0,
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const ToastContext(),
));
},
child: const Text("Flutter Toast Context"),
),
],
),
);
}
}