Skip to main content

LMChatSnackBar

File location
snackbar.dart

LMChatSnackBar is a customizable snackbar widget used within the chat interface to display brief messages or notifications. It supports a wide range of customization options, including actions, animations, and styles.

Properties

  1. content (Widget)
    The main content displayed within the snackbar.

  2. style (LMChatSnackBarStyle?)
    Customizes the appearance and behavior of the snackbar.

Note: These properties are only a subset. More can be found inside the widget class.


Styling

LMChatSnackBarStyle

File location
snackbar.dart

LMChatSnackBarStyle defines the appearance and behavior of the snackbar, including padding, shape, and actions.

PropertyTypeDescriptionRequiredDefault
backgroundColorColor?Background color of the snackbarNoInherited theme
elevationdouble?Elevation of the snackbarNo6.0
durationDuration?Duration for which the snackbar is visibleNo4 seconds
dismissDirectionDismissDirection?Dismiss direction for the snackbarNoDismissDirection.down
paddingEdgeInsetsGeometry?Padding inside the snackbarNoEdgeInsets.all(8)

Note: These properties are only a subset. More can be found inside the style class.


Example Usage

final chatSnackBar = LMChatSnackBar(
content: Text('This is a snackbar message'),
style: LMChatSnackBarStyle(
backgroundColor: Colors.black,
elevation: 4.0,
dismissDirection: DismissDirection.down,
padding: EdgeInsets.all(16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
);

ScaffoldMessenger.of(context).showSnackBar(chatSnackBar);