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

markdown_editable_textinput 封面
插件详情v2.2.0

markdown_editable_textinput

一个 TextField 小部件,可让您轻松将 TextField 中的内容转换为 Markdown。

近 30 天下载
454
喜欢数
191
Pub 分数
60

安装插件

flutter pub add markdown_editable_textinput

插件介绍

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

一个 Flutter TextField 小部件,旨在无缝将文本输入转换为 Markdown 格式。它允许用户直接键入内容,同时自动应用 Markdown 语法,非常适合轻量级笔记或带有丰富文本格式的内容创作。该包可轻松集成到表单和编辑器中,提供实时 Markdown 渲染,无需复杂设置。本着简洁易用的设计理念,它通过直观的键盘快捷键或手动标记支持常见的 Markdown 功能,如粗体、斜体、标题和列表。非常适合寻求简洁但功能强大的 Markdown 输入解决方案的开发者。

适合场景

  • 简单的笔记应用
  • 基于 Markdown 的内容创作
  • 带富文本格式的表单输入
  • 轻量级博客编辑器
  • 实时 Markdown 预览

主要特点

  • 实时 Markdown 转换
  • 直观的键盘快捷键
  • 支持常见的 Markdown 语法
  • 最小化设置和集成
  • 简洁、专注的用户界面设计

适合对象

  • 开发轻量级编辑器的开发者
  • 需要基本 Markdown 输入的应用程序
  • 带有文本格式化的教育工具
  • 使用 Markdown 的内容创作者
  • 优先考虑简单性而非复杂性的项目

使用建议

  • 仅限基本 Markdown 功能
  • 无内置预览渲染
  • 不适用于高级 Markdown 解析
  • 需要手动处理复杂的格式
  • 如果需要预览,则依赖外部 Markdown 渲染

原始 README

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

Build Status pub package codecov

markdown_editable_textinput

MarkdownEditableTextInput is a TextField Widget that allow you to convert easily what's in the TextField to Markdown.

Features

  • [x] Convert to Bold, Italic, Strikethrough
  • [x] Convert to Code, Quote, Links
  • [x] Convert to Heading (H1, H2, H3, H4, H5, H6) and Links
  • [x] Support text direction
  • [x] Dialog mode to enter link and picture
  • [x] Possibility to add custom buttons to the action bar

Demo

Link by Dialog demo

Usage

The color of the MarkdownTextInput is defined by the color set in your Theme :

  • primaryColor: Cursor's color
  • colorScheme.secondary: MarkdownTextInput's borders
  • cardColor: Background color of MarkdownTextInput
Attributes
Attributes Example Value Description
Function onTextChanged Callback used to retrieve the text in parent's Widget
String initialValue "Lorem Ipsum" Display an initial value in MarkdownTextInput's field
Function validators Add validators to the MarkdownTextInput
String label "Description" Display a label in MarkdownTextInput
TextDirection textDirection TextDirection.rtl Change text direction
int maxLines 3 The maximum of lines that can be display in the input
List actions [MarkdownType.bold, MarkdownType.italic] Actions the editor will handle
TextEditingController controller TextEditingController() Pass your own controller. Can be used to clear the input for example
TextStyle textStyle Theme.of(context).textTheme.bodyText2 Overrides input text style
bool insertLinksByDialog; true Choose to use dialog or not to insert link
bool insertImageByDialog; true Choose to use dialog or not to insert an image
bool insertImageByDialog; true Choose to use dialog or not to insert an image
bool customCancelDialogText; String? Text used by dialog for close dialog action
bool customSubmitDialogText; String? Text used by dialog for validate dialog action
Example

You can see an example of how to use this package here

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目