rich_code_editor 0.1.21 rich_code_editor: ^0.1.21 copied to clipboard
Now create your own rich code editor with syntax highlight support in Flutter.
rich_code_editor #
A simple package that supports creating code editors in Flutter.
Getting Started #
Create your own implementation of RichTextEditingValueParserBase
for any programming language of your choice and pass it to the RichTextField
.
Check out example project for getting started with this project.
Explanation of most of the classes/widgets created #
- RichTextField
- similar to TextField widget
- top level widget that wraps everything inside
- RichTextFieldState
- extends State
- RenderRichEditable
- extends RenderBox
- renderer for an editable text field
- It does not directly provide affordances for editing the text,
- but it does handle text selection and manipulation of the text cursor.
- RichTextEditingValueParser
- responsible for parsing text and style
- RichTextEditingValue
- similar to TextEditingValue
- uses TextSpan instead of String
- RichTextEditingController
- extends ValueNotifier of type
- similar to TextEditingController but for
- RichEditableText
- similar to EditableText
- RichEditableTextState
- extends State
- implements TextInputClient
- parent for
_RichEditable
- _RichEditable
- extends LeafRenderObjectWidget
- The createRenderObject & updateRenderObject methods update output TextSpans by calling
RichTextEditingValueParser.updateSpansWithStyle
- Extensions
- utilities for working with TextSpan
Credits #
A big thanks to Razvan Lung for starting the Rich text editor project "https://github.com/long1eu/rich_editor". Most of the codes have been used from his repo and adjusted as needed.