premium_toast_flutter 1.0.4
premium_toast_flutter: ^1.0.4 copied to clipboard
A beautiful and lightweight Flutter package to display animated toast messages for success, error, and alert events. Premium_Toast_Flutter makes your app interactions smoother by providing quick, eleg [...]
import 'package:flutter/material.dart';
import 'package:premium_toast_flutter/premium_toast_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
home: PremiumToastFlutterDemo(),
);
}
}
class PremiumToastFlutterDemo extends StatelessWidget {
const PremiumToastFlutterDemo({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
child: const Text("Success Toast"),
onPressed: () {
PremiumToastFlutter.successToast(
context,
upperToast: false,
bottomToast: true,
title: "Well Done!",
subtitle: "Your message has been sent successfully",
toastDuration: const Duration(seconds: 3),
);
},
),
ElevatedButton(
child: const Text("Error Toast"),
onPressed: () {
PremiumToastFlutter.errorToast(
context,
upperToast: false,
bottomToast: true,
title: "Oops!",
subtitle: "Some Error has occurred",
toastDuration: const Duration(seconds: 3),
);
},
),
ElevatedButton(
child: const Text("Alert Toast"),
onPressed: () {
PremiumToastFlutter.alertToast(
context,
upperToast: false,
bottomToast: true,
title: "Alert!",
subtitle: "There is some alert!",
toastDuration: const Duration(seconds: 3),
);
},
),
],
),
),
);
}
}