v0.2.0
simple_markdown_editor
一個 TextField 小部件,可讓您輕鬆將 TextField 中的內容轉換為 Markdown。
33喜歡 36近 30 天下載60Pub 分數
平台暫無資料
適用於 Flutter 的 Markdown 編輯器
^5.0.1{"sdk":"flutter"}^0.6.6^9.1.0^4.0.0^1.0.4{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
Support Me Support Me GitHub stars undo GitHub
Simple markdown editor library For flutter. For demo video, you can see it at this url Demo
Add dependencies to your pubspec.yaml
dependencies:
simple_markdown_editor: ^latest
Run flutter pub get to install.
Import library
import 'package:simple_markdown_editor/simple_markdown_editor.dart';
Initialize controller and focus node. These controllers and focus nodes are optional because if you don't create them, the editor will create them themselves
TextEditingController _controller = TextEditingController();
FocusNode _focusNode = FocusNode();
Show widget for editor
// editable text with toolbar
MarkdownFormField(
controller: _controller,
enableToolBar: true,
emojiConvert: true,
autoCloseAfterSelectEmoji: false,
)
// editable text without toolbar
MarkdownField(
controller: _controller,
emojiConvert: true,
)
if you want to parse text into markdown you can use the following widget:
String data = '''
**bold**
*italic*
#hashtag
@mention
'''
MarkdownParse(
data: data,
onTapHastag: (String name, String match) {
// name => hashtag
// match => #hashtag
},
onTapMention: (String name, String match) {
// name => mention
// match => #mention
},
)