flutter-code-editor
flutter-code-editor copied to clipboard
Line numbers do not align with lines
See an example here:
Adding a gutter style fixed it for me:
CodeField(
gutterStyle: const GutterStyle(
textStyle: TextStyle(height: 1.5),
showLineNumbers: true,
),
controller: controller,
)
Got this from: https://github.com/akvelon/flutter-code-editor/issues/270#issuecomment-2097035050
Quick Fix: Copy the library to your local project. or Fork flutter_code_editor repository
- Navigate to the code of the package and modify within.(cmd + left click --> on MAC) on CodeField Widget.
- Navigate to GutterWidget (CMD + F --> GutterWidget)
- Wrap the GutterWidget in a Container and add padding top 4.
For more advance solutions you can define gutterPadding within the widget and pass it when you call CodeField Widget
Got a fix for this if anyone still needs it, assuming you use
gutterStyle: GutterStyle(
textStyle: TextStyle(height: 1.5)
)
https://github.com/akvelon/flutter-code-editor/pull/307