Skillquality 0.46

cometchat-flutter-v5-theming

Use when customizing the visual appearance of CometChat Flutter UIKit v5 components. Triggers on CometChatThemeHelper, CometChatColorPalette, CometChatSpacing, CometChatTypography, Style classes, merge().

Price
free
Protocol
skill
Verified
no

What it does

CometChat Flutter UIKit v5 — Theming & Styling

How to customize the visual appearance of all CometChat v5 components.

Theme System Architecture

Three layers, resolved via Flutter's ThemeExtension system:

  1. CometChatColorPalette — colors (primary, neutral, alert, background, text, icon, button, border)
  2. CometChatSpacing — spacing, padding, margin, and radius tokens
  3. CometChatTypography — text styles (heading1-4, body, caption1-2, button, link, title)

Access via static helpers:

final colors = CometChatThemeHelper.getColorPalette(context);
final spacing = CometChatThemeHelper.getSpacing(context);
final typography = CometChatThemeHelper.getTypography(context);

Important: getColorPalette() creates a new object every call, resolving each token via Theme.of(context). Cache in didChangeDependencies(), never call in build().

Applying a Custom Theme

Register CometChatColorPalette as a ThemeExtension on your ThemeData:

// ✅ CORRECT
MaterialApp(
  theme: ThemeData(
    extensions: [
      CometChatColorPalette(
        primary: const Color(0xFF6852D6),
        textPrimary: const Color(0xFF141414),
        textSecondary: const Color(0xFF727272),
      ),
    ],
  ),
  darkTheme: ThemeData(
    extensions: [
      CometChatColorPalette(
        primary: const Color(0xFF604CC3),
        textPrimary: const Color(0xFFFFFFFF),
        textSecondary: const Color(0xFFA0A0A0),
      ),
    ],
  ),
)

Dark Mode

CometChatThemeMode.mode = ThemeMode.dark;   // Force dark
CometChatThemeMode.mode = ThemeMode.system;  // Follow system

Commonly Used Color Tokens

TokenDescriptionLight DefaultDark Default
primaryBrand color#6852D6#604CC3
background14Surface backgroundsneutral50→neutral300neutral50→neutral300
textPrimaryMain textneutral900neutral900
textSecondarySecondary textneutral600neutral600
borderLightSubtle bordersneutral200neutral200
iconPrimaryMain iconsneutral900neutral900
iconSecondarySecondary iconsneutral500neutral500
iconHighlightHighlighted iconsprimaryprimary
errorError states#F44649#C73C3E
white / blackFixed (NOT brightness-aware)Colors.white / Colors.blackSame
transparentTransparentColors.transparentSame
neutral600Used for date styles

Extended primary shades (extendedPrimary50900) are auto-generated from primary. Override individually if needed.

Commonly Used Spacing Tokens

TokenDefault
padding / spacing / radius2
padding1 / spacing1 / radius14
padding2 / spacing2 / radius28
padding3 / spacing3 / radius312
padding4 / spacing4 / radius416
padding5 / spacing5 / radius520
padding6 / spacing624
radiusMax / spacingMax1000

Typography Tokens

CometChatTypography provides: heading1heading4, body, caption1, caption2, button, link, title.

Each has .bold, .medium, .regular variants:

typography.body?.regular?.fontSize
typography.heading2?.bold?.fontWeight
typography.caption1?.regular?.fontFamily

Theme Caching Pattern (from package source)

All UIKit components cache theme unconditionally in didChangeDependencies():

// ✅ CORRECT — matches actual package pattern
@override
void didChangeDependencies() {
  super.didChangeDependencies();
  colorPalette = CometChatThemeHelper.getColorPalette(context);
  spacing = CometChatThemeHelper.getSpacing(context);
  typography = CometChatThemeHelper.getTypography(context);
}

Do NOT use a _themeInitialized flag — it prevents theme updates on system theme changes.

Component Style Classes — merge() Pattern

Every component has a CometChat{Component}Style extending ThemeExtension. Resolved internally:

// Inside component's didChangeDependencies():
style = CometChatThemeHelper.getTheme<CometChatConversationsStyle>(
    context: context,
    defaultTheme: CometChatConversationsStyle.of,
).merge(widget.conversationsStyle);

Pass overrides via constructor:

CometChatConversations(
  conversationsStyle: CometChatConversationsStyle(
    backgroundColor: Colors.black,
  ),
)

Gotchas

  • colorPalette.white / black / transparent are NOT brightness-aware — use neutral50 for brightness-aware white
  • Extended primary shades auto-generated from primary by blending with white (light) or black (dark)

Checklist — Theming

  • Colors from CometChatThemeHelper.getColorPalette(context), never hardcoded
  • Theme cached in didChangeDependencies(), not build()
  • Custom theme registered as ThemeExtension on both theme and darkTheme
  • Component styles passed via constructor props

Capabilities

skillsource-cometchatskill-cometchat-flutter-v5-themingtopic-agent-skillstopic-ai-agenttopic-chattopic-claude-codetopic-cometchattopic-cursortopic-messagingtopic-nextjstopic-reacttopic-react-nativetopic-ui-kit

Install

Quality

0.46/ 1.00

deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 27 github stars · SKILL.md body (4,981 chars)

Provenance

Indexed fromgithub
Enriched2026-05-18 19:04:50Z · deterministic:skill-github:v1 · v1
First seen2026-05-07
Last seen2026-05-18

Agent access

cometchat-flutter-v5-theming — Clawmart · Clawmart