rich_code_editor 0.1.1 copy "rich_code_editor: ^0.1.1" to clipboard
rich_code_editor: ^0.1.1 copied to clipboard

outdated

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 #

  1. RichTextField
    • similar to TextField widget
    • top level widget that wraps everything inside
  2. RichTextFieldState
    • extends State
  3. 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.
  4. RichTextEditingValueParser
    • responsible for parsing text and style
  5. RichTextEditingValue
    • extends AbstractTextEditingValue
    • similar to TextEditingValue
    • uses TextSpan instead of String
  6. AbstractTextEditingValue
    • abstract class
  7. TextInputClient
    • abstract class
    • T type where
    • an interface to receive information from TextInput
    • same as Flutter's TextInputClient
    • plus getValue to get value
  8. TextInputConnection
    • a interface for interacting with a text input control.
    • same as Flutter's TextInputConnection
    • but with setEditingState taking AbstractTextEditingValue as argument
    • requires TextInputClient _client that the connection should be established with (RichEditableTextState)
  9. _TextInputClientHandler
    • same as Flutter's _TextInputClientHandler
  10. TextInput
    • an interface to the system's text input control.
    • same as Flutter's TextInput minus debug info/assertion
  11. RichTextEditingController
    • extends ValueNotifier of type
    • similar to TextEditingController but for
  12. RichEditableText
    • similar to EditableText
  13. RichEditableTextState
    • extends State
    • implements TextInputClient
    • parent for _RichEditable
  14. _RichEditable
    • extends LeafRenderObjectWidget
    • The createRenderObject & updateRenderObject methods update output TextSpans by calling RichTextEditingValueParser.updateSpansWithStyle
  15. 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.

34
likes
0
pub points
21%
popularity

Publisher

unverified uploader

Now create your own rich code editor with syntax highlight support in Flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on rich_code_editor