ToastrConfig class
Configuration class for toastr notifications.
Contains all settings for customizing the appearance, behavior, and animation of toastr notifications. This class is immutable and uses the copyWith pattern for creating modified versions.
Example:
final config = ToastrConfig(
type: ToastrType.success,
message: 'Operation completed',
duration: Duration(seconds: 3),
position: ToastrPosition.topRight,
);
Constructors
- ToastrConfig({required ToastrType type, required String message, String? title, Duration duration = const Duration(seconds: 5), Duration? extendedTimeout, bool dismissible = true, bool showCloseButton = false, Widget? customIcon, Color? backgroundColor, Color? textColor, Duration showDuration = const Duration(milliseconds: 300), Duration hideDuration = const Duration(milliseconds: 1000), ToastrPosition position = ToastrPosition.topRight, ToastrShowMethod showMethod = ToastrShowMethod.fadeIn, ToastrHideMethod hideMethod = ToastrHideMethod.fadeOut, Curve showEasing = Curves.easeOut, Curve hideEasing = Curves.easeIn, bool showProgressBar = false, bool preventDuplicates = false, String? duplicateKey})
-
Creates a new ToastrConfig with the specified parameters.
const
Properties
- backgroundColor → Color?
-
Custom background color to override the default type color
final
- customIcon → Widget?
-
Custom icon to override the default type icon
final
- dismissible → bool
-
Whether the toastr can be dismissed by tapping
final
- duplicateKey → String?
-
Unique identifier for preventing duplicates
final
- duration → Duration
-
Duration for which the toastr should be visible
final
- extendedTimeout → Duration?
-
Extended timeout when hovering over the toast
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideDuration → Duration
-
Animation duration for hide
final
- hideEasing → Curve
-
Hide easing curve
final
- hideMethod → ToastrHideMethod
-
Hide animation type
final
- key → String
-
Generates a key for duplicate detection
no setter
- message → String
-
The message to display
final
- position → ToastrPosition
-
Position of the toastr on screen
final
- preventDuplicates → bool
-
Whether the notification should prevent duplicates
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showCloseButton → bool
-
Whether to show a close button
final
- showDuration → Duration
-
Animation duration for show
final
- showEasing → Curve
-
Show easing curve
final
- showMethod → ToastrShowMethod
-
Show animation type
final
- showProgressBar → bool
-
Whether to enable progress bar
final
- textColor → Color?
-
Custom text color
final
- title → String?
-
Optional title for the notification
final
- type → ToastrType
-
The type of toastr notification
final
Methods
-
copyWith(
{ToastrType? type, String? message, String? title, Duration? duration, Duration? extendedTimeout, bool? dismissible, bool? showCloseButton, Widget? customIcon, Color? backgroundColor, Color? textColor, Duration? showDuration, Duration? hideDuration, ToastrPosition? position, ToastrShowMethod? showMethod, ToastrHideMethod? hideMethod, Curve? showEasing, Curve? hideEasing, bool? showProgressBar, bool? preventDuplicates, String? duplicateKey}) → ToastrConfig - Creates a copy of this config with updated values
-
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