TfkToast
TfkToast is a Flutter package designed to display beautiful and customizable toast notifications. Toast messages provide non-intrusive feedback to users, enhancing their experience.
Features
- Customizable Toasts: Display toasts with various types (info, warning, error, success).
- Customizable Title and Message: Add a title and message to your toast notifications.
- Automatic Dismissal: Toasts automatically disappear after a few seconds.
- Manual Dismissal: Optionally, allow users to manually close the toast.
Installation
Add tfk_toast
to your pubspec.yaml
file:
dependencies:
tfk_toast: ^0.2.2
Then run:
flutter pub get
Usage
Import the package in your Dart file:
import 'package:tfk_toast/tfk_toast.dart';
To show a toast, use the following code:
INITILIALIZE THE PACKAGE TO REMOVE passing context direct the package
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
/****\*\*\***** INITIALIZE THE TOAST KEY HERE \*/
navigatorKey: TfkToast.navigatorKey, //
home: Scaffold(
appBar: AppBar(
title: const Text('Custom Toast Example'),
backgroundColor: Colors.blue,
),
),
);
}
}
TfkToast.showToast("This is an toast title message!",
title: "Toast Title",
position: ToastPosition.top,
icon: const Icon(
Icons.info,
color: Colors.white,
),
backgroundColor: Colors.pinkAccent
);