akvelon / flutter-code-editor

Flutter Code Editor is a multi-platform code editor supporting syntax highlighting, code blocks folding, autocompletion, read-only code blocks, hiding specific code blocks, themes, and more.
https://akvelon.com
Apache License 2.0
213 stars 54 forks source link

Line numbers #270

Closed muhsintr closed 6 months ago

muhsintr commented 6 months ago

Line numbers are not aligned with code lines.

Screenshot 2024-05-04 at 10 09 08

As attached, line numbers in the left side (80-83) are above expected position.

franklin83diaz commented 6 months ago

in my case the solution was added height: 1.5 to the gutterStyle

 ...
 child: ListView(
          children: [
            CodeField(
              controller: controller,
              minLines: 20,
              gutterStyle: const GutterStyle(
                textStyle: TextStyle(color: Colors.grey, height: 1.5),
                showLineNumbers: true,
              ),
              onChanged: (text) {
                print(text);
              },
            ),
          ],
        ),
...
muhsintr commented 6 months ago

in my case the solution was added height: 1.5 to the gutterStyle

 ...
 child: ListView(
          children: [
            CodeField(
              controller: controller,
              minLines: 20,
              gutterStyle: const GutterStyle(
                textStyle: TextStyle(color: Colors.grey, height: 1.5),
                showLineNumbers: true,
              ),
              onChanged: (text) {
                print(text);
              },
            ),
          ],
        ),
...

It worked. Thanks a lot :)