Unable to use scroll when CodeAutocomplete is nested within another scrollable widget
Hi First of all, thank you for this amazing package.
Tested environment: MacOS, Web
When I put CodeAutocomplete within a ListView widget, I noticed that scroll won't work within CodeAutocomplete while on MacOS. However the scroll correctly works on Web.
@rezmeplxrf Can you provide a minimal reproducible demo?
@rezmeplxrf Can you provide a minimal reproducible demo?
On web scrolling works, but on MacOS, it does not work within the Widget (only works outside the widget).
import 'package:re_editor/re_editor.dart';
import 'package:flutter/material.dart';
class AutoCompleteEditor extends StatefulWidget {
const AutoCompleteEditor({super.key});
@override
State<StatefulWidget> createState() => _AutoCompleteEditorState();
}
class _AutoCompleteEditorState extends State<AutoCompleteEditor> {
final List<CodeLineEditingController> _controllers =
List.generate(5, (_) => CodeLineEditingController());
@override
void initState() {
super.initState();
const text = "Long Text\nLong Text";
for (var controller in _controllers) {
for (var v = 0; v < 20; v++) {
controller.text += text;
}
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView.builder(
itemCount: _controllers.length,
itemBuilder: (context, index) {
final controller = _controllers[index];
return SizedBox(
height: 500,
child: CodeAutocomplete(
viewBuilder: (context, notifier, onSelected) {
return _DefaultCodeAutocompleteListView(
notifier: notifier,
onSelected: onSelected,
);
},
promptsBuilder: DefaultCodeAutocompletePromptsBuilder(
language: langDart,
directPrompts: [],
),
child: CodeEditor(
controller: controller,
wordWrap: false,
),
),
);
},
),
),
);
}
}
I want to apologize, I forgot to respond to this issue.
In fact, embedding the editor inside other scroll layouts is not supported, and we recommend avoiding this in your UX design.