@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,333 @@
1
+ ---
2
+ name: cometchat-flutter-v6-messages
3
+ description: >
4
+ Use when implementing the messages screen with CometChat Flutter UIKit v6. Covers
5
+ CometChatMessageList, CometChatMessageComposer, CometChatMessageHeader, MessageListBloc,
6
+ MessageComposerBloc, SliverSpacing, keyboard-aware spacing, rich text toolbar,
7
+ CometChatTextBubble, CometChatImageBubble, CometChatVideoBubble, CometChatAudioBubble,
8
+ CometChatFileBubble, CometChatMessageBubble, bubble factories, message templates,
9
+ send message, edit message, delete message, reply, thread, reactions, receipts,
10
+ typing indicators, mentions, markdown formatting, text formatters, scroll to bottom,
11
+ unread messages, mark as read, goToMessageId, message options, swipe to reply,
12
+ smart replies, conversation starters, or resizeToAvoidBottomInset. Also use when
13
+ the user asks about building a chat screen, message input, or message display.
14
+ license: "MIT"
15
+ compatibility: "cometchat_chat_uikit ^6.0.0-beta2; flutter_bloc ^8.1.0"
16
+ allowed-tools: "executeBash, readFile, readCode, fileSearch, listDirectory, grepSearch"
17
+ metadata:
18
+ author: "CometChat"
19
+ version: "3.0.0"
20
+ tags: "cometchat flutter messages composer header bubbles keyboard rich-text"
21
+ ---
22
+
23
+ # CometChat Flutter UIKit — Messages
24
+
25
+ The messages screen is composed of three components: `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer`.
26
+
27
+ ## Complete Messages Screen
28
+
29
+ ```dart
30
+ Scaffold(
31
+ resizeToAvoidBottomInset: false, // REQUIRED — composer handles keyboard internally
32
+ appBar: CometChatMessageHeader(
33
+ user: user,
34
+ group: group,
35
+ onBack: () => Navigator.pop(context),
36
+ ),
37
+ body: Column(
38
+ children: [
39
+ Expanded(
40
+ child: CometChatMessageList(
41
+ user: user,
42
+ group: group,
43
+ textFormatters: [
44
+ CometChatMentionsFormatter(user: user, group: group),
45
+ MarkdownTextFormatter(),
46
+ CometChatUrlFormatter(),
47
+ CometChatPhoneNumberFormatter(),
48
+ CometChatEmailFormatter(),
49
+ ],
50
+ ),
51
+ ),
52
+ CometChatMessageComposer(
53
+ user: user,
54
+ group: group,
55
+ textFormatters: [
56
+ CometChatMentionsFormatter(user: user, group: group),
57
+ MarkdownTextFormatter(),
58
+ CometChatUrlFormatter(),
59
+ ],
60
+ ),
61
+ ],
62
+ ),
63
+ )
64
+ ```
65
+
66
+ ## CometChatMessageList
67
+
68
+ Displays messages with `SliverAnimatedList`, O(1) lookups, and keyboard-aware spacing.
69
+
70
+ ### Key Props
71
+
72
+ | Prop | Type | Purpose |
73
+ |------|------|---------|
74
+ | `user` / `group` | `User?` / `Group?` | Target conversation (one required) |
75
+ | `goToMessageId` | `int?` | Jump to specific message on load |
76
+ | `startFromUnreadMessages` | `bool` | Start from unread position |
77
+ | `hideDeletedMessages` | `bool` | Hide deleted message placeholders |
78
+ | `disableReceipts` | `bool` | Hide read/delivered receipts |
79
+ | `disableReactions` | `bool` | Hide reaction bar |
80
+ | `enableSwipeToReply` | `bool` | Swipe gesture for reply |
81
+ | `hideDateSeparator` | `bool` | Hide date headers |
82
+ | `textFormatters` | `List<CometChatTextFormatter>` | Formatters for message text |
83
+ | `onThreadRepliesClick` | `Function(BaseMessage, BuildContext, {template})` | Thread navigation callback |
84
+
85
+ ### MessageListBloc Events
86
+
87
+ | Event | Purpose |
88
+ |-------|---------|
89
+ | `LoadMessages(conversationWith, conversationType)` | Initial load |
90
+ | `LoadOlderMessages` | Scroll up pagination |
91
+ | `LoadNewerMessages` | Scroll down pagination |
92
+ | `MessageReceived(message)` | Real-time incoming message |
93
+ | `MessageEdited(message)` | Real-time edit |
94
+ | `MessageDeleted(message)` | Real-time delete |
95
+ | `JumpToMessage(messageId)` | Scroll to specific message |
96
+ | `MarkMessageAsRead(message)` | Mark as read |
97
+ | `MarkMessageAsUnread(message)` | Mark as unread |
98
+
99
+ ### MessageListState
100
+
101
+ ```dart
102
+ MessageListState(
103
+ status: MessageListStatus.loaded, // initial, loading, loaded, empty, error
104
+ messages: [...],
105
+ isLoadingOlder: false,
106
+ isLoadingNewer: false,
107
+ hasMoreOlder: true,
108
+ hasMoreNewer: false,
109
+ unreadCount: 5,
110
+ unreadMessageAnchor: message,
111
+ )
112
+ ```
113
+
114
+ ## CometChatMessageComposer
115
+
116
+ Rich text input with formatting toolbar, attachments, mentions, and audio recording.
117
+
118
+ ### Key Props
119
+
120
+ | Prop | Type | Purpose |
121
+ |------|------|---------|
122
+ | `user` / `group` | `User?` / `Group?` | Target conversation |
123
+ | `disableTypingEvents` | `bool` | Stop sending typing indicators |
124
+ | `hideVoiceRecordingButton` | `bool` | Hide audio recorder |
125
+ | `hideSendButton` | `bool` | Hide send button |
126
+ | `hideAttachmentButton` | `bool` | Hide attachment picker |
127
+ | `hideStickersButton` | `bool` | Hide sticker panel |
128
+ | `disableMentions` | `bool` | Disable @mentions |
129
+ | `hideBottomSafeArea` | `bool` | Hide bottom safe area padding |
130
+ | `textFormatters` | `List<CometChatTextFormatter>` | Text formatters |
131
+
132
+ ### Rich Text Formatting
133
+
134
+ The composer uses a WYSIWYG system (not the clean architecture module):
135
+ - `RichTextEditingController` — span tracking, markdown rendering, format application
136
+ - `SegmentComposerController` — multi-segment (normal text + code blocks)
137
+ - Toolbar buttons dispatch through `cometchat_message_composer.dart`
138
+
139
+ ### buildWhen Optimization
140
+
141
+ The composer uses `buildWhen` to prevent rebuilds during keyboard animation:
142
+ ```dart
143
+ BlocConsumer<MessageComposerBloc, MessageComposerState>(
144
+ buildWhen: (previous, current) =>
145
+ previous.isEditMode != current.isEditMode ||
146
+ previous.isReplyMode != current.isReplyMode ||
147
+ previous.isRecordingMode != current.isRecordingMode,
148
+ // ...
149
+ )
150
+ ```
151
+
152
+ ## CometChatMessageHeader
153
+
154
+ Shows user/group info, typing indicators, and optional call buttons.
155
+
156
+ ```dart
157
+ CometChatMessageHeader(
158
+ user: user,
159
+ group: group,
160
+ onBack: () => Navigator.pop(context),
161
+ hideVideoCallButton: false,
162
+ hideVoiceCallButton: false,
163
+ usersStatusVisibility: true,
164
+ trailingView: (user, group, ctx) => [
165
+ IconButton(icon: Icon(Icons.info_outline), onPressed: () { /* ... */ }),
166
+ ],
167
+ messageHeaderStyle: CometChatMessageHeaderStyle(
168
+ backgroundColor: colorPalette.background1,
169
+ ),
170
+ )
171
+ ```
172
+
173
+ ## Keyboard-Aware Spacing
174
+
175
+ `SliverSpacing` handles keyboard interaction:
176
+ - At bottom: keyboard pushes list up (normal behavior)
177
+ - Scrolled up: list stays still, only composer moves
178
+ - Safe area: only added when keyboard is closed
179
+
180
+ This is why `resizeToAvoidBottomInset: false` is mandatory.
181
+
182
+ ## Message Bubbles
183
+
184
+ | Type | Widget | Key Features |
185
+ |------|--------|--------------|
186
+ | Text | `CometChatTextBubble` | Rich text, links, markdown |
187
+ | Image | `CometChatImageBubble` | Local/network, GIF, HEIC fallback |
188
+ | Video | `CometChatVideoBubble` | Thumbnail, play overlay |
189
+ | Audio | `CometChatAudioBubble` | Waveform, play/pause, duration |
190
+ | File | `CometChatFileBubble` | Type icon, download, size |
191
+ | Deleted | `CometChatDeletedBubble` | "Message was deleted" |
192
+
193
+ All bubble widgets accept optional `colorPalette`, `spacing`, `typography` params for the hybrid theme caching pattern.
194
+
195
+ ## Sending Messages
196
+
197
+ ```dart
198
+ // Text message
199
+ await CometChatUIKit.sendTextMessage(
200
+ TextMessage(
201
+ text: 'Hello!',
202
+ receiverUid: user.uid,
203
+ receiverType: ReceiverTypeConstants.user,
204
+ ),
205
+ );
206
+
207
+ // Media message
208
+ await CometChatUIKit.sendMediaMessage(
209
+ MediaMessage(
210
+ file: '/path/to/image.jpg',
211
+ type: MessageTypeConstants.image,
212
+ receiverUid: user.uid,
213
+ receiverType: ReceiverTypeConstants.user,
214
+ ),
215
+ );
216
+
217
+ // Custom message
218
+ await CometChatUIKit.sendCustomMessage(
219
+ CustomMessage(
220
+ type: 'location',
221
+ receiverUid: user.uid,
222
+ receiverType: ReceiverTypeConstants.user,
223
+ customData: {'latitude': 37.7749, 'longitude': -122.4194},
224
+ ),
225
+ );
226
+ ```
227
+
228
+ ## Thread Replies
229
+
230
+ ```dart
231
+ CometChatMessageList(
232
+ onThreadRepliesClick: (message, ctx, {template}) {
233
+ Navigator.push(context, MaterialPageRoute(
234
+ builder: (_) => Scaffold(
235
+ resizeToAvoidBottomInset: false,
236
+ body: Column(
237
+ children: [
238
+ CometChatThreadedHeader(
239
+ parentMessage: message,
240
+ loggedInUser: CometChatUIKit.loggedInUser!,
241
+ ),
242
+ Expanded(child: CometChatMessageList(
243
+ user: user, group: group,
244
+ parentMessageId: message.id,
245
+ )),
246
+ CometChatMessageComposer(
247
+ user: user, group: group,
248
+ parentMessageId: message.id,
249
+ ),
250
+ ],
251
+ ),
252
+ ),
253
+ ));
254
+ },
255
+ )
256
+ ```
257
+
258
+ ## Gotchas
259
+
260
+ - Forgetting `resizeToAvoidBottomInset: false` causes double keyboard compensation — the most common bug when integrating the messages screen. This applies to thread screens too — any Scaffold containing a `CometChatMessageComposer` must set it to `false`.
261
+ - `textFormatters` should be the same list for both `CometChatMessageList` and `CometChatMessageComposer` to ensure consistent rendering.
262
+ - The rich text system has 3 implementations but only WYSIWYG is active at runtime. Bug fixes go in `rich_text_editing_controller.dart`, not the clean architecture module.
263
+ - `goToMessageId` loads messages around that ID, not from the beginning. The list may not have older messages loaded.
264
+ - Keep mutable `_user`/`_group` copies in your State class and update them from SDK listeners. Passing `widget.user`/`widget.group` directly means stale data after block/kick events.
265
+ - The CometChat SDK has an `Action` class (a `BaseMessage` subclass used in group events like kick/ban/scope-change). It conflicts with Flutter's built-in `Action` widget. If your messages screen uses SDK listener mixins that reference `Action`, use an import alias:
266
+ ```dart
267
+ import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart' as cc;
268
+ // Then use: cc.Action instead of Action
269
+ ```
270
+ This is especially common when mixing `GroupListener` into a messages screen State class.
271
+
272
+ ## Anti-Patterns
273
+
274
+ ```dart
275
+ // ❌ WRONG — missing resizeToAvoidBottomInset
276
+ Scaffold(
277
+ body: Column(children: [
278
+ Expanded(child: CometChatMessageList(user: user)),
279
+ CometChatMessageComposer(user: user),
280
+ ]),
281
+ )
282
+
283
+ // ❌ WRONG — thread screen with resizeToAvoidBottomInset: true
284
+ Scaffold(
285
+ resizeToAvoidBottomInset: true, // Double compensation!
286
+ body: Column(children: [
287
+ CometChatThreadedHeader(parentMessage: message, loggedInUser: user),
288
+ Expanded(child: CometChatMessageList(user: user, parentMessageId: message.id)),
289
+ CometChatMessageComposer(user: user, parentMessageId: message.id),
290
+ ]),
291
+ )
292
+
293
+ // ✅ CORRECT — both messages and thread screens
294
+ Scaffold(
295
+ resizeToAvoidBottomInset: false,
296
+ body: Column(children: [
297
+ Expanded(child: CometChatMessageList(user: user)),
298
+ CometChatMessageComposer(user: user),
299
+ ]),
300
+ )
301
+ ```
302
+
303
+ ```dart
304
+ // ❌ WRONG — passing immutable widget params to UIKit components
305
+ CometChatMessageList(user: widget.user) // Stale after block/unblock
306
+
307
+ // ✅ CORRECT — mutable state copy
308
+ late User? _user = widget.user;
309
+ // Update _user from SDK listeners
310
+ CometChatMessageList(user: _user)
311
+ ```
312
+
313
+ ```dart
314
+ // ❌ WRONG — different formatters for list and composer
315
+ CometChatMessageList(textFormatters: [MarkdownTextFormatter()])
316
+ CometChatMessageComposer(textFormatters: []) // Inconsistent rendering
317
+
318
+ // ✅ CORRECT — same formatters
319
+ final formatters = [CometChatMentionsFormatter(user: user), MarkdownTextFormatter()];
320
+ CometChatMessageList(textFormatters: formatters)
321
+ CometChatMessageComposer(textFormatters: formatters)
322
+ ```
323
+
324
+ ## Checklist
325
+
326
+ - [ ] Scaffold has `resizeToAvoidBottomInset: false`
327
+ - [ ] Both list and composer have matching `textFormatters`
328
+ - [ ] Mutable `_user`/`_group` state copies, not `widget.user`/`widget.group`
329
+ - [ ] `onThreadRepliesClick` navigates to thread screen with `parentMessageId`
330
+ - [ ] Thread screen Scaffold also has `resizeToAvoidBottomInset: false` (same rule as messages screen)
331
+ - [ ] SDK listeners update `_user`/`_group` for block/kick/scope changes
332
+ - [ ] Colors from `CometChatThemeHelper`, cached in `didChangeDependencies()`
333
+ - [ ] If using SDK listener mixins with `Action`, import UIKit `as cc` to avoid Flutter name conflict