showSnackbar method
void
showSnackbar({})
Shows a snack bar with the details passed in
Implementation
void showSnackbar({
String title = '',
required String message,
Function(dynamic)? onTap,
Duration duration = const Duration(seconds: 3),
String? mainButtonTitle,
void Function()? onMainButtonTapped,
}) {
final mainButtonWidget = _getMainButtonWidget(
mainButtonTitle: mainButtonTitle,
onMainButtonTapped: onMainButtonTapped,
config: _snackbarConfig,
);
Get.snackbar(
title,
message,
titleText: title.isNotEmpty
? Text(
title,
key: Key('snackbar_text_title'),
style: TextStyle(
color: _snackbarConfig?.titleColor ??
_snackbarConfig?.textColor ??
Colors.white,
fontWeight: FontWeight.w800,
fontSize: 16,
),
textAlign: _snackbarConfig?.titleTextAlign ?? TextAlign.left,
)
: SizedBox.shrink(),
messageText: message.isNotEmpty
? Text(
message,
key: Key('snackbar_text_message'),
style: TextStyle(
color: _snackbarConfig?.messageColor ??
_snackbarConfig?.textColor ??
Colors.white,
fontWeight: FontWeight.w300,
fontSize: 14,
),
textAlign: _snackbarConfig?.messageTextAlign ?? TextAlign.left,
)
: SizedBox.shrink(),
shouldIconPulse: _snackbarConfig?.shouldIconPulse,
onTap: onTap,
barBlur: _snackbarConfig?.barBlur,
isDismissible: _snackbarConfig?.isDismissible ?? true,
duration: duration,
snackPosition: _snackbarConfig?.snackPosition.toGet,
backgroundColor: _snackbarConfig?.backgroundColor ?? Colors.grey[800],
margin: _snackbarConfig?.margin ??
const EdgeInsets.symmetric(horizontal: 10, vertical: 25),
mainButton: mainButtonWidget,
icon: _snackbarConfig?.icon,
maxWidth: _snackbarConfig?.maxWidth,
padding: _snackbarConfig?.padding,
borderRadius: _snackbarConfig?.borderRadius,
borderColor: _snackbarConfig?.borderColor,
borderWidth: _snackbarConfig?.borderWidth,
leftBarIndicatorColor: _snackbarConfig?.leftBarIndicatorColor,
boxShadows: _snackbarConfig?.boxShadows,
backgroundGradient: _snackbarConfig?.backgroundGradient,
dismissDirection: _snackbarConfig?.dismissDirection,
showProgressIndicator: _snackbarConfig?.showProgressIndicator,
progressIndicatorController: _snackbarConfig?.progressIndicatorController,
progressIndicatorBackgroundColor:
_snackbarConfig?.progressIndicatorBackgroundColor,
progressIndicatorValueColor: _snackbarConfig?.progressIndicatorValueColor,
snackStyle: _snackbarConfig?.snackStyle.toGet,
forwardAnimationCurve: _snackbarConfig?.forwardAnimationCurve,
reverseAnimationCurve: _snackbarConfig?.reverseAnimationCurve,
animationDuration: _snackbarConfig?.animationDuration,
overlayBlur: _snackbarConfig?.overlayBlur,
overlayColor: _snackbarConfig?.overlayColor,
userInputForm: _snackbarConfig?.userInputForm,
);
}