TToastService class
A service for displaying toast notifications.
TToastService provides toast messages with:
- Success, info, warning, and error variants
- Auto-dismiss with configurable duration
- Pause on hover
- Mobile and desktop positioning
- Custom icons and colors
Basic Usage
TToastService.success(context, 'Operation completed!');
TToastService.error(context, 'Something went wrong');
With Title
TToastService.info(context, 'Your changes have been saved', 'Success');
Custom Toast
TToastService.show(
context,
'Custom message',
title: 'Custom Title',
icon: Icons.star,
color: Colors.purple,
duration: Duration(seconds: 5),
)
See also:
- TAlert for dialog alerts
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
error(
BuildContext context, String message, [String? title]) → void - Shows an error toast.
-
info(
BuildContext context, String message, [String? title]) → void - Shows an info toast.
-
show(
BuildContext context, String message, {String? title, IconData? icon, Duration? duration, Alignment? alignment, Color? color, TVariant? type}) → void - Shows a custom toast notification.
-
success(
BuildContext context, String message, [String? title]) → void - Shows a success toast.
-
warning(
BuildContext context, String message, [String? title]) → void - Shows a warning toast.