8000 GitHub - wilsonowilson/boustro: A rich text editor for Flutter.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wilsonowilson/boustro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov

boustro

Boustro is a rich text editor for Flutter.

flutter_spanned_controller pub package
boustro pub package
boustro_starter pub package

Features

Easy to customize

Boustro is designed to be extremely customizable.

The boustro library itself does not define any of formatting modifiers or embedded content. Instead, it provides the base infrastructure to implement these components outside of boustro. This way, any custom components can be implemented in user code.

Documentation on writing custom components has not yet been written. For now, check out the implementation of the start components in boustro_starter.

Of course, there's some common components a rich text editor is supposed to have out of the box. To that end, a supplementary library called boustro_starter is developed alongside boustro. It contains a bunch of components that you can directly use with boustro.

Themeable with dark and light defaults

Boustro defines extensible theming classes that let users customize the base editor, as well as any components implemented outside of boustro itself. These theme classes even support lerping, for a nice animation when switching themes.

Cross-platform

Boustro builds on Flutter's built-in text widgets, without any custom rendering, so it runs on all platforms supported by Flutter.

Getting Started

Check out the example.

Glossary and Concepts

  • Document: Immutable representation of a rich text document.
  • Paragraph: Can be either a line of text or (non-inline) embed.
  • Line: A line of text with rich formatting.
  • Embed: Any content in a document that is not a Line.
  • Line modifier: Wraps a line and can change the way it's displayed.
  • Text attribute: Applied to text to set its formatting or add gesture recognizers.
  • Span: Text range with a text attribute and rules for how the range behaves when text is inserted (whether it is expanded or not).

Repo structure

Boustro is split into 3 packages that are layered on top of each other.

  1. flutter_spanned_controller: The TextEditingController implementation that makes formatting of editable text possible and data structures to represent text formats and formatted text. The structure is similar to Android's Spannable.
  2. boustro: The actual rich text editor.
  3. boustro_starter: Attributes, line modifiers and embeds to get started with boustro.

Limitations

  • Can't select across lines. I might be able to fix this issue and make line handling (newlines and backspace at the start to delete lines) less hacky by using only a single TextField. However, this would greatly complicate the line paragraph system, and I'm not sure that's worth it.
  • At most 1 gesture per TextSpan. TextSpan can have a gesture recognizer, but not multiple. We can solve this by using a WidgetSpan that wraps a GestureRecognizer, that wraps the actual text span, but that's blocked by:
  • The same issues prevent me from creating inline embeds (e.g. inline images) using WidgetSpan. Please go upvote these issues if you'd like to see these limitations overcome.

Alternatives

  • Zefyr: A big inspiration for this project.

Keep a Changelog + SemVer

Changelogs for the packages document all notable changes.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

About

A rich text editor for Flutter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 82.2%
  • C++ 10.9%
  • CMake 4.2%
  • HTML 2.0%
  • C 0.4%
  • Swift 0.2%
  • Other 0.1%
0