ChatMessageSettings class

Customizes chat bubbles with these settings for a better user experience.

The ChatMessageSettings class provides options to customize the appearance and layout of chat bubbles, including styling, and padding, and display options for elements such as the username, timestamp, and avatar.

Example:

@override
Widget build(BuildContext context) {
  return SfChat(
    incomingMessageSettings: ChatMessageSettings(
      showAuthorName: true,
      showTimestamp: true,
      showAuthorAvatar: true,
      widthFactor: 0.8,
      avatarSize: const Size.square(32.0),
      margin: const EdgeInsets.all(2.0),
      padding:
          const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
      headerPadding:
          const EdgeInsetsDirectional.only(top: 14.0, bottom: 4.0),
      footerPadding: const EdgeInsetsDirectional.only(top: 4.0),
    ),
    outgoingMessageSettings: ChatMessageSettings(
      showAuthorName: true,
      showTimestamp: true,
      showAuthorAvatar: true,
      widthFactor: 0.8,
      avatarSize: const Size.square(32.0),
      margin: const EdgeInsets.all(2.0),
      padding:
          const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
      headerPadding:
          const EdgeInsetsDirectional.only(top: 14.0, bottom: 4.0),
      footerPadding: const EdgeInsetsDirectional.only(top: 4.0),
    ),
  );
}

Constructors

ChatMessageSettings({bool showAuthorName = true, bool showTimestamp = true, bool showAuthorAvatar = true, DateFormat? timestampFormat, TextStyle? textStyle, TextStyle? headerTextStyle, Color? backgroundColor, ShapeBorder? shape, double widthFactor = 0.8, Size avatarSize = const Size.square(32.0), EdgeInsetsGeometry? margin = const EdgeInsetsDirectional.only(top: 16.0), EdgeInsetsGeometry? padding = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), EdgeInsetsGeometry? avatarPadding, EdgeInsetsGeometry headerPadding = const EdgeInsetsDirectional.only(bottom: 4.0), EdgeInsetsGeometry footerPadding = const EdgeInsetsDirectional.only(top: 4.0)})
Creates a ChatMessageSettings with the given customization options.
const

Properties

avatarPadding → EdgeInsetsGeometry?
Customizes the padding around the avatar within the bubble.
final
avatarSize → Size
Customizes the avatar's size within the chat bubble.
final
backgroundColor → Color?
Background color of the message content.
final
footerPadding → EdgeInsetsGeometry
Customizes the padding around the footer section of the bubble (if applicable).
final
hashCode → int
The hash code for this object.
no setterinherited
headerPadding → EdgeInsetsGeometry
Customizes padding to the header section of the bubble (if applicable).
final
headerTextStyle → TextStyle?
Style for the header text in the chat bubble.
final
margin → EdgeInsetsGeometry?
Customizes the padding around the entire bubble.
final
padding → EdgeInsetsGeometry?
Customizes the padding around the bubble's content.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shape → ShapeBorder?
Shape of the message content, including border radius.
final
showAuthorAvatar → bool
Customizes whether to display the sender's avatar within the chat bubble.
final
showAuthorName → bool
Customizes whether to display the sender's username within the chat bubble.
final
showTimestamp → bool
Customizes whether to display the timestamp within the chat bubble.
final
textStyle → TextStyle?
Style for the chat bubble's text.
final
timestampFormat → DateFormat?
Customizes the format for displaying the timestamp of the message.
final
widthFactor → double
Customizes the chat bubble's width as a fraction of the screen width.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited