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
content
(Widget
)
The main content displayed within the snackbar.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.
Property | Type | Description | Required | Default |
---|---|---|---|---|
backgroundColor | Color? | Background color of the snackbar | No | Inherited theme |
elevation | double? | Elevation of the snackbar | No | 6.0 |
duration | Duration? | Duration for which the snackbar is visible | No | 4 seconds |
dismissDirection | DismissDirection? | Dismiss direction for the snackbar | No | DismissDirection.down |
padding | EdgeInsetsGeometry? | Padding inside the snackbar | No | EdgeInsets.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);