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.

Home Page:https://akvelon.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ScrollController not attached to any scroll views.

zaksnet opened this issue · comments

I get the following error when running the project:
ScrollController not attached to any scroll views.
I am using the code_field project

Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2ad6cd72c0 (7 days ago) • 2023-03-08 09:41:59 -0800
Engine • revision 1837b5be5f
Tools • Dart 2.19.4 • DevTools 2.20.1
flutter_code_editor: ^0.2.13
OS: Windows 11

EDIT: I did try this with Flutter Beta channel also before downgrading to the stable channel and i was receiving the same error
EDIT: This only seems to happen when using a Codefield and not when using a TextField

Any ways to fix this?

add maxLines: null to CodeField

commented

CodeTheme(
data: CodeThemeData(styles: monokaiSublimeTheme),
child: SingleChildScrollView(
child:
CodeField(controller: _controller, maxLines: null),
),
)

Any one found any Fix?

i have the same issue

well checking in again, did anyone find a fix?

for some reason i integrated this to my small app and it didn't give any error weird.

commented

well u can use listview ---
it works in my case--code

column(
 children:[
Flexible(
            flex: 2,
            child: CodeTheme(
              data: CodeThemeData(
                  styles:
                      monokaiSublimeTheme), // <= Pre-defined in flutter_highlight.
              child: ListView(
                children: [
                  CodeField(   
                  minLines: 30,
                    controller: controller,
                    gutterStyle: const GutterStyle(),
                    wrap: true,
                  ),
                ],
              ),
            ),
          ), //flexible 
]
)