StreamChatTheme class
Design tokens for the Stream Chat Jaspr components.
Unlike the Flutter SDK, where the theme is read from the component tree on every build, this theme is emitted once as a set of CSS custom properties on the root element. Every component stylesheet is written against those variables, so swapping a theme is a single attribute update on one element rather than a rebuild of the whole subtree.
StreamChat(
client: client,
theme: StreamChatTheme.dark(),
child: MyChatPage(),
)
Constructors
- StreamChatTheme({required StreamChatBrightness brightness, required Color primary, required Color primaryHover, required Color onPrimary, required Color background, required Color surface, required Color surfaceHover, required Color border, required Color textPrimary, required Color textSecondary, required Color bubbleOwn, required Color bubbleOwnText, required Color bubbleOther, required Color bubbleOtherText, required Color online, required Color danger, String fontFamily = "system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif", String borderRadius = '18px'})
-
Creates a theme from raw token values.
const
- StreamChatTheme.dark()
-
The default dark theme.
factory
- StreamChatTheme.light()
-
The default light theme.
factory
Properties
- background → Color
-
The page background.
final
- border → Color
-
Colour of separators and outlines.
final
- borderRadius → String
-
Corner radius of message bubbles.
final
- brightness → StreamChatBrightness
-
Whether this theme is light or dark.
final
- bubbleOther → Color
-
Background of other users' message bubbles.
final
- bubbleOtherText → Color
-
Text colour inside bubbleOther.
final
- bubbleOwn → Color
-
Background of the current user's message bubbles.
final
- bubbleOwnText → Color
-
Text colour inside bubbleOwn.
final
-
cssVariables
→ Map<
String, String> -
The CSS custom properties that back streamChatStyles.
no setter
- danger → Color
-
Colour used for errors and destructive actions.
final
- fontFamily → String
-
Font stack applied to the whole chat surface.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- online → Color
-
Colour of the online presence indicator.
final
- onPrimary → Color
-
Foreground colour used on top of primary.
final
- primary → Color
-
Accent colour used for primary actions and own message bubbles.
final
- primaryHover → Color
-
Hover state of primary.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- surface → Color
-
Background of raised panels such as the channel list.
final
- surfaceHover → Color
-
Hover state of surface.
final
- textPrimary → Color
-
Primary body text colour.
final
- textSecondary → Color
-
Muted text colour used for timestamps and previews.
final
Methods
-
copyWith(
{StreamChatBrightness? brightness, Color? primary, Color? primaryHover, Color? onPrimary, Color? background, Color? surface, Color? surfaceHover, Color? border, Color? textPrimary, Color? textSecondary, Color? bubbleOwn, Color? bubbleOwnText, Color? bubbleOther, Color? bubbleOtherText, Color? online, Color? danger, String? fontFamily, String? borderRadius}) → StreamChatTheme - Returns a copy of this theme with the given tokens replaced.
-
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