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

dash_chat_2 封面
插件详情v0.0.21

dash_chat_2

Flutter 最完整的聊天 UI。易于使用、高度可定制且功能齐全

AndroidiOSWebmacOS
近 30 天下载
4060
喜欢数
312
Pub 分数
110

安装插件

flutter pub add dash_chat_2

插件介绍

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

Dash Chat 2 是一个功能全面、高度可定制的 Flutter 聊天 UI 组件,旨在易于实现的同时提供完整的功能。它支持实时消息传递,包含丰富的消息类型、输入状态指示器、消息反应和媒体附件。专为跨平台使用而设计,可在 Android、iOS、Web 和 macOS 上无缝运行。该包开箱即用地提供简洁现代的界面,并提供广泛的样式和行为自定义选项。非常适合希望快速高效地构建聊天功能应用的开发者。

适合场景

  • 实时消息应用
  • 客户支持聊天界面
  • 群聊应用
  • 应用内通信功能
  • 社交网络平台

主要特点

  • 丰富消息类型(文本、图片、文件)
  • 输入指示器
  • 消息回复
  • 可自定义的UI主题
  • 跨平台兼容性
  • 与后端服务的轻松集成

适合对象

  • 开发聊天功能的开发者
  • 需要快速聊天实现的初创企业
  • 需要响应式聊天UI的应用程序
  • 希望高度定制的团队
  • 针对多个平台的项目

使用建议

  • 需要后端支持持久化消息
  • 实时同步需要自定义逻辑
  • 样式可能需要高级的Flutter知识
  • 有限的内置消息历史记录管理
  • 不适用于需要扩展的复杂聊天工作流

原始 README

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

The most complete Chat UI for flutter

Easy to use, highly customizable and fully featured

License Pub version Contributors

Features

  • Fully customizable components
  • Multi-line TextInput
  • Touchable links using flutter_parsed_text
  • Markdown support using flutter_markdown
  • Avatar as user's initials or profile picture
  • Quick Reply messages
  • Load earlier messages
  • Scroll to bottom Widget
  • Multiple media support (Audio support: WIP)
  • @ Mention users (or anything else)
  • Typing users
  • Reply to messages - WIP
  • Message status - WIP

You need another feature? you can use the customProperties field of the models, it allows you to pass other data to the library that you can then use inside custom builders to implement any feature you need.

Of course, if you think this feature can be useful to other people, feel free to open an issue/pull-request to discuss including it "natively" in the package.

Basic Usage

import 'package:dash_chat_2/dash_chat_2.dart';
import 'package:flutter/material.dart';

class Basic extends StatefulWidget {
  @override
  _BasicState createState() => _BasicState();
}

class _BasicState extends State<Basic> {
  ChatUser user = ChatUser(
    id: '1',
    firstName: 'Charles',
    lastName: 'Leclerc',
  );

  List<ChatMessage> messages = <ChatMessage>[
    ChatMessage(
      text: 'Hey!',
      user: user,
      createdAt: DateTime.now(),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Basic example'),
      ),
      body: DashChat(
        currentUser: user,
        onSend: (ChatMessage m) {
          setState(() {
            messages.insert(0, m);
          });
        },
        messages: messages,
      ),
    );
  }
}

You can run the example project to see more complex ways of using the package

Parameters of DashChat

  • ChatUser currentUser - required: Basically "you", we need to know who is the current user to put their messages to right side

  • Function(ChatMessage message) onSend - required: Function to call when the user sends a message, that's where you handle the logic to send the message to your backend and append the list of messages

  • List<ChatMessage> messages - required: The list of messages of the channel, you would usually not load all the messages at once but use the onLoadEarlier param of MessageListOptions to trigger a lazy loading

  • InputOptions inputOptions - optional: Options to customize the behaviour and design of the chat input

  • MessageOptions messageOptions - optional: Options to customize the behaviour and design of the messages

  • MessageListOptions messageListOptions - optional: Options to customize the behaviour and design of the overall list of message

  • QuickReplyOptions quickReplyOptions - optional: Options to customize the behaviour and design of the quick replies

  • ScrollToBottomOptions scrollToBottomOptions - optional: Options to customize the behaviour and design of the scroll-to-bottom button

  • readOnly - optional (default to false): Option to make the chat read only, it will hide the input field

  • List<ChatUser> typingUsers - optional: List of users currently typing in the chat

Full documentation

You can browse the full Dart documentation here: Documentation

Found this project useful?

If you found this project useful, then please consider giving it a ⭐️ on Github: https://github.com/SebastienBtr/Dash-Chat-2

Issues and feedback

If you have any suggestions for including a feature or if something doesn't work, feel free to open a Github issue or to open a pull request, you are more than welcome to contribute!

Contributors

SebastienBtr
SebastienBtr

💻 🎨
chuusungmin
chuusungmin

💻
fufesou
fufesou

💻
Nwachi ifeanyichukwu Victor
Nwachi ifeanyichukwu Victor

💻
Kaede Games
Kaede Games

💻
Derek Pitts
Derek Pitts

💻
Alex Fernandez
Alex Fernandez

💻
lawrence
lawrence

💻
Md. Al-Amin
Md. Al-Amin

💻
TPF
TPF

💻

Credits

Thanks to Fayeed who created the v1 of this package: https://github.com/fayeed/dash_chat and made that possible!

所属分类

依赖

依赖清单 6 项

源码仓库

使用此插件的项目