Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rich text editor for Flutter

License

NotificationsYou must be signed in to change notification settings

singerdmx/flutter-quill

Flutter Quill

A rich text editor for Flutter

MIT LicensePRs WelcomeWatch on GitHubStar on GitHubWatch on GitHub


Flutter Quill is a rich text editor and aQuill component forFlutter.

This library is a WYSIWYG (What You See Is What You Get) editor builtfor the modern Android, iOS, web and desktop platforms.

Check out ourYoutube Playlist orCode Introductionto take a detailed walkthrough of the code base.You can join ourSlack Group for discussion.

A screenshot of the iOS example app     A screenshot of the web example app

📚 Table of contents

📦 Installation

flutter pub add flutter_quill

OR

dependencies:flutter_quill:git:url:https://github.com/singerdmx/flutter-quill.gitref:v<latest-version-here>

Tip

If you're using version10.0.0, seethe migration guide to migrate to11.0.0.

🛠 Platform Setup

Theflutter_quill package uses the following plugins:

  1. url_launcher: to open links.
  2. quill_native_bridge: to access platform-specific APIs for theeditor.
  3. flutter_keyboard_visibility_temp_fork to listen for keyboardvisibility changes.

Android Configuration forquill_native_bridge

To support copying images to the clipboard to be accessed by other apps, you need to configure your Android project.If not set up, a warning will appear in the log during debug mode only.

Tip

This is only required onAndroid for this optional feature.You should be able to copy images and paste them inside the editor without any additional configuration.

1. UpdateAndroidManifest.xml

Openandroid/app/src/main/AndroidManifest.xml and add the following inside the<application> tag:

<manifest>    <application>        ...        <providerandroid:name="androidx.core.content.FileProvider"android:authorities="${applicationId}.fileprovider"android:exported="false"android:grantUriPermissions="true" >            <meta-dataandroid:name="android.support.FILE_PROVIDER_PATHS"android:resource="@xml/file_paths" />        </provider>        ...    </application></manifest>

2. Createfile_paths.xml

Create the fileandroid/app/src/main/res/xml/file_paths.xml with the following content:

<paths>    <cache-pathname="cache"path="." /></paths>

Note

Starting with Flutter Quill10.8.4,super_clipboard is no longer required influtter_quill orflutter_quill_extensions.The new default is an internal pluginquill_native_bridge.If you want to continue usingsuper_clipboard, you can use thequill_super_clipboard package (support may be discontinued).

🚀 Usage

Add the localization delegate to your app widget:

import'package:flutter_quill/flutter_quill.dart';import'package:flutter_localizations/flutter_localizations.dart';MaterialApp(  localizationsDelegates:const [GlobalMaterialLocalizations.delegate,GlobalCupertinoLocalizations.delegate,GlobalWidgetsLocalizations.delegate,FlutterQuillLocalizations.delegate,  ],);

Instantiate a controller:

QuillController _controller=QuillController.basic();

Use theQuillEditor andQuillSimpleToolbar widgets,and attach theQuillController to them:

QuillSimpleToolbar(  controller: _controller,  config:constQuillSimpleToolbarConfig(),),Expanded(  child:QuillEditor.basic(    controller: _controller,    config:constQuillEditorConfig(),  ),)

Dispose of theQuillController in thedispose method:

@overridevoiddispose() {  _controller.dispose();super.dispose();}

Check outSample Page for more advanced usage.

🔤 Input / Output

This library utilizesQuill Delta to represent document content.The Delta format is a compact and versatile method for describing document changes through a series of operations that denote insertions, deletions, or formatting changes.

  • Use_controller.document.toDelta() to extract the deltas.
  • Use_controller.document.toPlainText() to extract plain text.

To save the document:

finalString json=jsonEncode(_controller.document.toDelta().toJson());// Stores the JSON Quill Delta

To load the document:

finalString json= ...;// Load the previously stored JSON Quill Delta_controller.document=Document.fromJson(jsonDecode(json));

To change the read-only mode:

_controller.readOnly=true;// Or false to allow edit

🔗 Links

⚙️ Configurations

TheQuillSimpleToolbar andQuillEditor widgets are both customizable.Sample Page provides sample code for advanced usage and configuration.

🔗 Links

🖋 Font Family

To use your own fonts, update yourAssets directory and pass initems toQuillToolbarFontFamilyButton's options.More detailsonthis commit,this articleandthis.

📦 Embed Blocks

Theflutter_quill package provides an interface for all the users to provide their own implementations for embedblocks.

Refer to theCustom Embed Blocks for more details.

🛠️ Using the embed blocks fromflutter_quill_extensions

Theflutter_quill_extensionspackage provide implementations for image and video embed blocks.

🔄 Delta Conversion

Caution

Storing theDelta asHTML in the database to convert it back toDelta whenloading the document is not recommended due to the structural and functional differences between HTML and Delta (see this comment).We recommend storing theDocument asDelta JSONinstead of other formats (e.g., HTML, Markdown, PDF, Microsoft Word, Google Docs, Apple Pages, XML).

ConvertingDelta from/toHTML is not a standard feature inQuill JSorFlutter Quill.

Available Packages for Conversion

PackageDescription
vsc_quill_delta_to_htmlConvertsDelta toHTML.
flutter_quill_delta_from_htmlConvertsHTML toDelta.
flutter_quill_to_pdfConvertsDelta toPDF.
markdown_quillConvertsMarkdown toDelta and vice versa.
flutter_quill_delta_easy_parserConverts QuillDelta into a simplified document format, making it easier to manage and manipulate text attributes.

Tip

You might want to convert betweenHTML andDelta for some use cases:

  1. Migration: If you're using an existing system that stores the data in HTML and want to convert the documentdata toDelta.
  2. Sharing: For example, if you want to share the DocumentDelta somewhere or send it as an email.
  3. Save as: If your app has a feature that allows converting Documents to other formats.
  4. Rich text pasting: If you copy some content from websites or apps, and want to paste it into the app.
  5. SEO: In case you want to use HTML for SEO support.

📝 Rich Text Paste

This feature allows the user to paste the content copied from other apps into the editor as rich text.The pluginquill_native_bridge provides access to the system Clipboard.

An animated image of the rich text paste on macOS

Important

Currently this feature is unsupported on the web.Seeissue #1998 andissue #2220for more details.

🌐 Translation

The package offers translations for the toolbar and editor widgets, it will follow the system locale unless you set yourown locale.

See thetranslation page for more info.

🧪 Testing

Take a look atflutter_quill_test for testing.

Currently, the support for testing is limited.

🤝 Contributing

Important

At this time, we prioritize bug fixes and code quality improvements over new features.Please refrain from submitting large changes to add new features, as they mightnot be merged, and exceptions may made.We encourage you to create an issue or reach out beforehand,explaining your proposed changes and their rationale for a higher chance of acceptance. Thank you!

We greatly appreciate your time and effort.

To keep the project consistent and maintainable, we have a few guidelines that we ask all contributors to follow.These guidelines help ensure that everyone can understand and work with the code easier.

SeeContributing for more details.

📜 Acknowledgments

  • Special thanks to everyone who has contributed to this project...

    Contributors


    Made withcontrib.rocks.

  • Thanks to the welcoming community, the volunteers who helped along the journey, developers, contributorsand contributors who put time and effort into everything including making all the libraries, tools, and theinformation we rely on

  • We are incredibly grateful to many individuals and organizations who have played arole in the project.This includes the welcoming community, dedicated volunteers, talented developers andcontributors, and the creators of the open-source tools we rely on.


[8]ページ先頭

©2009-2025 Movatter.jp