搜索插件、代码仓与 APP 分类

apptex_chat 封面
插件详情v2.0.0

apptex_chat

此包旨在使聊天系统更加简单易用,并通过一键操作控制聊天功能。

近 30 天下载
81
喜欢数
15
Pub 分数
60

安装插件

flutter pub add apptex_chat

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Apptex Chat 是一个专为简化应用程序中聊天系统实现而设计的 Flutter 包。它提供直观、用户友好的界面,使开发者能够以最少的努力管理聊天功能——通常只需一键操作。该包旨在轻松集成,简化了消息发送、输入状态指示和消息历史记录等常见聊天功能。其目标是减少开发时间,同时保持简洁且响应迅速的设计。非常适合需要实时通信但无需大量自定义编码的应用程序。

适合场景

  • 即时通讯应用
  • 客户支持聊天界面
  • 应用内点对点通信
  • 实时协作工具
  • 内部团队消息系统

主要特点

  • 一键功能控制
  • 预构建的聊天 UI 组件
  • 与 Firebase 或其他后端轻松集成
  • 支持消息历史记录和送达状态
  • 可自定义的主题和样式

适合对象

  • 寻求快速聊天实现的开发者
  • 需要轻量级聊天功能的应用
  • 构建带有聊天功能的MVP的团队
  • 优先考虑开发者生产力的项目

使用建议

  • 超出所提供主题的定制选项有限
  • 依赖外部后端服务
  • 无内置身份验证
  • 可能需要额外设置才能使用高级功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

This package is a powerful and versatile solution for implementing real-time chat functionality in your Flutter applications. Built on Firebase Firestore and Firebase Cloud, this package provides a unique and pre-designed chatting system with features such as push notifications and a customizable theme for the Inbox Screen and Chat Screen.

Platform Tested : Result OK

Android iOS macOS Web Linux Windows
✔ ✔ :x: :x: :x: :x:

Key Features

  • Easy to use: The package offers a straightforward implementation process, allowing you to integrate chat functionality seamlessly into your app.
  • Direct Integration: Firebase Firestore and Firebase Cloud are directly integrated, ensuring reliable and efficient communication between users.
  • Pre-Build UI: The package comes with a pre-built user interface for the chat screens, eliminating the need for extensive design work.
  • Start Chat with a Single Function: Initiating a chat is as simple as calling a single function, enabling users to connect and communicate quickly.
  • Customizable Themes: Both the Home Screen and Chat Screen can be customized to match your app's design and branding.

Gallery

Installation

To get started, add the following dependency to your pubspec.yaml file:

dependencies:
  apptex_chat: ^2.0.0

Then, run flutter pub get to install the package.

Usage

Step 1 : Firebase Configuration

  1. Install Firebase in your project
  2. Download google-services.json and GoogleService-Info.plist file for your project from firebase.
  3. Inilize firebase in the main function.

Step 2 : User Authentication

To enable chat functionality, you need to authenticate users. When a user signs up or logs in, you can pass their information to AppTexChat using the initChat method.

// Here you can set the current user to the Apptex chat
AppTexChat.instance.initChat(
 currentUser: ChatUserModel(
   uid: "{uid}",
   profileUrl: "{Profile url}",
   name: "{Currect User Name}",
   fcmToken: "{Fcm Token}", //Pass empty string if you don't have fcm token
 ),
);

Replace Current User Name, uid, profile URL, and Fcm Token with the corresponding values for the user.

Step 3 : Starting a Chat

To start a chat with another user, call the startNewConversationWith function:

//Here you need to pass the other user's info
AppTexChat.instance.startNewConversationWith(
  ChatUserModel(
    uid: "Other user uid",
    profileUrl: 'Other user profile',
    name: 'Other user name',
    fcmToken: 'Other user fcm token',
  ),
);

Show Conversations on Inbox Screen

To see a list of all the conversations, use the ConversationsScreen widget. It has a builder parameter which gives you the flexibility to list the conversation according to your app's design.

// Example 
ConversationsScreen(
  builder: (conversations, isLoading) => ListView.separated(
    separatorBuilder: (context, index) => SizedBox(height: 20),
    shrinkWrap: true,
    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
    itemCount: conversations.length,
    itemBuilder: (context, index) => Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(10),
        color: Colors.white,
        boxShadow: [
          BoxShadow(
            color: Colors.grey.withOpacity(0.5),
            spreadRadius: 1,
            blurRadius: 2,
            offset: Offset(0, 1),
          )
        ],
      ),
      padding: EdgeInsets.all(10),
      child: ListTile(
        onTap: () {
          //TODO: Navigate to chat screen
        },
        leading: CircleAvatar(
          backgroundImage:
              NetworkImage(conversations[index].otherUser.profileUrl ?? ''),
        ),
        title: Text(conversations[index].otherUser.name),
        subtitle: Text(conversations[index].lastMessage),
        trailing: Container(
          padding: EdgeInsets.all(5),
          decoration: BoxDecoration(
            color: Colors.blue,
            shape: BoxShape.circle,
          ),
          child: Text(
            conversations[index].unreadMessageCount.toString(),
            style: TextStyle(color: Colors.white),
          ),
        ),
      ),
    ),
  ),
);

Display messages of a specific chat

To see messages of a specific conversation, use the ChatScreen widget. It has an appBarBuilder(required) and bubbleBuilder(optional) parameter which gives you the flexibility to create custom appbar and chat bubbles according to your app's design.

ChatScreen(
 conversationModel: conversationModel, 
 showMicButton: false, //It is true by default, set it to false if you don't want voice messages
 appBarBuilder: ((currentUser, otherUser) => AppBar()), //Builder to create custom AppBar
);

Features Status

  1. Chating ✅
  2. Voice messages ✅
  3. Images ✅
  4. Emojis ✅
  5. Videos 🚫
  6. Document 🚫
  7. Location 🚫

Additional information

More is about to Come:

Features that will be added later:

  1. Push Notifications
  2. Make it for web

Frameworks Used

  1. Firebase Firestore
  2. Firebase Cloud storage

Contributors


Sayed Muhammad Idrees

💻 🎨

Shah Raza

💻

Jamshid Ali

💻

Afaq Zahir

💻

Help Maintenance

Buy Me A Coffee

所属分类

依赖

源码仓库

使用此插件的项目

暂无相关数据。