showMessage static method
dynamic
showMessage(
- BuildContext context,
- MessageType messageType,
- String content, {
- TextStyle textStyle = const TextStyle(fontSize: 14, color: Colors.white),
- double marginBottom = 12,
- int durationMilliseconds = 2500,
- Color? backgroundColor,
- Icon? leftIcon,
Implementation
static showMessage(
BuildContext context, MessageType messageType, String content,
{TextStyle textStyle=const TextStyle(fontSize: 14, color: Colors.white),
double marginBottom = 12,
int durationMilliseconds = 2500,
Color ?backgroundColor,
Icon ? leftIcon
}) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
margin: EdgeInsets.fromLTRB(12, 0, 12, marginBottom),
behavior: SnackBarBehavior.floating,
duration: Duration(milliseconds: durationMilliseconds),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
elevation: 2,
backgroundColor: backgroundColor??getColor(messageType),
content: Container(
child: Row(
children: <Widget>[
leftIcon??Icon(
getIcon(messageType),
color: Colors.white,
),
SizedBox(
width: 12,
),
Text(content, style: textStyle)
],
),
),
));
}