搜尋套件、儲存庫與 APP 分類

rich_editor 封面
套件詳情v0.5.0

rich_editor

適用於 Flutter 的 WYSIWYG 編輯器,支援豐富的格式化選項。

AndroidiOSmacOSWindows
近 30 天下載
1030
喜歡數
93
Pub 分數
150

安裝套件

flutter pub add rich_editor

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

適用於 Flutter 的 WYSIWYG 編輯器,支援粗體、斜體、清單、連結等豐富文字格式。專為需要進階文字輸入功能的應用程式設計,提供簡潔直覺的介面,用於編輯格式化內容。以可擴展性為設計核心,支援自訂樣式與外掛。此套件持續維護,並相容於 Android、iOS、macOS 與 Windows 平台。

適用情境

  • 在筆記應用中建立富文字內容
  • 建構部落格或文章編輯器
  • 實施用戶產生內容表單
  • 開發協作文件工具
  • 啟用格式化訊息介面

主要特色

  • 即時所見即所得編輯
  • 豐富的格式選項(粗體、斜體、底線等)
  • 對連結、圖片和清單的支援
  • 可自定義的工具列和主題
  • 跨平台相容性

適合對象

  • 開發內容豐富的Flutter應用程式之開發者
  • 需要使用者友善文字編輯的應用程式
  • 需要 Markdown 或 HTML 輸出的項目
  • 致力於跨平台文字編輯器的團隊

使用建議

  • 可能需要額外設定以實現複雜樣式
  • 性能可能因大型文件而異
  • 有限的內建圖像上傳處理
  • 需要理解 Flutter 的渲染模型

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

✨ rich_editor

pub package pub points

WYSIWYG editor for Flutter with a rich set of supported formatting options.

Based on https://github.com/dankito/RichTextEditor, but for Flutter.

✨ Features

  • [x] Bold, Italic, Underline, Strike through, Subscript, Superscript
  • [x] Heading 1 - 6, Text body, Preformatted, Block quote
  • [x] Font (reads all system fonts) (Android only)
  • [x] Font Size
  • [x] Text Color
  • [x] Text Background Color
  • [x] Highlight text
  • [x] Justify Left, Center, Right, Blockquote
  • [x] Indent, Outdent
  • [x] Undo, Redo
  • [x] Unordered List (Bullets)
  • [x] Ordered List (Numbers)
  • [x] Insert local or remote Image
  • [x] Insert Link
  • [x] Insert Checkbox
  • [ ] Search
  • [ ] Icon indicators

📸 Screenshots

Usage

      // Insert widget into tree
      RichEditor(
        key: keyEditor,
        value: 'initial html here',
        editorOptions: RichEditorOptions(
          placeholder: 'Start typing',
          // backgroundColor: Colors.blueGrey, // Editor's bg color
          // baseTextColor: Colors.white,
          // editor padding
          padding: EdgeInsets.symmetric(horizontal: 5.0),
          // font name
          baseFontFamily: 'sans-serif',
          // Position of the editing bar (BarPosition.TOP or BarPosition.BOTTOM)
          barPosition: BarPosition.TOP,
        ),
        // You can return a Link (maybe you need to upload the image to your
        // storage before displaying in the editor or you can also use base64
        getImageUrl: (image) {
          String link = 'https://avatars.githubusercontent.com/u/24323581?v=4';
          String base64 = base64Encode(image.readAsBytesSync());
          String base64String = 'data:image/png;base64, $base64';
          return base64String;
        },
      )

Get current HTML from editor

String? html = await keyEditor.currentState?.getHtml();
print(html);

Set Focus and Unfocus

await keyEditor.currentState?.focus();
await keyEditor.currentState?.unFocus();

Clear Editor content

await keyEditor.currentState?.clear();
Custom Toolbar

If you're interested in creating your own toolbar check the custom_toolbar_demo.dart in the example

License

Copyright 2021 JideGuru

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案