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

flutter_summernote 封面
插件详情v1.1.1

flutter_summernote

适用于 Android 和 iOS 的 Flutter 文本编辑器,基于 Summernote 0.8.18 JavaScript 包装器,帮助自由编写 WYSIWYG HTML 代码。

AndroidiOSmacOS
近 30 天下载
219
喜欢数
107
Pub 分数
140

安装插件

flutter pub add flutter_summernote

插件介绍

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

flutter_summernote 是一个 Flutter 包,为 Android、iOS 和 macOS 提供 WYSIWYG HTML 文本编辑器,由 Summernote 0.8.18 JavaScript 库驱动。它使用户能够在 Flutter 应用中自由编写和格式化内容,支持丰富的文本功能。该编辑器支持 HTML 输出,非常适合需要格式化文本输入的应用程序,如博客、内容管理系统或消息平台。通过简单的 pub add 命令即可无缝集成到 Flutter 项目中。

适合场景

  • 移动应用中的内容创作
  • 博客文章编辑器
  • 富文本消息接口
  • 带格式的表单输入
  • 基于HTML的内容管理

主要特点

  • 所见即所得 HTML 编辑
  • 支持 Summernote 0.8.18
  • 跨平台(Android、iOS、macOS)
  • HTML 输出生成
  • 通过 pub 的简单集成
  • 可自定义工具栏

适合对象

  • 开发富文本输入表单的开发者
  • 需要富HTML内容输入的应用程序
  • 移动内容编辑器
  • 在Flutter中使用Summernote功能的项目

使用建议

  • 需要 WebView 进行渲染
  • 有限的原生Flutter控件控制
  • 依赖外部JavaScript库
  • 在低端设备上可能产生性能开销
  • 不适用于纯原生文本编辑而无需HTML输出

原始 README

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

Flutter Summernote

All Contributors

Text Editor in Flutter for Android and iOS to help free write WYSIWYG HTML code based on Summernote 0.8.18 javascript wrapper.

demo example demo example

NOTICE

This package dependent to the Official WebView Plugin. In this package can't add image, video, or another file using editor toolbar. To handle attach image this package give you another solution using image Image Picker at bottom of editor. This package can't use enableinteractiveSelection from TextField, to handle that this package give you another solution using copy paste at bottom of editor. Thank you for all your support.

Setup

add flutter_summernote: ^latest as deppendecy to pubspec.yaml

iOS

Add the following keys to your Info.plist file, located in /ios/Runner/Info.plist:

    <key>io.flutter.embedded_views_preview</key>
    <true/>

    <key>NSCameraUsageDescription</key>
    <string>Used to demonstrate image picker plugin</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Used to capture audio for image picker plugin</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Used to demonstrate image picker plugin</string>

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
         <true/>
    </dict>
Usage
  1. import flutter html editor
    import 'package:flutter_summernote/flutter_summernote.dart';
  1. Create Global key from HTML Editor State
    GlobalKey<FlutterSummernoteState> _keyEditor = GlobalKey();
  1. Add HTML Editor to widget
    FlutterSummernote(
        hint: "Your text here...",
        key: _keyEditor
    ),
    FlutterSummernote(
        hint: "Your text here...",
        key: _keyEditor,
        customToolbar: """
            [
                ['style', ['bold', 'italic', 'underline', 'clear']],
                ['font', ['strikethrough', 'superscript', 'subscript']]
            ]"""
    )
  1. Get text from Html Editor
    final _etEditor = await keyEditor.currentState.getText();
Avalaible option parameters
Parameter Type Default Description
key GlobalKey required for get method & reset
value String empty initiate text content for text editor
height double 380 height of text editor
decoration BoxDecoration empty Decoration editor
widthImage String 100% width of image picker
hint String empty Placeholder hint text
customToolbar String empty Add all available Toolbar. Don't use insert (video & picture), please use hasAttachment option.
customPopover String empty Add all available Popover (the same paragraph as for toolbar, but below)
hasAttachment Boolean false Use this option if you want to show or hide attachment button
showBottomToolbar Boolean false Use this option if you want to show or hide bottom toolbar
returnContent Function null Use this callback to return text content on await keyEditor.currentState.getText() function call.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Chandra Abdul Fattah
Chandra Abdul Fattah

🚇 💻
yusuf afandi
yusuf afandi

💻
Ivan Terekhin
Ivan Terekhin

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。