Future customToast(BuildContext context, String title, String subTitle) async {
toastification.show(
context: context, // optional if you use ToastificationWrapper
type: ToastificationType.success,
style: ToastificationStyle.fillColored,
autoCloseDuration: const Duration(seconds: 5),
showIcon: false,
title: Text(
subTitle,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
// you can also use RichText widget for title and description parameters
alignment: Alignment.topRight,
animationDuration: const Duration(milliseconds: 300),
primaryColor: FlutterFlowTheme.of(context).primary,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
borderRadius: BorderRadius.circular(12),
showProgressBar: false,
);
}
The customToast
action displays a sleek and modern toast notification using the toastification
โ Perfect for giving users a clean success message experience in your app.
๐ง Takes 2 Parameters:
๐ท๏ธ
title
โ (Displayed as the title of the toast message)๐ฌ
subTitle
โ (Displayed as the main toast message)
โจ Features:
โ Success-style toast
๐จ Themed background color from
FlutterFlowTheme
๐ Auto-dismisses after 5 seconds
๐ฌ Smooth 300ms animation
๐ Appears top-right
โ No icon or progress bar
๐ง Clean layout with rounded corners and padding
๐ฆ Make sure to add the toastification
package in your pubspec.yaml
.
๐ ๏ธ You can customize the toast according to your requirement โ change the type, style, duration, alignment, and more!
If you found this helpful, please like, comment, and share! ๐๐ฌ๐
If you need any assistance or want to build your product, DM me! ๐ฌ
Thank you!