Skip to content

Support TextField.undoHistoryController #565

@driftwoodstudio

Description

@driftwoodstudio

Use case

Linking into stream of undo events from text field is critical for any application that needs to support undo of more than just text edit changes in one field.

Example: an address book app needs to be able to undo/redo addition and deletion of records, recording of records. This has to be manually tracked by the application using it's own (custom) Undo/Redo Controller system (since flutter provides none for this purpose). That system needs to also be able to incorporate text-edit events in the "undo" history stack.

Consider: Select contact, edit contact's first name, add new contact, enter a last name, delete a contact. That needs to be reversible via Cmd-Z: restore deleted, undo change to last name, undo change to first name.

By not supporting UndoHistoryManager, you're forcing devs to use TextField.onChange() handler, which gets called for every single keystroke in the TextField. The smart "chunking" of multiple keystrokes that UndoHistoryManager provides is now something that the Dev must build manually by processing a continuous flood of keystrokes that the dev must somehow translate into usable "undo-able" events for the application's overall UndoRedo management system.

MacosTextField(
          controller: controller,
          focusNode: focusNode,
          style: style,
          ...
          undoHistoryManager: myUndoHistoryManagerObject,
          ...
}

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