You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
Add programmatic API to fold and unfold all code regions #12
Currently, CodeCrafterController supports code folding through callbacks like setFoldAtCallback, but there is no public API to programmatically trigger folding or unfolding of all foldable regions.
This limitation makes it difficult to:
Implement "Collapse All" / "Expand All" buttons in an IDE-style UI.
Restore user fold states after reopening a file.
Provide shortcuts or automated folding behavior.
—
Feature Request
Please add public methods (or similar) to CodeCrafterController, e.g.:
dart
controller.collapseAll();
controller.expandAll();
controller.toggleFoldAtLine(int lineIndex);
Or a method such as setFoldStateForAll(bool folded).
These should update internal folding state and call refresh() to re-render.
Motivation / Use Case
I’m building a custom Flutter code editor and need UI buttons or keyboard shortcuts for “Collapse All / Expand All.”
Current Workaround
Limitation: only workaround is to redefine foldAt callback and call controller.refresh(), which isn’t ergonomic for UI actions.
You can programmatically fold any foldable lines using controller.foldAt(line_numer).
However I cannot update anything right now because I'm too busy with my college exams.
Also I'm building a new code editor called flutter_code_forge from scratch using RenderBox by drawing pixels in canvas instead of extending TextEditingController. It's a complete alternative to this package . Because Flutter's built in TextField lags for large text files with 2000+ lines of code.
So I will add these features in flutter_code_forge.
Activity
heckmon commentedon Oct 5, 2025
You can programmatically fold any foldable lines using controller.foldAt(line_numer).
However I cannot update anything right now because I'm too busy with my college exams.
Also I'm building a new code editor called
flutter_code_forgefrom scratch using RenderBox by drawing pixels in canvas instead of extending TextEditingController. It's a complete alternative to this package . Because Flutter's built in TextField lags for large text files with 2000+ lines of code.So I will add these features in
flutter_code_forge.heckmon commentedon Dec 11, 2025
@jpdup Hello, finally, I published the new package
code_forgewith features like foldAll, unfoldAll, toggleFold, etc.Have a look: https://pub.dev/packages/code_forge