showMessage method
dynamic
showMessage(
- String message, {
- String title = "Message",
- Widget? titleWidget,
- Widget? messageWidget,
- MessageType type = MessageType.info,
- MessageStyle style = MessageStyle.flatColored,
- bool autoClose = true,
- int autoCloseDurationSeconds = 5,
- Alignment alignment = Alignment.bottomRight,
- TextDirection textDirection = TextDirection.ltr,
- bool showAnimation = false,
- int animationDurationMillis = 300,
- Widget? customIcon,
Use showMessage without context if you are using PlexApp
Implementation
showMessage(
String message, {
String title = "Message",
Widget? titleWidget,
Widget? messageWidget,
MessageType type = MessageType.info,
MessageStyle style = MessageStyle.flatColored,
bool autoClose = true,
int autoCloseDurationSeconds = 5,
Alignment alignment = Alignment.bottomRight,
TextDirection textDirection = TextDirection.ltr,
bool showAnimation = false,
int animationDurationMillis = 300,
Widget? customIcon,
}) {
toastification.show(
type: type.type,
style: style.style,
autoCloseDuration: autoClose ? Duration(seconds: autoCloseDurationSeconds) : null,
title: titleWidget ?? Text(title),
description: messageWidget ?? Text(message),
alignment: alignment,
direction: textDirection,
animationDuration: showAnimation ? Duration(milliseconds: animationDurationMillis) : null,
animationBuilder: showAnimation
? (context, animation, alignment, child) {
return FadeTransition(
opacity: animation,
child: child,
);
}
: null,
icon: customIcon,
boxShadow: const [
BoxShadow(
color: Color(0x07000000),
blurRadius: 16,
offset: Offset(0, 16),
spreadRadius: 0,
)
],
showProgressBar: autoClose,
closeButtonShowType: CloseButtonShowType.onHover,
closeOnClick: false,
pauseOnHover: true,
dragToClose: true,
applyBlurEffect: true,
callbacks: ToastificationCallbacks(
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
onCloseButtonTap: (toastItem) {
print('Toast ${toastItem.id} close button tapped');
toastification.dismissById(toastItem.id);
},
onAutoCompleteCompleted: (toastItem) => print('Toast ${toastItem.id} auto complete completed'),
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
),
);
}