@cometchat/skills 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -17
  3. package/bin/install.js +389 -43
  4. package/package.json +19 -9
  5. package/skills/cometchat/SKILL.md +1066 -265
  6. package/skills/cometchat-android-v5/SKILL.md +120 -0
  7. package/skills/cometchat-android-v5-components/SKILL.md +430 -0
  8. package/skills/cometchat-android-v5-core/SKILL.md +468 -0
  9. package/skills/cometchat-android-v5-customization/SKILL.md +305 -0
  10. package/skills/cometchat-android-v5-extensions/SKILL.md +124 -0
  11. package/skills/cometchat-android-v5-features/SKILL.md +130 -0
  12. package/skills/cometchat-android-v5-placement/SKILL.md +276 -0
  13. package/skills/cometchat-android-v5-production/SKILL.md +94 -0
  14. package/skills/cometchat-android-v5-push/SKILL.md +620 -0
  15. package/skills/cometchat-android-v5-testing/SKILL.md +187 -0
  16. package/skills/cometchat-android-v5-theming/SKILL.md +166 -0
  17. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +73 -0
  18. package/skills/cometchat-android-v6/SKILL.md +107 -0
  19. package/skills/cometchat-android-v6-builder-settings/SKILL.md +145 -0
  20. package/skills/cometchat-android-v6-compose-components/SKILL.md +202 -0
  21. package/skills/cometchat-android-v6-compose-customization/SKILL.md +280 -0
  22. package/skills/cometchat-android-v6-compose-placement/SKILL.md +213 -0
  23. package/skills/cometchat-android-v6-compose-theming/SKILL.md +224 -0
  24. package/skills/cometchat-android-v6-core/SKILL.md +354 -0
  25. package/skills/cometchat-android-v6-events/SKILL.md +212 -0
  26. package/skills/cometchat-android-v6-extensions/SKILL.md +191 -0
  27. package/skills/cometchat-android-v6-features/SKILL.md +130 -0
  28. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +197 -0
  29. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +268 -0
  30. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +248 -0
  31. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +202 -0
  32. package/skills/cometchat-android-v6-production/SKILL.md +187 -0
  33. package/skills/cometchat-android-v6-push/SKILL.md +274 -0
  34. package/skills/cometchat-android-v6-testing/SKILL.md +279 -0
  35. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +249 -0
  36. package/skills/cometchat-angular-components/SKILL.md +706 -0
  37. package/skills/cometchat-angular-core/SKILL.md +444 -0
  38. package/skills/cometchat-angular-customization/SKILL.md +424 -0
  39. package/skills/cometchat-angular-features/SKILL.md +447 -0
  40. package/skills/cometchat-angular-patterns/SKILL.md +447 -0
  41. package/skills/cometchat-angular-placement/SKILL.md +685 -0
  42. package/skills/cometchat-angular-production/SKILL.md +415 -0
  43. package/skills/cometchat-angular-theming/SKILL.md +365 -0
  44. package/skills/cometchat-angular-troubleshooting/SKILL.md +329 -0
  45. package/skills/cometchat-astro-patterns/SKILL.md +3 -3
  46. package/skills/cometchat-components/SKILL.md +11 -0
  47. package/skills/cometchat-core/SKILL.md +11 -6
  48. package/skills/cometchat-customization/references/component-catalog.md +1 -1
  49. package/skills/cometchat-features/SKILL.md +176 -108
  50. package/skills/cometchat-flutter-v5/SKILL.md +167 -0
  51. package/skills/cometchat-flutter-v5-calls/SKILL.md +192 -0
  52. package/skills/cometchat-flutter-v5-conversations/SKILL.md +117 -0
  53. package/skills/cometchat-flutter-v5-core/SKILL.md +221 -0
  54. package/skills/cometchat-flutter-v5-customization/SKILL.md +227 -0
  55. package/skills/cometchat-flutter-v5-events/SKILL.md +155 -0
  56. package/skills/cometchat-flutter-v5-messages/SKILL.md +258 -0
  57. package/skills/cometchat-flutter-v5-production/SKILL.md +207 -0
  58. package/skills/cometchat-flutter-v5-push/SKILL.md +284 -0
  59. package/skills/cometchat-flutter-v5-theming/SKILL.md +160 -0
  60. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +129 -0
  61. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +151 -0
  62. package/skills/cometchat-flutter-v6/SKILL.md +445 -0
  63. package/skills/cometchat-flutter-v6-calls/SKILL.md +333 -0
  64. package/skills/cometchat-flutter-v6-components/SKILL.md +365 -0
  65. package/skills/cometchat-flutter-v6-conversations/SKILL.md +210 -0
  66. package/skills/cometchat-flutter-v6-core/SKILL.md +305 -0
  67. package/skills/cometchat-flutter-v6-customization/SKILL.md +666 -0
  68. package/skills/cometchat-flutter-v6-events/SKILL.md +216 -0
  69. package/skills/cometchat-flutter-v6-features/SKILL.md +406 -0
  70. package/skills/cometchat-flutter-v6-messages/SKILL.md +333 -0
  71. package/skills/cometchat-flutter-v6-migration/SKILL.md +381 -0
  72. package/skills/cometchat-flutter-v6-placement/SKILL.md +398 -0
  73. package/skills/cometchat-flutter-v6-production/SKILL.md +632 -0
  74. package/skills/cometchat-flutter-v6-theming/SKILL.md +260 -0
  75. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +726 -0
  76. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +216 -0
  77. package/skills/cometchat-ios/SKILL.md +323 -0
  78. package/skills/cometchat-ios-components/SKILL.md +651 -0
  79. package/skills/cometchat-ios-core/SKILL.md +822 -0
  80. package/skills/cometchat-ios-customization/SKILL.md +825 -0
  81. package/skills/cometchat-ios-features/SKILL.md +725 -0
  82. package/skills/cometchat-ios-placement/SKILL.md +750 -0
  83. package/skills/cometchat-ios-production/SKILL.md +730 -0
  84. package/skills/cometchat-ios-push/SKILL.md +582 -0
  85. package/skills/cometchat-ios-theming/SKILL.md +631 -0
  86. package/skills/cometchat-ios-troubleshooting/SKILL.md +983 -0
  87. package/skills/cometchat-native-bare-patterns/SKILL.md +470 -0
  88. package/skills/cometchat-native-components/SKILL.md +594 -0
  89. package/skills/cometchat-native-core/SKILL.md +407 -0
  90. package/skills/cometchat-native-customization/SKILL.md +594 -0
  91. package/skills/cometchat-native-expo-patterns/SKILL.md +485 -0
  92. package/skills/cometchat-native-features/SKILL.md +608 -0
  93. package/skills/cometchat-native-placement/SKILL.md +500 -0
  94. package/skills/cometchat-native-production/SKILL.md +694 -0
  95. package/skills/cometchat-native-push/SKILL.md +593 -0
  96. package/skills/cometchat-native-testing/SKILL.md +583 -0
  97. package/skills/cometchat-native-theming/SKILL.md +656 -0
  98. package/skills/cometchat-native-troubleshooting/SKILL.md +433 -0
  99. package/skills/cometchat-nextjs-patterns/SKILL.md +5 -5
  100. package/skills/cometchat-production/SKILL.md +60 -0
  101. package/skills/cometchat-react-router-patterns/SKILL.md +23 -21
