Description
CodeEditor hardcodes ClampingScrollPhysics() on its internal Scrollable, which ignores the app's ScrollConfiguration / platform scroll behavior.
Flutter's TextField / EditableText does not hardcode scroll physics. For multiline fields, it uses:
physics: widget.scrollPhysics ?? null,
When scrollPhysics is null, the Scrollable inherits physics from ScrollConfiguration (e.g. CupertinoScrollBehavior → BouncingScrollPhysics on iOS, ClampingScrollPhysics on Android).
In re_editor, _CodeScrollable always uses:
return Scrollable(
scrollBehavior: _ScrollBehavior(scrollbarBuilder),
physics: const ClampingScrollPhysics(), // hardcoded
...
);
Additionally, _ScrollBehavior.getScrollPhysics() returns a custom _ScrollPhysics instance instead of delegating to super.getScrollPhysics(context).
As a result, when CodeEditor is nested inside an outer ScrollView (common for long-form text fields), scroll behavior at the edges differs from TextField on the same page — especially on iOS.
Expected behavior
CodeEditor should use the same scroll physics as other text inputs in the app (via ScrollConfiguration), matching TextField / EditableText behavior on each platform.
Actual behavior
CodeEditor always uses hardcoded ClampingScrollPhysics, regardless of platform or app-level ScrollConfiguration. Nested scroll behavior differs from TextField.
Relevant code (_code_scroll.dart):
return Scrollable(
excludeFromSemantics: true,
controller: controller,
scrollBehavior: _ScrollBehavior(scrollbarBuilder),
viewportBuilder: viewportBuilder,
axisDirection: axisDirection,
physics: const ClampingScrollPhysics(),
);
Proposed solution
1. Remove the hardcoded physics: const ClampingScrollPhysics() from _CodeScrollable, or
2. Add an optional ScrollPhysics? scrollPhysics parameter to CodeEditor (same API as TextField), defaulting to null so ScrollConfiguration is used.
Also update _ScrollBehavior.getScrollPhysics() to delegate to platform defaults:
@override
ScrollPhysics getScrollPhysics(BuildContext context) {
return super.getScrollPhysics(context);
}
Keep _ScrollPhysics only for desktop RawScrollbar dragging if needed, separate from the main Scrollable physics.
This is a small, backward-compatible change that aligns CodeEditor with Flutter's standard text input widgets.
Description
CodeEditorhardcodesClampingScrollPhysics()on its internalScrollable, which ignores the app'sScrollConfiguration/ platform scroll behavior.Flutter's
TextField/EditableTextdoes not hardcode scroll physics. For multiline fields, it uses: