- Notifications
You must be signed in to change notification settings - Fork996
Rich text editor for Flutter
License
singerdmx/flutter-quill
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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.
- 📦 Installation
- 🛠 Platform Setup
- 🚀 Usage
- 🔤 Input / Output
- ⚙️ Configurations
- 📦 Embed Blocks
- 🔄 Delta Conversion
- 📝 Rich Text Paste
- 🌐 Translation
- 🧪 Testing
- 🤝 Contributing
- 📜 Acknowledgments
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.
Theflutter_quill package uses the following plugins:
url_launcher: to open links.quill_native_bridge: to access platform-specific APIs for theeditor.flutter_keyboard_visibility_temp_forkto listen for keyboardvisibility changes.
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).
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.
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
TheQuillSimpleToolbar andQuillEditor widgets are both customizable.Sample Page provides sample code for advanced usage and configuration.
- 🛠️ Using Custom App Widget
- 🌍 Localizations Setup
- 🔠 Font Size
- 🖋 Font Family
- 🔘 Custom Toolbar buttons
- 🔍 Search
- ✂️ Shortcut events
- 🎨 Custom Toolbar
To use your own fonts, update yourAssets directory and pass initems toQuillToolbarFontFamilyButton's options.More detailsonthis commit,this articleandthis.
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.
Theflutter_quill_extensionspackage provide implementations for image and video embed blocks.
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
| Package | Description |
|---|---|
vsc_quill_delta_to_html | ConvertsDelta toHTML. |
flutter_quill_delta_from_html | ConvertsHTML toDelta. |
flutter_quill_to_pdf | ConvertsDelta toPDF. |
markdown_quill | ConvertsMarkdown toDelta and vice versa. |
flutter_quill_delta_easy_parser | Converts 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:
- Migration: If you're using an existing system that stores the data in HTML and want to convert the documentdata toDelta.
- Sharing: For example, if you want to share the DocumentDelta somewhere or send it as an email.
- Save as: If your app has a feature that allows converting Documents to other formats.
- Rich text pasting: If you copy some content from websites or apps, and want to paste it into the app.
- SEO: In case you want to use HTML for SEO support.
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.
Important
Currently this feature is unsupported on the web.Seeissue #1998 andissue #2220for more details.
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.
Take a look atflutter_quill_test for testing.
Currently, the support for testing is limited.
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.
Special thanks to everyone who has contributed to this project...
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.
About
Rich text editor for Flutter
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.



