File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,11 @@ The editor performs no syntax analysis and so cannot tell if a given class reall
363
363
the method the user is typing. This feature is meant to simplify typing but not to be relied on
364
364
when exploring classes and methods.
365
365
366
- Autocompletion currently cannot be disabled.
366
+ To disable autocompletion:
367
+
368
+ ``` dart
369
+ controller.popupController.enabled = false;
370
+ ```
367
371
368
372
![ Suggestions example] ( https://raw.githubusercontent.com/akvelon/flutter-code-editor/main/example/images/suggestions_example.gif )
369
373
Original file line number Diff line number Diff line change @@ -281,6 +281,10 @@ class CodeController extends TextEditingController {
281
281
insertSelectedWord ();
282
282
return KeyEventResult .handled;
283
283
}
284
+ if (event.logicalKey == LogicalKeyboardKey .escape) {
285
+ popupController.hide ();
286
+ return KeyEventResult .handled;
287
+ }
284
288
}
285
289
286
290
return KeyEventResult .ignored; // The framework will handle.
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ class PopupController extends ChangeNotifier {
5
5
late List <String > suggestions;
6
6
int _selectedIndex = 0 ;
7
7
bool shouldShow = false ;
8
+ bool enabled = true ;
8
9
9
10
final ItemScrollController itemScrollController = ItemScrollController ();
10
11
final ItemPositionsListener itemPositionsListener =
@@ -23,6 +24,10 @@ class PopupController extends ChangeNotifier {
23
24
int get selectedIndex => _selectedIndex;
24
25
25
26
void show (List <String > suggestions) {
27
+ if (enabled == false ) {
28
+ return ;
29
+ }
30
+
26
31
this .suggestions = suggestions;
27
32
_selectedIndex = 0 ;
28
33
shouldShow = true ;
You can’t perform that action at this time.
0 commit comments