@@ -0,0 +1,260 @@
1
+ ---
2
+ name: cometchat-flutter-v6-theming
3
+ description: >
4
+ Use when customizing the visual appearance of CometChat Flutter UIKit v6 components.
5
+ Triggers on mentions of CometChatThemeHelper, CometChatColorPalette, CometChatSpacing,
6
+ CometChatTypography, CometChatThemeMode, dark mode, light mode, theme, colors, styling,
7
+ custom theme, Style class, merge(), getColorPalette, getSpacing, getTypography,
8
+ ThemeExtension, primary color, neutral colors, background colors, text colors, icon colors,
9
+ button colors, border colors, or any CometChat{Component}Style class. Also use when the
10
+ user asks about changing colors, fonts, spacing, or appearance of chat components.
11
+ license: "MIT"
12
+ compatibility: "cometchat_chat_uikit ^6.0.0-beta2; flutter >=2.5.0"
13
+ allowed-tools: "executeBash, readFile, readCode, fileSearch, listDirectory, grepSearch"
14
+ metadata:
15
+ author: "CometChat"
16
+ version: "3.0.0"
17
+ tags: "cometchat flutter theme colors typography spacing dark-mode styling"
18
+ ---
19
+
20
+ # CometChat Flutter UIKit — Theming & Styling
21
+
22
+ How to customize the visual appearance of all CometChat components.
23
+
24
+ ## Theme System Architecture
25
+
26
+ Three layers, resolved via Flutter's `ThemeExtension` system:
27
+
28
+ 1. `CometChatColorPalette` — all colors (primary, neutral, alert, background, text, icon, button, border)
29
+ 2. `CometChatSpacing` — spacing tokens
30
+ 3. `CometChatTypography` — text styles (heading1-4, body, caption1-2, button, link, title)
31
+
32
+ Access via static helpers:
33
+ ```dart
34
+ final colors = CometChatThemeHelper.getColorPalette(context);
35
+ final spacing = CometChatThemeHelper.getSpacing(context);
36
+ final typography = CometChatThemeHelper.getTypography(context);
37
+ ```
38
+
39
+ ## Applying a Custom Theme
40
+
41
+ Register `CometChatColorPalette` as a `ThemeExtension` on your `ThemeData`:
42
+
43
+ ```dart
44
+ MaterialApp(
45
+ theme: ThemeData(
46
+ brightness: Brightness.light,
47
+ extensions: [
48
+ CometChatColorPalette(
49
+ primary: const Color(0xFF6852D6),
50
+ background1: Colors.white,
51
+ textPrimary: const Color(0xFF141414),
52
+ // ... override only what you need, rest falls back to defaults
53
+ ),
54
+ ],
55
+ ),
56
+ darkTheme: ThemeData(
57
+ brightness: Brightness.dark,
58
+ extensions: [
59
+ CometChatColorPalette(
60
+ primary: const Color(0xFF604CC3),
61
+ background1: const Color(0xFF141414),
62
+ textPrimary: Colors.white,
63
+ ),
64
+ ],
65
+ ),
66
+ )
67
+ ```
68
+
69
+ Note: `CometChatColorPalette` does NOT have a `const` constructor (it has mutable default fields for `white`, `black`, `transparent`). Don't try `const CometChatColorPalette(...)` — it won't compile.
70
+
71
+ ## Dark Mode
72
+
73
+ `CometChatThemeMode` controls how brightness is resolved:
74
+
75
+ ```dart
76
+ // Follow system setting (default)
77
+ CometChatThemeMode.mode = ThemeMode.system;
78
+
79
+ // Force light
80
+ CometChatThemeMode.mode = ThemeMode.light;
81
+
82
+ // Force dark
83
+ CometChatThemeMode.mode = ThemeMode.dark;
84
+ ```
85
+
86
+ The helper reads brightness via:
87
+ ```dart
88
+ // ThemeMode.system → MediaQuery.of(context).platformBrightness
89
+ // ThemeMode.light → Brightness.light
90
+ // ThemeMode.dark → Brightness.dark
91
+ ```
92
+
93
+ ## Color Palette Tokens
94
+
95
+ | Category | Tokens | Default Source |
96
+ |----------|--------|---------------|
97
+ | Primary | `primary` | `#6852D6` light / `#604CC3` dark |
98
+ | Extended Primary | `extendedPrimary50`–`900` | Auto-generated from primary via blend |
99
+ | Neutral | `neutral50`–`900` | 10-shade grayscale |
100
+ | Alert | `info`, `warning`, `error`, `success`, `error100` | Semantic colors |
101
+ | Background | `background1`–`4` | Mapped from neutral shades |
102
+ | Text | `textPrimary`, `textSecondary`, `textTertiary`, `textDisabled`, `textWhite`, `textHighlight` | Mapped from neutral/primary |
103
+ | Icon | `iconPrimary`, `iconSecondary`, `iconTertiary`, `iconWhite`, `iconHighlight` | Mapped from neutral/primary |
104
+ | Button | `buttonBackground`, `secondaryButtonBackground`, `buttonText`, `buttonIconColor`, `secondaryButtonText`, `secondaryButtonIcon` | Primary + neutral |
105
+ | Border | `borderLight`, `borderDefault`, `borderDark`, `borderHighlight` | Neutral shades + primary |
106
+ | Special | `white`, `black`, `messageSeen` | Fixed values |
107
+
108
+ ## Component Style Classes
109
+
110
+ Every component has a `CometChat{Component}Style` class with a `merge()` method:
111
+
112
+ ```dart
113
+ CometChatConversations(
114
+ conversationsStyle: CometChatConversationsStyle(
115
+ backgroundColor: colors.background1,
116
+ titleStyle: typography.heading3?.bold,
117
+ ),
118
+ )
119
+
120
+ CometChatMessageList(
121
+ style: CometChatMessageListStyle(
122
+ backgroundColor: colors.background3,
123
+ ),
124
+ )
125
+ ```
126
+
127
+ Style classes support `merge()` for combining defaults with overrides:
128
+ ```dart
129
+ final baseStyle = CometChatConversationsStyle(backgroundColor: Colors.white);
130
+ final override = CometChatConversationsStyle(titleStyle: myTitleStyle);
131
+ final merged = baseStyle.merge(override); // backgroundColor + titleStyle
132
+ ```
133
+
134
+ ## Theme Caching (Performance-Critical)
135
+
136
+ Cache theme in `didChangeDependencies()` — never in `build()`:
137
+
138
+ ```dart
139
+ class _MyWidgetState extends State<MyWidget> {
140
+ late CometChatColorPalette _colorPalette;
141
+ bool _themeInitialized = false;
142
+
143
+ @override
144
+ void didChangeDependencies() {
145
+ super.didChangeDependencies();
146
+ if (!_themeInitialized) {
147
+ _colorPalette = CometChatThemeHelper.getColorPalette(context);
148
+ _themeInitialized = true;
149
+ }
150
+ }
151
+
152
+ @override
153
+ Widget build(BuildContext context) {
154
+ return Container(color: _colorPalette.primary); // Cached, no lookup
155
+ }
156
+ }
157
+ ```
158
+
159
+ For child widgets that receive theme from parent (hybrid pattern):
160
+ ```dart
161
+ class CometChatImageBubble extends StatefulWidget {
162
+ final CometChatColorPalette? colorPalette; // Optional — parent can pass cached value
163
+ // ...
164
+ }
165
+
166
+ class _CometChatImageBubbleState extends State<CometChatImageBubble> {
167
+ late CometChatColorPalette colorPalette;
168
+ bool _themeInitialized = false;
169
+
170
+ @override
171
+ void didChangeDependencies() {
172
+ super.didChangeDependencies();
173
+ if (!_themeInitialized) {
174
+ colorPalette = widget.colorPalette ?? CometChatThemeHelper.getColorPalette(context);
175
+ _themeInitialized = true;
176
+ }
177
+ }
178
+
179
+ @override
180
+ void didUpdateWidget(CometChatImageBubble oldWidget) {
181
+ super.didUpdateWidget(oldWidget);
182
+ if (widget.colorPalette != oldWidget.colorPalette && widget.colorPalette != null) {
183
+ colorPalette = widget.colorPalette!;
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ ## Gotchas
190
+
191
+ - `CometChatColorPalette` is NOT const-constructible. It has mutable default fields (`white = Colors.white`, `black = Colors.black`, `transparent = Colors.transparent`). Writing `const CometChatColorPalette(...)` or `const [CometChatColorPalette()]` won't compile.
192
+ - `CometChatThemeHelper.getColorPalette(context)` does `Theme.of(context).extension<CometChatColorPalette>()` internally — this is an InheritedWidget lookup. In `build()` during keyboard animation, this fires every frame causing 44-95ms build times.
193
+ - Extended primary colors are auto-generated by blending `primary` with white (light) or black (dark). Override individual shades only if the auto-blend doesn't match your brand.
194
+ - `CometChatThemeMode.mode` is a static field — changing it doesn't trigger rebuilds. You need to also change `ThemeData` brightness or call `setState` on the `MaterialApp`.
195
+ - Style `merge()` is null-aware: only non-null fields from the override replace the base. This means you can't explicitly set a field to `null` via merge.
196
+
197
+ ## Anti-Patterns
198
+
199
+ ```dart
200
+ // ❌ WRONG — hardcoded colors
201
+ Container(color: Colors.purple)
202
+
203
+ // ✅ CORRECT — use theme tokens
204
+ Container(color: colorPalette.primary)
205
+ ```
206
+
207
+ ```dart
208
+ // ❌ WRONG — theme lookup in build
209
+ @override
210
+ Widget build(BuildContext context) {
211
+ final colors = CometChatThemeHelper.getColorPalette(context);
212
+ return Text('Hi', style: TextStyle(color: colors.textPrimary));
213
+ }
214
+
215
+ // ❌ ALSO WRONG — theme lookup in a method called from build
216
+ Widget _buildProfileMenu() {
217
+ final typography = CometChatThemeHelper.getTypography(context); // Still in build tree!
218
+ final spacing = CometChatThemeHelper.getSpacing(context);
219
+ // ...
220
+ }
221
+
222
+ // ✅ CORRECT — cached in didChangeDependencies
223
+ late CometChatColorPalette _colors;
224
+ late CometChatTypography _typography;
225
+ late CometChatSpacing _spacing;
226
+ bool _init = false;
227
+ @override
228
+ void didChangeDependencies() {
229
+ super.didChangeDependencies();
230
+ if (!_init) {
231
+ _colors = CometChatThemeHelper.getColorPalette(context);
232
+ _typography = CometChatThemeHelper.getTypography(context);
233
+ _spacing = CometChatThemeHelper.getSpacing(context);
234
+ _init = true;
235
+ }
236
+ }
237
+ @override
238
+ Widget build(BuildContext context) {
239
+ return Text('Hi', style: TextStyle(color: _colors.textPrimary));
240
+ }
241
+ ```
242
+
243
+ ```dart
244
+ // ❌ WRONG — MediaQuery.of(context).size triggers full rebuild
245
+ final size = MediaQuery.of(context).size;
246
+
247
+ // ✅ CORRECT — only subscribes to size changes
248
+ final size = MediaQuery.sizeOf(context);
249
+ ```
250
+
251
+ ## Checklist
252
+
253
+ - [ ] Custom colors registered as `ThemeExtension` on `ThemeData`
254
+ - [ ] Both `theme` and `darkTheme` configured if supporting dark mode
255
+ - [ ] Theme values cached in `didChangeDependencies()`, not `build()`
256
+ - [ ] No `CometChatThemeHelper.get*()` calls in any method invoked during `build()` (including helper methods like `_buildProfileMenu()`)
257
+ - [ ] `_themeInitialized` flag prevents re-init during keyboard animation
258
+ - [ ] No hardcoded colors — all from `CometChatColorPalette`
259
+ - [ ] `MediaQuery.sizeOf(context)` used instead of `MediaQuery.of(context).size`
260
+ - [ ] Style overrides use component's Style class, not inline styles