show static method
dynamic
show({
- required String message,
- Duration duration = const Duration(seconds: 2),
- ActionType action = ActionType.none,
Implementation
static show({
required String message,
Duration duration = const Duration(seconds: 2),
ActionType action = ActionType.none,
}) async {
Cnt.messengerKey.currentState?.showSnackBar(
SnackBar(
duration: duration,
margin: Pad.a12,
behavior: SnackBarBehavior.floating,
backgroundColor: action == ActionType.success
? Clr.successColor
: action == ActionType.error
? Clr.errorColor
: Clr.primaryColor,
shape: RoundedRectangleBorder(borderRadius: BR.cSmall),
content: Text(
message,
style: AppTypography.body.copyWith(
color: Clr.white,
fontWeight: FontWeight.w400,
),
),
action: action == ActionType.error
? SnackBarAction(
onPressed: () {},
label: 'Retry',
textColor: Clr.white,
)
: null,
),
);
}