@cometchat/skills 4.2.1 → 4.4.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.
- package/LICENSE +21 -0
- package/README.md +33 -12
- package/bin/install.js +59 -4
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +460 -77
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +20 -2
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +389 -9
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +235 -293
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +22 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +412 -13
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
- package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +281 -11
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
- package/skills/cometchat-native-calls/SKILL.md +89 -19
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +91 -57
- package/skills/cometchat-native-core/SKILL.md +281 -9
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
- package/skills/cometchat-native-features/SKILL.md +79 -49
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +57 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -9,14 +9,15 @@ description: >
|
|
|
9
9
|
subtitleView, trailingView, listItemView, or customizing the conversations screen.
|
|
10
10
|
Also use when the user asks about showing a list of chats or recent conversations.
|
|
11
11
|
license: "MIT"
|
|
12
|
-
compatibility: "cometchat_chat_uikit ^6.0.
|
|
13
|
-
allowed-tools: "shell, file-read, file-search, file-list, grep"
|
|
12
|
+
compatibility: "cometchat_chat_uikit ^6.0.1; flutter_bloc ^8.1.0"
|
|
14
13
|
metadata:
|
|
15
14
|
author: "CometChat"
|
|
16
15
|
version: "3.0.0"
|
|
17
16
|
tags: "cometchat flutter conversations chat-list recent-chats bloc"
|
|
18
17
|
---
|
|
19
18
|
|
|
19
|
+
> **Ground truth:** `cometchat_chat_uikit: ^6.0` — pub-cache source + `ui-kit/flutter`. **Official docs:** https://www.cometchat.com/docs/ui-kit/flutter/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
20
|
+
|
|
20
21
|
# CometChat Flutter UIKit — Conversations
|
|
21
22
|
|
|
22
23
|
The `CometChatConversations` widget displays a list of recent conversations with real-time updates.
|
|
@@ -40,7 +41,7 @@ CometChatConversations(
|
|
|
40
41
|
## Architecture
|
|
41
42
|
|
|
42
43
|
```
|
|
43
|
-
conversations/
|
|
44
|
+
conversations/ # Key folders (excerpt)
|
|
44
45
|
├── bloc/
|
|
45
46
|
│ ├── conversations_bloc.dart # SDK listeners, real-time updates, O(1) lookups
|
|
46
47
|
│ ├── conversations_event.dart # LoadConversations, DeleteConversation, etc.
|
|
@@ -48,7 +49,10 @@ conversations/
|
|
|
48
49
|
├── domain/usecases/ # GetConversationsUseCase, DeleteConversationUseCase, etc.
|
|
49
50
|
├── data/ # Repository + DataSources (remote + local)
|
|
50
51
|
├── di/ # ConversationsServiceLocator (singleton)
|
|
51
|
-
|
|
52
|
+
├── utils/ # Helpers (date formatting, last-message preview, etc.)
|
|
53
|
+
├── widgets/ # List item, subtitle, trailing, empty/error/loading views
|
|
54
|
+
├── cometchat_conversations.dart # Public widget entry point
|
|
55
|
+
└── cometchat_conversations_style.dart # Style class
|
|
52
56
|
```
|
|
53
57
|
|
|
54
58
|
## State Classes
|
|
@@ -72,8 +76,11 @@ ConversationsError // Error with message + optional previousConversations
|
|
|
72
76
|
| `DeleteConversation(id)` | Calls SDK to delete |
|
|
73
77
|
| `RemoveConversation(id)` | Remove from list without SDK call (e.g., after group kick) |
|
|
74
78
|
| `SetActiveConversation(id)` | Track which conversation is open |
|
|
75
|
-
| `UpdateConversation(
|
|
79
|
+
| `UpdateConversation({required conversationId, required updatedConversation, forceUpdate})` | Update a specific conversation's data. `forceUpdate` defaults to `true`. **Named params — positional form will not compile.** |
|
|
76
80
|
| `ResetUnreadCount(id)` | Clear unread badge when user reads messages |
|
|
81
|
+
| `RefreshConversations` | Re-fetch the list from the SDK (e.g., after a manual refresh gesture) |
|
|
82
|
+
| `ToggleConversationSelection(id)` | Add/remove a conversation from the multi-select set |
|
|
83
|
+
| `ClearConversationSelection` | Exit multi-select mode and clear selection |
|
|
77
84
|
|
|
78
85
|
## Real-Time Features
|
|
79
86
|
|
|
@@ -116,15 +123,26 @@ CometChatConversations(
|
|
|
116
123
|
// Style overrides
|
|
117
124
|
conversationsStyle: CometChatConversationsStyle(
|
|
118
125
|
backgroundColor: colors.background1,
|
|
119
|
-
|
|
126
|
+
titleTextStyle: typography.heading3?.bold,
|
|
120
127
|
),
|
|
121
128
|
|
|
122
|
-
// Configuration
|
|
129
|
+
// Configuration (all bool? — defaults supplied if null)
|
|
123
130
|
usersStatusVisibility: true,
|
|
124
131
|
receiptsVisibility: true,
|
|
125
132
|
deleteConversationOptionVisibility: true,
|
|
126
133
|
hideAppbar: false,
|
|
127
|
-
showBackButton:
|
|
134
|
+
showBackButton: true,
|
|
135
|
+
|
|
136
|
+
// Callbacks — onBack is REQUIRED when showBackButton: true, otherwise the button is a no-op
|
|
137
|
+
onBack: () => Navigator.of(context).maybePop(),
|
|
138
|
+
|
|
139
|
+
// Error callback — OnError typedef is `Function(Exception e)`
|
|
140
|
+
// Pair with hideError / errorStateView if you want to suppress or replace the in-widget error view.
|
|
141
|
+
onError: (Exception e) => ScaffoldMessenger.of(context).showSnackBar(
|
|
142
|
+
SnackBar(content: Text('Failed to load conversations: $e')),
|
|
143
|
+
),
|
|
144
|
+
|
|
145
|
+
// Other widget callbacks: onItemLongPress, onSelection, onEmpty, onLoad
|
|
128
146
|
|
|
129
147
|
// Text formatters for subtitle preview
|
|
130
148
|
textFormatters: [
|
|
@@ -172,12 +190,19 @@ onItemTap: (conv) {
|
|
|
172
190
|
```
|
|
173
191
|
|
|
174
192
|
```dart
|
|
175
|
-
//
|
|
176
|
-
|
|
193
|
+
// ⚠️ The ServiceLocator is auto-initialized on first use, but calling
|
|
194
|
+
// setup() explicitly in main.dart before runApp() is the documented contract
|
|
195
|
+
// and surfaces any init failures early.
|
|
177
196
|
|
|
178
|
-
// ✅
|
|
197
|
+
// ✅ RECOMMENDED — explicit setup, then construct
|
|
179
198
|
ConversationsServiceLocator.instance.setup();
|
|
180
199
|
final bloc = ConversationsBloc(
|
|
200
|
+
// Minimal example — the constructor also accepts:
|
|
201
|
+
// getConversationsUseCase, loadMoreConversationsUseCase,
|
|
202
|
+
// disableSDKListeners, conversationsRequestBuilder,
|
|
203
|
+
// usersStatusVisibility, receiptsVisibility, includeBlockedUsers,
|
|
204
|
+
// visibleItemThreshold, disableSoundForMessages, customSoundForMessages,
|
|
205
|
+
// conversationsProtocol — all optional.
|
|
181
206
|
getLoggedInUserUseCase: ConversationsServiceLocator.instance.getLoggedInUserUseCase,
|
|
182
207
|
getConversationUseCase: ConversationsServiceLocator.instance.getConversationUseCase,
|
|
183
208
|
markAsDeliveredUseCase: ConversationsServiceLocator.instance.markAsDeliveredUseCase,
|
|
@@ -203,8 +228,11 @@ ValueListenableBuilder<List<TypingIndicator>>(
|
|
|
203
228
|
## Checklist
|
|
204
229
|
|
|
205
230
|
- [ ] `onItemTap` extracts `User`/`Group` from `conversation.conversationWith`
|
|
231
|
+
- [ ] `onBack` wired when `showBackButton: true` (otherwise the back button is a no-op)
|
|
232
|
+
- [ ] `onError` callback (or `errorStateView` / `hideError`) wired so widget errors surface to users
|
|
206
233
|
- [ ] `subscriptionType` set in UIKitSettings (required for real-time updates)
|
|
207
234
|
- [ ] Typing indicators use `ValueListenableBuilder`, not BLoC state
|
|
208
235
|
- [ ] Custom list items use `CometChatThemeHelper` for colors
|
|
209
236
|
- [ ] Text formatters passed if using mentions or markdown in subtitle preview
|
|
210
237
|
- [ ] `deleteConversationOptionVisibility` set based on app requirements
|
|
238
|
+
- [ ] `UpdateConversation` dispatched with **named** params (`conversationId`, `updatedConversation`) — positional form will not compile
|
|
@@ -10,8 +10,7 @@ description: >
|
|
|
10
10
|
uninitialized ServiceLocator. Make sure to use this skill for any CometChat Flutter
|
|
11
11
|
UIKit code, even simple widget usage.
|
|
12
12
|
license: "MIT"
|
|
13
|
-
compatibility: "cometchat_chat_uikit ^6.0.
|
|
14
|
-
allowed-tools: "shell, file-read, file-search, file-list, grep"
|
|
13
|
+
compatibility: "cometchat_chat_uikit ^6.0.1; flutter_bloc ^8.1.0. File-based init (CometChatUIKit.initFromSettings + project-root cometchat-settings.json — ENG-35866 Skills Telemetry) requires cometchat_chat_uikit >= 6.0.3; on older UIKit use the UIKitSettingsBuilder fallback."
|
|
15
14
|
metadata:
|
|
16
15
|
author: "CometChat"
|
|
17
16
|
version: "3.0.0"
|
|
@@ -20,11 +19,77 @@ metadata:
|
|
|
20
19
|
|
|
21
20
|
# CometChat Flutter UIKit — Core Rules
|
|
22
21
|
|
|
22
|
+
> **Ground truth:** `cometchat_chat_uikit: ^6.0` (calls folded in; transitively `cometchat_sdk ^5` + `cometchat_calls_sdk ^5.0.2`) — the pub-cache package source + `docs/ui-kit/flutter`. **Official docs:** https://www.cometchat.com/docs/ui-kit/flutter/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify Dart symbols against the resolved package source before relying on them.
|
|
23
|
+
|
|
23
24
|
Non-negotiable constraints for all CometChat UIKit code. Violating these causes silent failures or crashes.
|
|
24
25
|
|
|
25
26
|
## Rule: INIT_FIRST
|
|
26
27
|
|
|
27
|
-
`CometChatUIKit.init()` must complete before any login, component usage, or SDK call.
|
|
28
|
+
Init — `CometChatUIKit.initFromSettings()` (recommended) or the `CometChatUIKit.init(uiKitSettings: …)` fallback — must complete before any login, component usage, or SDK call.
|
|
29
|
+
|
|
30
|
+
### File-based init with `cometchat-settings.json` (recommended)
|
|
31
|
+
|
|
32
|
+
> **🚧 Version gate (ENG-35866 — Skills Telemetry).** `CometChatUIKit.initFromSettings()` ships in **`cometchat_chat_uikit` ≥ `6.0.3`** (which pulls `cometchat_sdk ^5.0.3` + `cometchat_calls_sdk ^5.0.2` transitively). It reads `cometchat-settings.json` via `rootBundle` and lets the SDK self-report `integrationSource`. On older UIKit the method does not exist — use the **`UIKitSettingsBuilder` fallback** below. If unsure of the installed version, use the fallback.
|
|
33
|
+
|
|
34
|
+
**Step 1 — create `cometchat-settings.json` at the project root.** Fill `appId` / `region` / `credentials.authKey` from the CLI `provision setup` output; leave everything else at the defaults below. These are the **same credentials** used everywhere else in the app — this file is the single source, so there's no second copy to keep in sync.
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"appId": "APP_ID_HERE",
|
|
39
|
+
"region": "us",
|
|
40
|
+
"credentials": {
|
|
41
|
+
"authKey": "AUTH_KEY_HERE"
|
|
42
|
+
},
|
|
43
|
+
"chatSDK": {
|
|
44
|
+
"presenceSubscription": {
|
|
45
|
+
"type": "ALL_USERS",
|
|
46
|
+
"roles": []
|
|
47
|
+
},
|
|
48
|
+
"autoEstablishSocketConnection": true,
|
|
49
|
+
"adminHost": null,
|
|
50
|
+
"clientHost": null
|
|
51
|
+
},
|
|
52
|
+
"callsSDK": {
|
|
53
|
+
"host": null,
|
|
54
|
+
"adminHost": null,
|
|
55
|
+
"clientHost": null,
|
|
56
|
+
"callsHost": null
|
|
57
|
+
},
|
|
58
|
+
"uiKit": {
|
|
59
|
+
"subscribePresenceForAllUsers": true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Step 2 — register it as a bundled asset in `pubspec.yaml`.** The SDK loads it with `rootBundle.loadString('cometchat-settings.json')`, so the asset key must be the bare filename — register it at the **root** (not nested under `assets/`, which would make the key `assets/cometchat-settings.json` and the lookup miss):
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
flutter:
|
|
68
|
+
assets:
|
|
69
|
+
- assets/
|
|
70
|
+
- cometchat-settings.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **Do NOT gitignore `cometchat-settings.json`.** The dev-mode `authKey` it holds is no more exposed than a `--dart-define=COMETCHAT_AUTH_KEY=…` value (both ship in the built app); production integrations migrate to server-minted auth tokens regardless.
|
|
74
|
+
|
|
75
|
+
**Step 3 — init in `main()`.** No `UIKitSettingsBuilder`, no config const — the SDK reads `cometchat-settings.json` itself:
|
|
76
|
+
|
|
77
|
+
```dart
|
|
78
|
+
import 'package:flutter/material.dart';
|
|
79
|
+
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
|
|
80
|
+
|
|
81
|
+
void main() async {
|
|
82
|
+
WidgetsFlutterBinding.ensureInitialized();
|
|
83
|
+
// tier2-version-gated: initFromSettings ships in cometchat_chat_uikit >= 6.0.3 (ENG-35866).
|
|
84
|
+
await CometChatUIKit.initFromSettings(
|
|
85
|
+
onSuccess: (String successMessage) => debugPrint('Init done'),
|
|
86
|
+
onError: (CometChatException e) => debugPrint('Init failed: ${e.message}'),
|
|
87
|
+
);
|
|
88
|
+
runApp(const MyApp());
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `UIKitSettingsBuilder` init (fallback — UIKit before `6.0.3`)
|
|
28
93
|
|
|
29
94
|
```dart
|
|
30
95
|
// ✅ CORRECT
|
|
@@ -90,14 +155,16 @@ CometChatUIKit.init(
|
|
|
90
155
|
User? existingUser = await CometChat.getLoggedInUser();
|
|
91
156
|
```
|
|
92
157
|
|
|
93
|
-
## Rule: SCAFFOLD_NO_RESIZE
|
|
158
|
+
## Rule: SCAFFOLD_NO_RESIZE (version-aware — prose guidance, not a lint)
|
|
159
|
+
|
|
160
|
+
On `cometchat_chat_uikit ^6.0.1`, a `Scaffold` containing `CometChatMessageComposer` should use `resizeToAvoidBottomInset: true` (or omit it — `true` is Flutter's default). The composer clamps the native keyboard height to Flutter's `viewInsets` (kit fix **ENG-34434**), so `true` does NOT double-compensate. The kit sample app uses `true` (the messages screen defaults it; the thread screen sets it explicitly).
|
|
94
161
|
|
|
95
|
-
|
|
162
|
+
The old "must be `false`" rule was correct only for **pre-6.0.1** kits (before the clamp landed). On those versions `false` was the workaround for the double-compensation / layout-jump bug. If you see a double keyboard gap on a current kit, the fix is to upgrade to `^6.0.1` — not to set `false`.
|
|
96
163
|
|
|
97
164
|
```dart
|
|
98
|
-
// ✅ CORRECT
|
|
165
|
+
// ✅ CORRECT on ^6.0.1 (true, or omit — true is the default)
|
|
99
166
|
Scaffold(
|
|
100
|
-
resizeToAvoidBottomInset:
|
|
167
|
+
resizeToAvoidBottomInset: true,
|
|
101
168
|
body: Column(
|
|
102
169
|
children: [
|
|
103
170
|
Expanded(child: CometChatMessageList(user: user)),
|
|
@@ -106,8 +173,10 @@ Scaffold(
|
|
|
106
173
|
),
|
|
107
174
|
)
|
|
108
175
|
|
|
109
|
-
//
|
|
176
|
+
// ⚠ Only on PRE-6.0.1 kits — false was the stopgap before the ENG-34434 clamp.
|
|
177
|
+
// On ^6.0.1 this is unnecessary; upgrade the kit instead.
|
|
110
178
|
Scaffold(
|
|
179
|
+
resizeToAvoidBottomInset: false,
|
|
111
180
|
body: Column(
|
|
112
181
|
children: [
|
|
113
182
|
Expanded(child: CometChatMessageList(user: user)),
|
|
@@ -117,6 +186,23 @@ Scaffold(
|
|
|
117
186
|
)
|
|
118
187
|
```
|
|
119
188
|
|
|
189
|
+
## Rule: ANDROID_MINSDK_26
|
|
190
|
+
|
|
191
|
+
**Set `minSdk = 26` in `android/app/build.gradle.kts` (In-code path too, not just Visual Builder).** `cometchat_chat_uikit: ^6.0.1` depends transitively on `cometchat_calls_sdk` (`>=5.0.2 <6.0.0`), which floors Android `minSdk` at **26**. A default `flutter create` app sets `minSdk` lower (Flutter's platform default), so `flutter build apk` fails with:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
uses-sdk:minSdkVersion 21 cannot be smaller than version 26 declared in library [cometchat_calls_sdk]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`flutter analyze` does NOT catch this — it only surfaces at the APK/AAB build. Set it up front:
|
|
198
|
+
|
|
199
|
+
```kotlin
|
|
200
|
+
// android/app/build.gradle.kts
|
|
201
|
+
android { defaultConfig { minSdk = 26 } }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
(Verified — real `flutter build apk --debug` against kit 6.0.1.)
|
|
205
|
+
|
|
120
206
|
## Rule: LISTENER_LIFECYCLE
|
|
121
207
|
|
|
122
208
|
SDK listeners MUST be registered with a unique ID in `initState()` and removed with the same ID in `dispose()`. Forgetting removal causes duplicate events and memory leaks.
|
|
@@ -298,8 +384,260 @@ Every component follows this structure:
|
|
|
298
384
|
- [ ] Auth check uses `CometChatUIKit.loggedInUser` after init, not `CometChat.getLoggedInUser()`
|
|
299
385
|
- [ ] `subscriptionType` set in UIKitSettingsBuilder
|
|
300
386
|
- [ ] `region` is lowercase
|
|
301
|
-
- [ ] Scaffold
|
|
387
|
+
- [ ] Scaffold hosting `CometChatMessageComposer` uses `resizeToAvoidBottomInset: true` (or omits it) on `^6.0.1` — the composer clamps to `viewInsets` (ENG-34434); `false` is only the pre-6.0.1 stopgap
|
|
302
388
|
- [ ] Theme cached in `didChangeDependencies()`, not `build()`
|
|
303
389
|
- [ ] SDK listeners registered with unique ID, removed in `dispose()`
|
|
304
390
|
- [ ] Colors from `CometChatThemeHelper`, never hardcoded
|
|
305
|
-
|
|
391
|
+
|
|
392
|
+
## Visual Builder integration
|
|
393
|
+
|
|
394
|
+
> **⚠ The Visual Builder emits V5-shaped code.** The canonical builder repo at the `chat_builder/` directory inside the Flutter Visual Builder ZIP (download from https://preview.cometchat.com/downloads/cometchat-builder-flutter.zip) uses `cometchat_chat_uikit: ^5.2.12` + `cometchat_calls_uikit: ^5.0.13` — the **V5** Flutter UI Kit packages. There is no V6-native Visual Builder canonical from vendor side yet ([F22 finding, 2026-05-22](https://github.com/cometchat/cometchat-skills/issues)). When a V6 project picks the Visually path, the copied `chat_builder/` path-dep brings V5 deps in transitively — your V6 host app code is untouched, but the Visual-Builder-emitted screens are V5-flavored. Treat as transitional until vendor publishes a V6 canonical. V6 customers preferring a single-version dep tree should use the In-code path.
|
|
395
|
+
>
|
|
396
|
+
> The recipe below is identical to what `cometchat-flutter-v5-core` §"Visual Builder integration" prescribes (both reference the same canonical). This page kept for V6 customers who still hit the Visually flow.
|
|
397
|
+
|
|
398
|
+
When the dispatcher's Step 3.1 sets `customize=visual` and the platform resolves to `flutter`, skills runs **`cometchat builder export --platform flutter`** — a single CLI command that downloads the canonical static template ZIP from `preview.cometchat.com/downloads/cometchat-builder-flutter.zip`, fetches the per-builder settings JSON, applies F3 + F10 missing-field defaults, and writes the entire `chat_builder/` package to `--output` (default: `chat_builder/`).
|
|
399
|
+
|
|
400
|
+
The `chat_builder/` directory is wired **as a path dependency** in the customer's project — it owns the entire chat surface (conversations, messages, users, groups, calls). The customer's app initializes settings and launches a screen via `ChatBuilder.launchBuilder(context)` or `ChatBuilder.launchMessages(...)`.
|
|
401
|
+
|
|
402
|
+
This is intentionally a heavier copy than iOS (Pod) / Android (Gradle plugin) — the Flutter builder package is not yet published to pub.dev.
|
|
403
|
+
|
|
404
|
+
### 1. Run `cometchat builder export`
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
cometchat builder export --platform flutter --json
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Defaults to `--output chat_builder/`. The command writes the entire canonical `chat_builder/` Dart package (~50 files: `lib/`, `assets/`, `android/`, `ios/`, `pubspec.yaml`) — verbatim from the canonical ZIP — and patches `chat_builder/assets/sample_app/cometchat-builder-settings.json` with the **envelope-shape JSON** the CLI emits: `{ builderId, name, settings: {...} }` (F3 + F10 defaults injected: `mentionAll: true`, `inAppSounds: { incomingMessageSound: true, outgoingMessageSound: true }`). No SKILLS-AUTO-GENERATED sentinel (JSON forbids `//` comments).
|
|
411
|
+
|
|
412
|
+
> The CLI is the source of truth for the written shape. The vendor canonical's own checked-in `cometchat-builder-settings.json` carries only `{ builderId, settings }` (no top-level `name`) — `BuilderSettingsHelper.loadFromAsset()` reads only `builderId` + `settings` and **ignores any extra top-level keys**, so the CLI's additional `name` (and any other extras) are harmless.
|
|
413
|
+
|
|
414
|
+
`BuilderSettingsHelper.loadFromAsset()` reads this exported settings file at runtime.
|
|
415
|
+
|
|
416
|
+
Resync = re-run the same command with `--force` (full re-download + replace). See `cometchat-core` §11.6 for the resync contract.
|
|
417
|
+
|
|
418
|
+
#### F56 + F57 + F58 — known canonical-ZIP rough edges (re-apply after every export)
|
|
419
|
+
|
|
420
|
+
Three issues live in the upstream canonical `chat_builder/` Dart package (verified 2026-05-25 against `preview.cometchat.com/downloads/cometchat-builder-flutter.zip`). Vendor-side fixes pending; agent must work around them on **every** `builder export` (first emit AND every resync, since `--force` re-overwrites the patches):
|
|
421
|
+
|
|
422
|
+
**F56 — Wrong asset path in `api_services.dart`**
|
|
423
|
+
|
|
424
|
+
`chat_builder/lib/services/api_services.dart` line ~41:
|
|
425
|
+
|
|
426
|
+
```dart
|
|
427
|
+
// Canonical (broken):
|
|
428
|
+
await loadJsonFromAssets('assets/chat_builder/sample_data.json');
|
|
429
|
+
|
|
430
|
+
// Agent must patch to:
|
|
431
|
+
await loadJsonFromAssets('assets/sample_app/sample_data.json');
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
The canonical references `assets/chat_builder/sample_data.json` — a path that doesn't exist in the customer's host app after the standard `cp -r chat_builder/assets/ assets/` copy. The actual file lands at `assets/sample_app/sample_data.json`. Without this patch, the login screen's "default users" list silently falls back to empty and customers see an empty user picker.
|
|
435
|
+
|
|
436
|
+
**F57 — F56 patch is overwritten on every resync**
|
|
437
|
+
|
|
438
|
+
`builder export --platform flutter --force` re-copies the canonical's `api_services.dart` verbatim — re-introducing the wrong path. Agent must re-apply the F56 patch after every resync. This is a known re-apply task; document it in the customer-facing summary so they know "the agent will need to patch this each time the dashboard settings change".
|
|
439
|
+
|
|
440
|
+
**F58 — Asset copy is additive, not idempotent**
|
|
441
|
+
|
|
442
|
+
The standard prescription `cp -r chat_builder/assets/ assets/` is additive — files removed from the canonical (e.g., a deprecated icon) stay in the customer's `assets/` directory because cp doesn't delete. On resync, use `rsync -a --delete chat_builder/assets/ assets/` instead, OR `rm -rf assets/ && cp -r chat_builder/assets/ assets/` first.
|
|
443
|
+
|
|
444
|
+
**Tracking**: a single vendor ticket bundles F22 (V5-shaped canonical), F56 (wrong asset path), F57 (resync overwrite of F56 fix), F48 lineage (font paths in earlier Android-ZIP iterations) — see CometChat Linear for the consolidated upstream-fix request. v4.3.0 ships with the agent-side workarounds documented above; a future release picks up the upstream fixes when they land.
|
|
445
|
+
|
|
446
|
+
### Files skills writes (after `builder export`)
|
|
447
|
+
|
|
448
|
+
| Path | Content |
|
|
449
|
+
|---|---|
|
|
450
|
+
| `lib/cometchat/cometchat_app.dart` | Thin `StatefulWidget` that initializes the kit then exposes a launch trigger calling `ChatBuilder.launchBuilder(context)` |
|
|
451
|
+
| `lib/cometchat/secrets.dart` | Credentials class (`Secrets.appId / region / authKey`) populated by Step 2c, added to `.gitignore` |
|
|
452
|
+
|
|
453
|
+
### Files patched
|
|
454
|
+
|
|
455
|
+
| Path | Patch |
|
|
456
|
+
|---|---|
|
|
457
|
+
| `pubspec.yaml` | Add `chat_builder: { path: ./chat_builder }` to dependencies. Add `assets/` + `assets/sample_app/` to `flutter.assets`. Add font families `arial / inter / roboto / times New Roman` exactly as defined in `chat_builder/pubspec.yaml`. **As a `path:` dependency the `chat_builder` package carries its own transitive deps** (`get`, `shared_preferences`, `http`, `toast`, `path_provider`, `permission_handler`, `intl` per `chat_builder/pubspec.yaml`) and pub resolves them automatically — you do NOT list them in the host app. Only if you vendor `chat_builder`'s Dart files directly into your app (instead of using the `path:` dep) must you add those seven to your own `dependencies` |
|
|
458
|
+
| `lib/main.dart` | Insert `WidgetsFlutterBinding.ensureInitialized()` + `await BuilderSettingsHelper.loadFromAsset()` before `runApp()` |
|
|
459
|
+
| `ios/Podfile` | `platform :ios, '13.0'` (raise if lower) |
|
|
460
|
+
| `android/app/build.gradle.kts` | `ndkVersion = "27.0.12077973"`, **`minSdk = 26`** (REQUIRED — `cometchat_chat_uikit 6.0.1` pulls `cometchat_calls_sdk` transitively, which floors `minSdk` at 26; a default `flutter create` sets it lower and `flutter build apk` then fails with "uses-sdk:minSdkVersion … cannot be smaller than version 26 declared in library [cometchat_calls_sdk]") |
|
|
461
|
+
| `android/gradle.properties` | **Non-negotiable:** append `android.enableJetifier=true`. CometChat Chat SDK transitively pulls `com.android.support:support-compat:26.1.0` which collides with `androidx.core:core` — without Jetifier the build fails with `Duplicate class android.support.v4.os.ResultReceiver` etc. Same root cause as `cometchat-android-v6-core` §1.3a — Flutter's Android side has identical exposure. Validated 2026-05-19 on smoke test |
|
|
462
|
+
| `android/app/src/main/AndroidManifest.xml` + `ios/Runner/Info.plist` | `RECORD_AUDIO` / `CAMERA` permissions + `NSMicrophoneUsageDescription` / `NSCameraUsageDescription` if any call feature is enabled |
|
|
463
|
+
|
|
464
|
+
### Init flow (lib/main.dart)
|
|
465
|
+
|
|
466
|
+
```dart
|
|
467
|
+
import 'package:flutter/material.dart';
|
|
468
|
+
import 'package:chat_builder/builder/builder_settings_helper.dart';
|
|
469
|
+
|
|
470
|
+
Future<void> main() async {
|
|
471
|
+
WidgetsFlutterBinding.ensureInitialized();
|
|
472
|
+
await BuilderSettingsHelper.loadFromAsset();
|
|
473
|
+
runApp(const MyApp());
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
`BuilderSettingsHelper.loadFromAsset()` reads `assets/sample_app/cometchat-builder-settings.json` and populates the in-memory settings the `ChatBuilder.*` screens consume. Standard `CometChatUIKit.init(uiKitSettings: ...)` (see this file's `INIT_FIRST` rule) is still required and runs before any chat surface mounts.
|
|
478
|
+
|
|
479
|
+
> **`runApp(const MyApp())` above assumes you keep `flutter create`'s default `MyApp` class.** If you instead use the **Recommended** root below (`CometChatBuilderRoot`), you've renamed/removed `MyApp` — so also **delete or update `test/widget_test.dart`** (the default test instantiates `MyApp()` and will otherwise fail `flutter analyze` with `The name 'MyApp' isn't a class`). Pick ONE root-widget name and keep main.dart + the test file consistent. (Verified 2026-06-14: this orphaned test was the only `flutter analyze` error on a clean builder-export wiring.)
|
|
480
|
+
|
|
481
|
+
> **Extensions + AI features are dashboard-enabled in V6 — do NOT add V5-style `..extensions` / `..aiFeature` / `..callingExtension` setters.** Those three `UIKitSettingsBuilder` fields exist in the **V5** kit (and the builder reference app is V5-shaped — `chat_builder` pins `cometchat_chat_uikit ^5.2.x`, so its `InitializeCometChat.init()` passes them). They were **removed in V6** — adding them does not compile against `cometchat_chat_uikit ^6.0.1`. In V6 the extension-backed builder features (polls, collaborative whiteboard/document, stickers, message translation, reactions) and AI features are turned on in the **CometChat dashboard** (the builder enables them server-side) and the kit auto-wires them; calling is enabled with `..enableCalls = true`. So the V6 `UIKitSettingsBuilder` needs only `appId`/`region`/`authKey`/`subscriptionType` (+ `enableCalls` for calls) — the builder JSON's feature flags render because the features are enabled on the app, not because of a builder setter.
|
|
482
|
+
|
|
483
|
+
### Recommended: mount `ChatBuilder.createApp()` as the root
|
|
484
|
+
|
|
485
|
+
The cleanest integration mirrors the canonical's own `lib/main.dart`, which mounts `ChatBuilder.createApp()` directly as the app root and lets the package own init, theming, and call-navigation wiring:
|
|
486
|
+
|
|
487
|
+
```dart
|
|
488
|
+
// lib/main.dart
|
|
489
|
+
import 'package:flutter/material.dart';
|
|
490
|
+
import 'package:chat_builder/builder/chat_builder.dart';
|
|
491
|
+
import 'package:chat_builder/builder/builder_settings_helper.dart';
|
|
492
|
+
// ...plus the package's prefs/page-manager bootstrap if you vendor those files
|
|
493
|
+
|
|
494
|
+
Future<void> main() async {
|
|
495
|
+
WidgetsFlutterBinding.ensureInitialized();
|
|
496
|
+
await BuilderSettingsHelper.loadFromAsset();
|
|
497
|
+
runApp(const CometChatBuilderRoot());
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
class CometChatBuilderRoot extends StatelessWidget {
|
|
501
|
+
const CometChatBuilderRoot({super.key});
|
|
502
|
+
|
|
503
|
+
@override
|
|
504
|
+
Widget build(BuildContext context) => ChatBuilder.createApp();
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
`ChatBuilder.createApp()` returns a `MaterialApp` that already wires (a) `CometChatColorPalette` as a `ThemeData` extension in BOTH light and dark themes — this is what actually applies the builder's brand color + text colors to the kit, and (b) `navigatorKey: CallNavigationContext.navigatorKey` so incoming-call routing works. Use this path when CometChat owns the whole chat surface.
|
|
509
|
+
|
|
510
|
+
### Alternative: a host-app wrapper (when you can't mount `createApp()` as root)
|
|
511
|
+
|
|
512
|
+
If the host app already owns its root `MaterialApp` and you must mount CometChat as a sub-surface (a route/tab/dialog), hand-roll a wrapper — but you are then responsible for replicating what `createApp()` does for you: the theme palette and the navigator key.
|
|
513
|
+
|
|
514
|
+
```dart
|
|
515
|
+
// lib/cometchat/cometchat_app.dart
|
|
516
|
+
import 'package:flutter/material.dart';
|
|
517
|
+
import 'package:chat_builder/builder/chat_builder.dart';
|
|
518
|
+
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
|
|
519
|
+
import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
|
|
520
|
+
|
|
521
|
+
import 'secrets.dart';
|
|
522
|
+
|
|
523
|
+
/// Top-level chat surface emitted by the Visual Builder Visually path.
|
|
524
|
+
/// The `chat_builder` package owns the UI; this widget bootstraps UI Kit init
|
|
525
|
+
/// then renders a launch trigger. Step 3c placement decides where this widget
|
|
526
|
+
/// mounts in the host app (a route, a tab, a dialog).
|
|
527
|
+
class CometChatApp extends StatefulWidget {
|
|
528
|
+
const CometChatApp({super.key});
|
|
529
|
+
|
|
530
|
+
@override
|
|
531
|
+
State<CometChatApp> createState() => _CometChatAppState();
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
class _CometChatAppState extends State<CometChatApp> {
|
|
535
|
+
bool _isReady = false;
|
|
536
|
+
String? _initError;
|
|
537
|
+
|
|
538
|
+
@override
|
|
539
|
+
void initState() {
|
|
540
|
+
super.initState();
|
|
541
|
+
_bootstrap();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
void _bootstrap() {
|
|
545
|
+
// V6: extensions + AI features are dashboard-enabled and auto-wire — there
|
|
546
|
+
// are NO ..extensions / ..aiFeature / ..callingExtension setters (those are
|
|
547
|
+
// V5; see callout above). Add ..enableCalls = true if you need calling.
|
|
548
|
+
final settings = (UIKitSettingsBuilder()
|
|
549
|
+
..appId = Secrets.appId
|
|
550
|
+
..region = Secrets.region
|
|
551
|
+
..authKey = Secrets.authKey
|
|
552
|
+
..subscriptionType = CometChatSubscriptionType.allUsers)
|
|
553
|
+
.build();
|
|
554
|
+
|
|
555
|
+
CometChatUIKit.init(
|
|
556
|
+
uiKitSettings: settings,
|
|
557
|
+
onSuccess: (_) => setState(() => _isReady = true),
|
|
558
|
+
onError: (e) => setState(() => _initError = e.message),
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
@override
|
|
563
|
+
Widget build(BuildContext context) {
|
|
564
|
+
if (_initError != null) {
|
|
565
|
+
return Scaffold(body: Center(child: Text('CometChat init failed: $_initError')));
|
|
566
|
+
}
|
|
567
|
+
if (!_isReady) {
|
|
568
|
+
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
|
569
|
+
}
|
|
570
|
+
// The bare Scaffold below does NOT apply the builder's theme palette.
|
|
571
|
+
// If this wrapper owns the MaterialApp, replicate the canonical's
|
|
572
|
+
// ThemeData (both light + dark) and navigatorKey — see note below.
|
|
573
|
+
return Scaffold(
|
|
574
|
+
resizeToAvoidBottomInset: true,
|
|
575
|
+
body: Center(
|
|
576
|
+
child: ElevatedButton(
|
|
577
|
+
onPressed: () => ChatBuilder.launchBuilder(context),
|
|
578
|
+
child: const Text('Open chat'),
|
|
579
|
+
),
|
|
580
|
+
),
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
If this wrapper (or the host app) supplies the root `MaterialApp`, theme color/typography are honored ONLY if you wire `CometChatColorPalette` as a `ThemeData` extension and set the navigator key — both UNCONDITIONALLY, exactly as the canonical's `ChatBuilder.createApp()` does (it sets both regardless of whether calls are enabled):
|
|
587
|
+
|
|
588
|
+
```dart
|
|
589
|
+
MaterialApp(
|
|
590
|
+
theme: ThemeData(
|
|
591
|
+
fontFamily: /* builder typography font */,
|
|
592
|
+
extensions: [
|
|
593
|
+
CometChatColorPalette(
|
|
594
|
+
textPrimary: /* builder light primary text */,
|
|
595
|
+
textSecondary: /* builder light secondary text */,
|
|
596
|
+
primary: /* builder brand color */,
|
|
597
|
+
),
|
|
598
|
+
],
|
|
599
|
+
),
|
|
600
|
+
darkTheme: ThemeData(
|
|
601
|
+
fontFamily: /* builder typography font */,
|
|
602
|
+
extensions: [
|
|
603
|
+
CometChatColorPalette(
|
|
604
|
+
textPrimary: /* builder dark primary text */,
|
|
605
|
+
textSecondary: /* builder dark secondary text */,
|
|
606
|
+
primary: /* builder brand color */,
|
|
607
|
+
),
|
|
608
|
+
],
|
|
609
|
+
),
|
|
610
|
+
// UNCONDITIONAL — the canonical wires this in every MaterialApp it builds,
|
|
611
|
+
// not just when calls are enabled. Incoming-call routing needs it (Bug 1),
|
|
612
|
+
// and gating it behind "calls enabled" breaks call routing if a feature flag
|
|
613
|
+
// is flipped on later in the dashboard without a code change.
|
|
614
|
+
navigatorKey: CallNavigationContext.navigatorKey,
|
|
615
|
+
home: /* your chat surface */,
|
|
616
|
+
)
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
`ChatBuilder.launchBuilder(context)` opens the builder's login / dashboard flow; once a user is logged in, the package's internal navigation handles conversations → messages.
|
|
620
|
+
|
|
621
|
+
For direct deep-links into a specific user or group thread (skipping the dashboard), use:
|
|
622
|
+
|
|
623
|
+
```dart
|
|
624
|
+
ChatBuilder.launchMessages(context: context, user: user);
|
|
625
|
+
ChatBuilder.launchMessages(context: context, group: group);
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
These are the two public entry points the `chat_builder` package exposes — see `chat_builder/lib/builder/chat_builder.dart` (inside the Flutter Visual Builder ZIP at https://preview.cometchat.com/downloads/cometchat-builder-flutter.zip).
|
|
629
|
+
|
|
630
|
+
On `^6.0.1`, any `Scaffold` whose body chain reaches `CometChatMessageComposer` should use `resizeToAvoidBottomInset: true` (or omit it — `true` is the default), because the composer clamps the keyboard height to `viewInsets` (ENG-34434). See this file's `SCAFFOLD_NO_RESIZE` rule — `false` is only the pre-6.0.1 stopgap.
|
|
631
|
+
|
|
632
|
+
### Calls + builder
|
|
633
|
+
|
|
634
|
+
If any `VoiceAndVideoCalling.*` flag is enabled in the builder settings (e.g. `VoiceAndVideoCalling.oneOnOneVoiceCalling` — there is NO `CometChatBuilderSettings` type; the canonical app uses plain static-field holders like `VoiceAndVideoCalling`/`CoreMessagingExperience` in `builder_settings.dart`), the `chat_builder` package handles incoming/outgoing call surfaces internally (it ships its own call routes). External wiring still required:
|
|
635
|
+
1. Add `cometchat_calls_uikit` to `pubspec.yaml`
|
|
636
|
+
2. iOS `Info.plist` + Android `AndroidManifest.xml` permissions per `cometchat-flutter-v6-calls`
|
|
637
|
+
3. `navigatorKey: CallNavigationContext.navigatorKey` on the root `MaterialApp` — kit 6.0.1 requires this for incoming-call routing (Bug 1; see `cometchat-flutter-v6-calls` §1.7). Note the canonical wires this **unconditionally** in `ChatBuilder.createApp()` (it does NOT gate on whether calls are enabled), and the "Alternative: host-app wrapper" guidance above does the same — so if you mounted `ChatBuilder.createApp()` or followed that MaterialApp template, this is already in place
|
|
638
|
+
4. Push wiring — defer to `cometchat-flutter-v6-push`. The real token-registration API is `CometChatNotifications.registerPushToken(PushPlatforms.FCM_FLUTTER_ANDROID, fcmToken: …)`; a class named `PNRegistry` does **not** exist anywhere in the SDK or UI Kit (verified against `cometchat_sdk/lib/notification/main/cometchat_notifications.dart` 2026-06-03 — supersedes the inverted [[project_sdk_symbol_audit_2026_05_14]] claim)
|
|
639
|
+
5. **6.0.1 GA status:** the beta2 outgoing→in-call transition bug is FIXED in 6.0.1 ([[project_v6_flutter_calls_partial]]). V6 calls now work end-to-end once the navigatorKey line in step 3 is in place — V5 is no longer required for calls.
|
|
640
|
+
|
|
641
|
+
### What is NOT honored in v1
|
|
642
|
+
|
|
643
|
+
Skills emits a launch-button trigger, not the full multi-tab layout the `chat_builder` package's internal `Dashboard` provides. Customers get the dashboard once they tap "Open chat" — but the host-app surface is intentionally minimal so Step 3c placement (route, tab, dialog) can decide the mount shape. Chat-feature toggles ARE honored via the builder JSON. **Theme color + typography are honored ONLY if the mounted root is `ChatBuilder.createApp()` (or a `MaterialApp` that replicates its `CometChatColorPalette` `ThemeData` extension + `fontFamily`)** — the bare-`Scaffold` wrapper above does NOT apply that palette, so on that path the kit falls back to default colors. See the "Alternative: host-app wrapper" guidance for the exact `ThemeData` wiring. For deep customization beyond what the builder JSON allows, fall back to the code-driven path (see this file's standard placement pattern) and skip `chat_builder` entirely.
|