ChatTheme class
Visual overrides for chatx widgets.
Every field is optional. Fields you leave null are derived from the
ambient Material 3 ThemeData, so chatx matches your app (including dark
mode) with no configuration.
Provide overrides in one of two ways:
-
App-wide, as a theme extension:
MaterialApp( theme: ThemeData( extensions: const [ChatTheme(outgoingBubbleColor: Colors.teal)], ), ) -
For a single chat, through
ChatView.theme.
Text styles are merged with the defaults, so TextStyle(fontSize: 18)
only changes the size. Read the fully resolved values with
ChatThemeData.of.
- Inheritance
-
- Object
- ThemeExtension<
ChatTheme> - ChatTheme
- Mixed-in types
- Annotations
Constructors
- ChatTheme({Color? backgroundColor, Color? outgoingBubbleColor, Color? incomingBubbleColor, TextStyle? outgoingTextStyle, TextStyle? incomingTextStyle, TextStyle? linkStyle, TextStyle? codeTextStyle, TextStyle? timestampTextStyle, TextStyle? userNameTextStyle, TextStyle? dateSeparatorTextStyle, Color? dateSeparatorColor, Color? unreadSeparatorColor, TextStyle? systemMessageTextStyle, double? bubbleRadius, double? bubbleGroupedRadius, EdgeInsetsGeometry? bubblePadding, ChatBubbleTail? bubbleTail, double? bubbleTailWidth, double? bubbleTailHeight, double? bubbleElevation, Color? bubbleShadowColor, BorderSide? outgoingBubbleBorderSide, BorderSide? incomingBubbleBorderSide, double? maxBubbleWidth, double? maxBubbleWidthFactor, double? avatarSize, Color? reactionChipColor, Color? reactionChipSelectedColor, Color? highlightColor, Color? inputBackgroundColor, Color? inputFieldColor, TextStyle? inputTextStyle, TextStyle? inputHintStyle, Color? sendButtonColor, Color? sendButtonIconColor, Color? readStatusColor, Color? errorColor, Color? typingIndicatorColor, Color? scrollButtonColor, Color? scrollButtonIconColor, Color? unreadBadgeColor, Color? unreadBadgeTextColor})
-
Creates a set of theme overrides.
const
Properties
- avatarSize → double?
-
Diameter of avatars.
final
- backgroundColor → Color?
-
Background behind the message list.
final
- bubbleElevation → double?
-
Shadow elevation of bubbles.
final
- bubbleGroupedRadius → double?
-
Corner radius on the side where consecutive bubbles of a group touch.
final
- bubblePadding → EdgeInsetsGeometry?
-
Padding inside bubbles, not counting the tail.
final
- bubbleRadius → double?
-
Corner radius of bubbles.
final
- bubbleShadowColor → Color?
-
Shadow color of bubbles. Only visible when bubbleElevation is above
zero.
final
- bubbleTail → ChatBubbleTail?
-
Where bubbles draw their tail. See ChatBubbleTail.
final
- bubbleTailHeight → double?
-
Vertical size of the tail.
final
- bubbleTailWidth → double?
-
Horizontal size of the tail. Every bubble reserves this space so
bubbles with and without a tail stay aligned.
final
- codeTextStyle → TextStyle?
-
Style merged on top of the bubble text style for code.
final
- dateSeparatorColor → Color?
-
Background of the day label pill.
final
- dateSeparatorTextStyle → TextStyle?
-
Style of the day labels between messages.
final
- errorColor → Color?
-
Color used for failed messages.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- highlightColor → Color?
-
Flash shown on a message after jumping to it from a reply.
final
- incomingBubbleBorderSide → BorderSide?
-
Outline of incoming bubbles.
final
- incomingBubbleColor → Color?
-
Bubble color of messages sent by other users.
final
- incomingTextStyle → TextStyle?
-
Text style inside incoming bubbles.
final
- inputBackgroundColor → Color?
-
Background of the input bar.
final
- inputFieldColor → Color?
-
Fill color of the text field in the input bar.
final
- inputHintStyle → TextStyle?
-
Style of the input bar placeholder.
final
- inputTextStyle → TextStyle?
-
Style of the text typed in the input bar.
final
- linkStyle → TextStyle?
-
Style merged on top of the bubble text style for links.
final
- maxBubbleWidth → double?
-
Absolute maximum bubble width, in logical pixels.
final
- maxBubbleWidthFactor → double?
-
Maximum bubble width as a fraction of the list width.
final
- outgoingBubbleBorderSide → BorderSide?
-
Outline of outgoing bubbles.
final
- outgoingBubbleColor → Color?
-
Bubble color of messages sent by the current user.
final
- outgoingTextStyle → TextStyle?
-
Text style inside outgoing bubbles.
final
- reactionChipColor → Color?
-
Background of reaction chips.
final
- reactionChipSelectedColor → Color?
-
Background of reaction chips that include the current user.
final
- readStatusColor → Color?
-
Color of the "read" status icon.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollButtonColor → Color?
-
Background of the scroll-to-bottom button.
final
- scrollButtonIconColor → Color?
-
Icon color of the scroll-to-bottom button.
final
- sendButtonColor → Color?
-
Background of the send button.
final
- sendButtonIconColor → Color?
-
Icon color of the send button.
final
- systemMessageTextStyle → TextStyle?
-
Style of
SystemMessagetext.final - timestampTextStyle → TextStyle?
-
Style of the time and "edited" label inside bubbles. Its color defaults
to the bubble text color at 70% opacity.
final
- type → Object
-
The extension's type.
no setterinherited
- typingIndicatorColor → Color?
-
Color of the typing indicator dots.
final
- unreadBadgeColor → Color?
-
Background of the unread counter badge.
final
- unreadBadgeTextColor → Color?
-
Text color of the unread counter badge.
final
- unreadSeparatorColor → Color?
-
Color of the "new messages" separator line and label.
final
- userNameTextStyle → TextStyle?
-
Style of author names above incoming groups.
final
Methods
-
copyWith(
{Color? backgroundColor, Color? outgoingBubbleColor, Color? incomingBubbleColor, TextStyle? outgoingTextStyle, TextStyle? incomingTextStyle, TextStyle? linkStyle, TextStyle? codeTextStyle, TextStyle? timestampTextStyle, TextStyle? userNameTextStyle, TextStyle? dateSeparatorTextStyle, Color? dateSeparatorColor, Color? unreadSeparatorColor, TextStyle? systemMessageTextStyle, double? bubbleRadius, double? bubbleGroupedRadius, EdgeInsetsGeometry? bubblePadding, ChatBubbleTail? bubbleTail, double? bubbleTailWidth, double? bubbleTailHeight, double? bubbleElevation, Color? bubbleShadowColor, BorderSide? outgoingBubbleBorderSide, BorderSide? incomingBubbleBorderSide, double? maxBubbleWidth, double? maxBubbleWidthFactor, double? avatarSize, Color? reactionChipColor, Color? reactionChipSelectedColor, Color? highlightColor, Color? inputBackgroundColor, Color? inputFieldColor, TextStyle? inputTextStyle, TextStyle? inputHintStyle, Color? sendButtonColor, Color? sendButtonIconColor, Color? readStatusColor, Color? errorColor, Color? typingIndicatorColor, Color? scrollButtonColor, Color? scrollButtonIconColor, Color? unreadBadgeColor, Color? unreadBadgeTextColor}) → ChatTheme -
Creates a copy of this theme extension with the given fields
replaced by the non-null parameter values.
override
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
lerp(
covariant ChatTheme? other, double t) → ChatTheme -
Linearly interpolate with another ThemeExtension object.
override
-
merge(
ChatTheme? other) → ChatTheme -
Returns a theme where non-null fields of
otherreplace this one's. Text styles are merged. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override