Skip to content

Latest commit

 

History

History
258 lines (184 loc) · 10.1 KB

README.md

File metadata and controls

258 lines (184 loc) · 10.1 KB

Flutter Quill

A rich text editor for Flutter

MIT License PRs Welcome Watch on GitHub Star on GitHub Watch on GitHub


FlutterQuill is a rich text editor and a Quill component for Flutter.

This library is a WYSIWYG (What You See Is What You Get) editor built for the modern Android, iOS, web and desktop platforms. Check out our Youtube Playlist or Code Introduction to take a detailed walkthrough of the code base. You can join our Slack Group for discussion.

Pub: FlutterQuill

Table of contents

Screenshots

Tap to show/hide screenshots
Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

Installation

dependencies:
  flutter_quill: ^<latest-version-here>

OR

dependencies:
  flutter_quill:
    git: https://github.com/singerdmx/flutter-quill.git

Note: At this time, we are making too many changes to the library and you might see new version almost every day

Using the latest version and reporting any issues you encounter on GitHub will greatly contribute to the improvement of the library. Your input and insights are valuable in shaping a stable and reliable version for all our users. Thank you for being part of the open-source community!

If the latest version of FlutterQuill Extensions is pre-release, then please use it in order to work with the latest stable version of FlutterQuill

Compatible versions:

flutter_quill flutter_quill_extensions flutter_quill_test
8.5.2 0.6.9 0.0.5
8.5.1 0.6.7 0.0.5
8.5.0 0.6.7 0.0.5

Theses versions are tested and well supported, you shouldn't get a build failure

Usage

See the example directory for a minimal example of how to use FlutterQuill. You typically just need to instantiate a controller:

QuillController _controller = QuillController.basic();

and then embed the toolbar and the editor, within your app. For example:

QuillProvider(
  configurations: QuillConfigurations(
    controller: _controller,
    sharedConfigurations: const QuillSharedConfigurations(
      locale: Locale('de'),
    ),
  ),
  child: Column(
    children: [
      const QuillToolbar(),
      Expanded(
        child: QuillEditor.basic(
          configurations: const QuillEditorConfigurations(
            readOnly: false,
          ),
        ),
      )
    ],
  ),
)

And depending on your use case, you might want to dispose the _controller in dispose mehtod

Check out Sample Page for more advanced usage.

Migration

We have recently add migration guide for migration from different versions

Input / Output

This library uses Quill as an internal data format.

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

FlutterQuill provides some JSON serialization support, so that you can save and open documents. To save a document as JSON, do something like the following:

var json = jsonEncode(_controller.document.toDelta().toJson());

You can then write this to storage.

To open a FlutterQuill editor with an existing JSON representation that you've previously stored, you can do something like this:

var myJSON = jsonDecode(r'{"insert":"hello\n"}');
_controller = QuillController(
          document: Document.fromJson(myJSON),
          selection: TextSelection.collapsed(offset: 0),
        );

Configurations

The QuillToolbar and QuillEditor widgets lets you customize a lot of things Sample Page provides sample code for advanced usage and configuration.

Links

Font Family

To use your own fonts, update your assets folder and pass in fontFamilyValues. More details at this commit, this article and this.

Embed Blocks

As of version 6.0, embed blocks are not provided by default as part of this package. Instead, this package provides an interface to all the user to provide there own implementations for embed blocks. Implementations for image, video and formula embed blocks is proved in a separate package flutter_quill_extensions.

Provide a list of embed

Using the embed blocks from flutter_quill_extensions

To see how to use the extensions package, please take a look at the README of FlutterQuill Extensions

Custom Embed Blocks

Sometimes you want to add some custom content inside your text, custom widgets inside of them. An example is adding notes to the text, or anything custom that you want to add in your text editor.

Open this page for more info

Custom Toolbar

If you want to use custom toolbar but still want the support of this libray

Open this page for more info

Translation

The package offers translations for the quill toolbar and editor, it will follow the system locale unless you set your own locale.

Open this page for more info

Conversion to HTML

Having your document stored in Quill Delta format is sometimes not enough. Often you'll need to convert it to other formats such as HTML in order to publish it, or send an email.

You have two options:

  1. Using quill_html_converter to convert to/from HTML, the package is not ready yet
  2. Another option is to use vsc_quill_delta_to_html to convert your document to HTML. This package has full support for all Quill operations - including images, videos, formulas, tables, and mentions. Conversion can be performed in vanilla Dart (i.e., server-side or CLI) or in Flutter. It is a complete Dart part of the popular and mature quill-delta-to-html Typescript/Javascript package.

Testing

Please use flutter_quill_test for testing

Contributors

Special thanks for everyone that have contributed to this project...


Made with contrib.rocks.

We welcome contributions!

Please follow these guidelines when contributing to the project. See CONTRIBUTING.md for more details.

We must mention that the CONTRIBUTING.md have a development notes, so if you planning on contribtuing to the repo, please read it.

You can check the Todo list if you want to