Skip to content

Strategy for rendering and editing data other than String #74

Open

Description

@orestesgaolin

Hi, thanks for creating an awesome package. I'm trying to find best way to maintain editing state of my custom class instead of String. It could potentially be represented by String, but when viewing and modifying it I would like the CodeLines object be aware of the backing data.

For instance in pseudo code my class could be:

class MyEntry {
  final DateTime date;
  final String message;
  final String tag;
  final Map<String,String> metadata;

  String toString() => '$date $tag $message $jsonEncode(metadata)';
}

And then I would like to render the toString() representation. When user would modify any part of the string, I would like to receive a callback e.g. with a editing position or any other trace that could let me modify the backing object. When rendering a TextSpan I would love to get access to the corresponding MyEntry object so that I can style the span to my needs. I can assume that each MyEntry would be rendered in a separate line.

I would like to avoid parsing the String in the spanBuilder as the data will be parsed prior to rendering.

I don't think this is a valid feature request for the package itself, but I'm happy to either fork or re-implement any classes that could allow me to achieve this experience.

What would you recommend in such case? Should I implement my own CodeLineEditingController based on _CodeLineEditingControllerImpl and extend CodeLines with a reference to MyEntry?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions