logo
0
0
Login
vinsonswang<34643015+vinsonswang@users.noreply.github.com>
Added Flutter 3.29.0 and 3.32.4 upgrade instructions

Compatible Platforms

The platforms are compatible with the deployment of our Chat UIKit.

  • Android
  • iOS
  • Web (version 0.1.4 and later)
  • Windows (version 2.0.0 and later)
  • macOS (version 2.0.0 and later)

Check Out Our Sample Apps

This document introduces how to quickly run the Chat demo on the iOS platform. For the other platforms, please refer to document:

Environment Requirements

PlatformVersion
FlutterFlutter 3.0.0 or later for the IM SDK; Flutter 3.24.0 or later for the TUIKit component library.
AndroidAndroid Studio 3.5 or later; devices with Android 4.1 or later for apps
iOSXcode 11.0 or later. Ensure that your project has a valid developer signature.
Flutter versiontencent_cloud_chat_uikit versionThird-party librariesCompatible Configurations
3.32.4^5.0.0
  • intl: ^0.20.2
3.29.0^5.0.0
  • extended_text: ^15.0.0
Clipboard_Screenshot_1750234261
3.27.0^3.1.0+2
  • Replace the flutter_slidable library with flutter_slidable_plus_plus to solve the compatibility issue of flutter 3.27.0 version.
3.24.0 - 3.24.4^3.0.0
  • extended_text: ^14.0.0
  • extended_text_field: ^16.0.0
  • flutter_plugin_record_plus: ^0.0.17
  • image_gallery_saver:The latest version of this library does not support Flutter 3.24. Please refer to the [Compatible Configuration] on the right.
build.gradle
3.22.0 - 3.22.3^2.7.2
  • extended_text: ^13.0.0
  • extended_text_field: ^15.0.0

Preparation

Step 1. Create an App

  1. Log in to the Chat Console. If you already have an app, record its SDKAppID.
  2. On the Application List page, click Create Application.
  3. In the Create Application dialog box, enter the app information and click Confirm. After the app is created, an app ID (SDKAppID) will be automatically generated, which should be noted down.

Step 2: Obtain Key Information

  1. Click Application Configuration in the row of the target app to enter the app details page.
  2. Click View Key and copy and save the key information.

Please store the key information properly to prevent leakage.

Running the sample app

  1. Download the source code and install dependencies:
# Clone the code git clone https://github.com/TencentCloud/chat-demo-flutter.git # Flutter clean flutter clean # Install dependencies flutter pub get
  1. [Optional] Running or Deploying on the Web

If you prefer to run or deploy this sample app on the web, you'll need to complete a few additional steps first.

Navigate to the web/ directory of your project and use npm or Yarn to install the required JavaScript dependencies.

cd web npm install

Once you've completed these steps, you'll be ready to run or deploy the sample app on the web.

  1. Run it:

Start the sample app. Fill in sdkAppID and key recorded in Chat Console in config.dart

(Optional) Using the IDE

Android

  1. Go to the discuss/android directory via Android Studio.

  2. Start an Android simulator, tap Build And Run to run the sample app. Enter a random UserID (a combination of digits and letters).

The UI of the latest version of the sample app may look different after adjustments.

iOS

  1. Open Xcode and the file discuss/ios/Runner.xcodeproj:

  2. Connect an iPhone, and click Build And Run. After the iOS project is built, the Xcode project will be displayed in a new pop-up window.

  3. Open the iOS project, and set Signing & Capabilities (an iPhone developer account required) for the primary target to run the project on the iPhone.

  4. Start the project and debug the sample app on the iPhone device.

Sample app code structure

The TUIKit Library Overview for Flutter is used for the UI and business logic of the sample app. The sample app layer itself is only used to build the application, process navigation redirects, and call instantiated TUIKit components.

FolderDescription
libCore application directory
lib/i18nInternationalization code, excluding the internationalization capabilities and strings of TUIKit, which can be imported as needed.
lib/srcMain application directory
lib/src/pagesImportant navigation pages of the sample app. After the application is initialized, app.dart displays the loading animation, judges the login status, and redirects the user to login.dart or home_page.dart. After the user logs in, the login information will be stored locally through the shared_preference plugin and used for automatic login upon future application launch. If there is no such information or the login fails, the user will be redirected to the login page. During automatic login, the user is still on app.dart and can see the loading animation. home_page.dart has a bottom tab to switch between the four main feature pages of the sample app.
lib/utilsSome tool function classes.

Basically, a TUIKit component is imported into each dart file in lib/src. After the component is instantiated in the file, the page can be rendered.

Below are main files:

Main File in lib/srcDescription
add_friend.dartFriend request page that uses the TIMUIKitAddFriend component.
add_group.dartGroup joining request page that uses the TIMUIKitAddGroup component.
blacklist.dartBlocklist page that uses the TIMUIKitBlackList component.
chat.dartMain chat page that uses all the chat capabilities of TUIKit and the TIMUIKitChat component.
chatv2.dartMain chat page that uses atomic capabilities and the TIMUIKitChat component.
contact.dartContacts page that uses the TIMUIKitContact component.
conversation.dartConversation list page that uses the TIMUIKitConversation component.
create_group.dartGroup chat page that is implemented in the sample app with no component used.
group_application_list.dartGroup application list page that uses the TIMUIKitGroupApplicationList component.
group_list.dartGroup list page that uses the TIMUIKitGroup component.
group_profile.dartGroup profile and management page that uses the TIMUIKitGroupProfile component.
newContact.dartNew contact request page that uses the TIMUIKitNewContact component.
routes.dartSample app route that navigates users to the login page login.dart or homepage home_page.dart.
search.dartGlobal search and in-conversation search page that uses the TIMUIKitSearch (global search) and TIMUIKitSearchMsgDetail (in-conversation search) components.
user_profile.dartUser information and relationship chain maintenance page that uses the TIMUIKitProfile component.

The navigation redirect method needs to be imported into most TUIKit components; therefore, the sample app layer needs to process Navigator.

You can modify the above sample app for secondary development or implement your business needs based on it.

Recommended Resources

For those who require real-time voice and video call capabilities alongside our Chat UIKit, we highly recommend our dedicated voice and video call UI component package, tencent_calls_uikit. This robust and feature-rich package is specifically designed to complement our existing solution and seamlessly integrate with it, providing a comprehensive, unified communication experience for your users.