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

插件详情v0.0.3

custom_rich_text

一个自定义的富文本包,允许对文本进行高亮和链接引用。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
135
喜欢数
36
Pub 分数
140

安装插件

flutter pub add custom_rich_text

插件介绍

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

一个 Flutter 包,可在文本中实现富文本渲染,并支持自定义高亮和可点击的链接引用。它通过允许开发者在文本流中嵌入交互式元素(如高亮关键词和超链接),扩展了标准文本控件的功能。非常适合显示格式化内容,例如文章、聊天消息或带有动态样式和导航的文档。该包支持多个平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

适合场景

  • 显示格式化文章
  • 创建交互式聊天消息
  • 使用链接渲染文档
  • 在文本中突出显示关键词
  • 构建功能丰富的笔记应用

主要特点

  • 自定义文本高亮
  • 可点击的链接引用
  • 跨平台支持
  • 可扩展的文本样式
  • 与现有控件的轻松集成

适合对象

  • 开发丰富文本 UI 的开发者
  • 需要交互式文本内容的应用程序
  • 内容密集型应用
  • 教育或文档平台
  • 聊天或消息界面

使用建议

  • 需要仔细处理点击手势
  • 复杂布局可能需要额外的样式
  • 仅限基本超链接功能
  • 不适合用于功能完整的 WYSIWYG 编辑器
  • 大段文本带来的性能影响

原始 README

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

Custom RichText

CustomRichText is a package that allows highlighting and link reference to the text.

Image Plugin

Key Features

  • Highlights email, phone number, web link, custom RegExp, certain sub-strings
  • Provides a call back on each highlighted string
  • Option for read more, read less and a call back for both
  • Allow text styling as per requirement

Note

  • If you want to highlight any specific type of text then need to add the following on tap method.
  • If any link or email consists the provided sub-string then it will ignore that and will be highlighted as web link or email.

Getting Started

To use this package, add custom_rich_text as a dependency in your pubspec.yaml file.

dependencies:
  ...
  custom_rich_text: any

Now in your Dart code, you can use:

 import 'package:custom_rich_text/custom_rich_text.dart';

Usage

Example
CustomRichText(
  text: 'MindInventory is first-rate choice of the '
      'clients worldwide. With sheer customer satisfaction in mind, we are profoundly '
      'dedicated to developing highly intriguing apps that strictly meet the business '
      'requirements and catering a wide spectrum of projects. Kickstart Your Digital '
      'Journey Today and get all your queries and concerns answered by our business '
      'development team. Our email address is sales@mindinventory.com, our website '
      'https://www.mindinventory.com and our Contact number is +91-951-229-3490',
  caseSensitive: false,
  readMoreLessModel: ReadMoreLessModel(
    trimLines: 3,
    readMoreText: ' read more',
    readLessText: ' read less',
    readMoreLessStyle: kReadMoreLessStyle,
  ),
  textStyle: kTextStyle,
  linkStyle: kLinkStyle,
  highlightTermsStyle: kLinkStyle,
  onWebLinkTap: (web) async {
    await launch(web);
  },
  onPhoneTap: (phone) async {
    await launch('tel:$phone');
  },
  onEmailTap: (email) async {
    await launch('mailto:$email');
  },
  highlightTerms: [kMindinventory],
  onTermTap: (text) async {
    await launch('https://www.mindinventory.com/');
  },
),

Guideline for contributors

Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only.

Guideline to report an issue/feature request

It would be great for us if the reporter can share the below things to understand the root cause of the issue.

  • Library version
  • Code snippet
  • Logs if applicable
  • Device specification like (Manufacturer, OS version, etc)
  • Screenshot/video with steps to reproduce the issue

LICENSE!

Custom RichText is MIT-licensed.

Let us know!

We’d be really happy if you send us links to your projects where you use our component. Just send an email to sales@mindinventory.com And do let us know if you have any questions or suggestion regarding our work.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。