git clone https://github.com/Tencent-RTC/TUIKit_Flutter.git
atomic-x/├── lib/ # UI component source code (required for integration)│ ├── album_picker/ # Album picker│ ├── base_component/ # Base components│ └── ... # Other components├── assets/ # Resource files (required for integration)├── ... # Otherschat/├── uikit/lib/src/ # Functional components│ ├── messagelist/ # Message list component│ ├── messageinput/ # Message input component│ ├── conversationlist/ # Conversation list component│ ├── contactlist/ # Contact list component│ ├── pages/ # Page components (reference implementation)│ ├── chat_page.dart│ ├── contacts_page.dart│ ├── conversations_page.dart│ └── ... # Other UI components└── demo/ # Demo application (optional reference)

pubspec.yaml file:tencent_chat_uikit:path: ../TUIKit_Flutter/chat/uikit
ios/Podfile and add the following code at the end of the file:post_install do |installer|installer.pods_project.targets.each do |target|flutter_additional_ios_build_settings(target)target.build_configurations.each do |config|config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'config.build_settings['ENABLE_BITCODE'] = 'NO'config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"endtarget.build_configurations.each do |config|config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)','PERMISSION_MICROPHONE=1','PERMISSION_CAMERA=1','PERMISSION_PHOTOS=1',]endendend
~/.gradle/init.gradle locally, run the following command:# Or delete directly: rm -f ~/.gradle/init.gradlemv ~/.gradle/init.gradle ~/.gradle/init.gradle.backup
~/.gradle/init.gradle, skip this step. If it exists and contains allprojects.repositories, you can remove the related content or delete ~/.gradle/init.gradle (backup recommended) to avoid runtime errors. chat/demo), add org.gradle.java.home to gradle.properties to set the JDK 17 path. Replace with your actual JDK 17 full path. Example:# Replace with your actual local JDK 17 full pathorg.gradle.java.home=xx/Java/JavaVirtualMachines/jdk-17.0.6.jdk/Contents/Home

final result = await LoginStore.shared.login(sdkAppID: SDKAPPID,userID: userID,userSig: userSig,);if (result.errorCode == 0) {// Login successful, you can navigate to chat or conversation page} else {// Login failed, show error dialog}

chat/uikit/lib/src/pages/conversations_page.dart. ConversationsPage does the following:@overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(backgroundColor: colorsTheme.bgColorOperate,title: Text(atomicLocale.chat, style: TextStyle(fontSize: 34, fontWeight: FontWeight.w600)),centerTitle: false,scrolledUnderElevation: 0,actions: [],),body: Column(children: [Expanded(child: ConversationList(onConversationClick: (conversation) {Navigator.push(context,MaterialPageRoute(builder: (context) => ChatPage(conversation: conversation,),),);},),),],),);}

chat/uikit/lib/src/pages/chat_page.dart. ChatPage does the following:@overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(backgroundColor: colorsTheme.bgColorOperate,titleSpacing: 4.0,centerTitle: false,title: GestureDetector(onTap: _onTitleTap,child: Row(mainAxisSize: MainAxisSize.min,children: [Padding(padding: const EdgeInsets.only(right: 8.0),child: Avatar.image(name: widget.conversation.title,url: widget.conversation.avatarURL,),),Expanded(child: Text(widget.conversation.title ?? atomicLocale.chat,style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),overflow: TextOverflow.ellipsis,maxLines: 1,),),],),),scrolledUnderElevation: 0.0,leading: IconButton.buttonContent(content: IconOnlyContent(Icon(Icons.arrow_back_ios, color: colorsTheme.buttonColorPrimaryDefault)),type: ButtonType.noBorder,size: ButtonSize.l,onClick: () => Navigator.of(context).pop(),),actions: []),body: Column(children: [MessageList(conversationID: widget.conversation.conversationID,locateMessage: widget.message,onUserClick: (String userID) => _onUserClick(userID),),MessageInput(conversationID: widget.conversation.conversationID,),],),);}

chat/uikit/lib/src/pages/contacts_page.dart. ContactsPage does the following:@overrideWidget build(BuildContext context) {AtomicLocalizations atomicLocale = AtomicLocalizations.of(context);SemanticColorScheme colorsScheme = BaseThemeProvider.colorsOf(context);return Scaffold(appBar: AppBar(backgroundColor: colorsScheme.bgColorOperate,title: Text(atomicLocale.contact, style: TextStyle(fontSize: 34, fontWeight: FontWeight.w600),),centerTitle: false,scrolledUnderElevation: 0,actions: [],),body: ContactList(onGroupClick: (ContactInfo contactInfo) {_onGroupClick(context, contactInfo);},onContactClick: (ContactInfo contactInfo) {_onContactClick(context, contactInfo);},),);}
Page | Webhook | Recommended Navigation Logic |
ConversationsPage | onConversationClick: (conversation) {} | Triggered when a conversation in the list is clicked; recommended to navigate to the chat page (ChatPage). |
ContactsPage | onContactClick: (ContactInfo contactInfo) {} | Triggered when a contact cell is clicked; recommended to navigate to the user info page (C2CChatSetting). |
ContactsPage | onGroupClick: (ContactInfo contactInfo) {} | Triggered when a Group cell is clicked; recommended to navigate to the Group chat page (ChatPage). |
ChatPage | onUserClick: (String userID) {} | Triggered when a user's avatar or nickname in a message is clicked; recommended to navigate to the user info page (C2CChatSetting). |
ChatPage | onChatHeaderClick: () {} | Triggered when the avatar in the navigation bar is clicked; recommended to navigate to the user info page (C2CChatSetting) or Group info page (GroupChatSetting). |
ChatPage | onBackClick: () {} | Triggered when the back button is clicked; recommended to return to the previous page. |
theme_state and atomic_localizations after integrating the tuikit_atomic_x component?widget in your project's main.dart file with ComponentTheme, and add AtomicLocalizations.delegate to the localizationsDelegates of MaterialApp. See the Demo's main.dart file in the source code for reference.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários