6
6
7
7
Flutter Code Editor is a multi-platform code editor supporting:
8
8
9
- - Syntax highlighting,
9
+ - Syntax highlighting for over 100 languages ,
10
10
- Code blocks folding,
11
11
- Autocompletion,
12
12
- Read-only code blocks,
@@ -63,7 +63,7 @@ See the full runnable example [here](https://github.com/akvelon/flutter-code-edi
63
63
### Syntax Highlighting
64
64
65
65
Flutter Code Editor supports
66
- [ over a hundred languages] ( https://github.com/git-touch/highlight.dart/tree/master/highlight/lib/languages )
66
+ [ over a hundred languages] ( https://github.com/git-touch/highlight.dart/tree/master/highlight/lib/languages ) ,
67
67
relying on the [ highlight] ( https://pub.dev/packages/highlight ) package for parsing code.
68
68
69
69
To select a language, use a
@@ -109,14 +109,14 @@ The editor supports pluggable analyzers to highlight errors and show error messa
109
109
We ship the following analyzers:
110
110
111
111
- ` DefaultLocalAnalyzer ` highlights unmatched pair characters for supported languages.
112
- It works on the client locally.
113
- It is selected by default on ` CodeController ` if no other analyzer is specified.
114
- - ` DartPadAnalyzer ` for Dart language, calls the [ DartPad] ( https://dartpad.dev ) backend for analysis.
112
+ It works on the client locally,
113
+ and is selected by default on ` CodeController ` if no other analyzer is specified.
114
+ - ` DartPadAnalyzer ` for Dart language, calls upon the [ DartPad] ( https://dartpad.dev ) backend for analysis.
115
115
116
- For other languages you can write custom analyzers that access your backend.
116
+ For other languages, you can write custom analyzers that access your backend.
117
117
See the code for ` DartPadAnalyzer ` for the implementation example.
118
118
119
- To set the analyzer call any of the following:
119
+ To set the analyzer, call any of the following:
120
120
121
121
``` dart
122
122
codeController = CodeController(language: dart, analyzer: DartPadAnalyzer());
@@ -125,15 +125,15 @@ codeController.setLanguage(dart, analyzer: DartPadAnalyzer());
125
125
```
126
126
127
127
** Note:** Code analysis is an experimental feature.
128
- We may introduce breaking changes to ` Analyzer ` subclasses without following semver contract.
129
- If you only use the analyzers we ship then this will not affect you.
128
+ We may introduce breaking changes to ` Analyzer ` subclasses without following the semver contract.
129
+ If you only use the analyzers we ship, then this will not affect you.
130
130
131
131
132
132
## Themes
133
133
134
134
### Pre-defined Themes
135
135
136
- Flutter Code Editor supports themes from the [ highlight] ( https://pub.dev/packages/flutter_highlight ) package,
136
+ Flutter Code Editor supports themes from the [ highlight] ( https://pub.dev/packages/flutter_highlight ) package —
137
137
see the full list of the pre-defined themes
138
138
[ here] ( https://github.com/git-touch/highlight.dart/tree/master/flutter_highlight/lib/themes ) .
139
139
@@ -156,15 +156,15 @@ return MaterialApp(
156
156
157
157
### Custom Themes
158
158
159
- To use a custom theme, create a map of styles under the pre-defined class names.
160
- See [ an example] ( https://github.com/git-touch/highlight.dart/blob/master/flutter_highlight/lib/themes/monokai-sublime.dart ) .
159
+ To use a custom theme, create a map of styles under the pre-defined class names —
160
+ see [ this example] ( https://github.com/git-touch/highlight.dart/blob/master/flutter_highlight/lib/themes/monokai-sublime.dart ) .
161
161
162
162
163
163
## Hiding Line Numbers, Errors, and Folding Handles
164
164
165
- A lot of styling can be tuned with ` GutterStyle ` object passed to ` CodeField ` widget.
165
+ A lot of styling can be tuned with a ` GutterStyle ` object passed to a ` CodeField ` widget.
166
166
See
167
- [ the example] ( https://github.com/akvelon/flutter-code-editor/tree/main/example/lib/03.change_language_theme )
167
+ [ this example] ( https://github.com/akvelon/flutter-code-editor/tree/main/example/lib/03.change_language_theme )
168
168
that dynamically changes the properties listed here.
169
169
170
170
``` dart
@@ -195,7 +195,7 @@ usable as one. However, code folding and other features have impact on built-in
195
195
- ` text ` returns and sets the visible text. If any code is folded, it will not be returned.
196
196
- ` value ` returns and sets the ` TextEditingValue ` with the visible text and selection.
197
197
If any code is folded, it will not be returned.
198
- - ` fullText ` returns and sets the entire text including any folded blocks and hidden
198
+ - ` fullText ` returns and sets the entire text, including any folded blocks and hidden
199
199
service comments (see below).
200
200
201
201
@@ -244,7 +244,7 @@ To customize section parsing using any other syntax, subclass `AbstractNamedSect
244
244
245
245
## Read-Only Code Blocks
246
246
247
- Flutter Code Editor allows to define read-only code blocks.
247
+ Flutter Code Editor allows you to define read-only code blocks.
248
248
This may be useful for learning use cases when users are guided to modify certain code blocks
249
249
while other code is meant to be protected from changes.
250
250
@@ -259,8 +259,8 @@ Any non-existent section names in this set are ignored.
259
259
To make the code editable again, pass an updated set to ` controller.readOnlySectionNames ` .
260
260
261
261
When using this feature, ` text ` and ` value ` properties cannot be used to change the text
262
- programmatically because they have the same effect as the user input,
263
- and so locking affects them as well.
262
+ programmatically because they have the same effect as the user input.
263
+ This means that locking affects them as well.
264
264
265
265
To change a partially locked controller, set the ` fullText ` property.
266
266
@@ -269,9 +269,9 @@ To change a partially locked controller, set the `fullText` property.
269
269
270
270
## Advanced Code Blocks Folding
271
271
272
- ### Folding The First Comment/License
272
+ ### Folding the First Comment/License
273
273
274
- Many code snippets contain license as their first comment, and it can distract readers.
274
+ Many code snippets contain a license as their first comment, which can distract readers.
275
275
To fold the first comment, use:
276
276
277
277
``` dart
@@ -292,9 +292,9 @@ controller.foldImports();
292
292
293
293
### Named Sections
294
294
295
- The editor supports folding all blocks except specific named sections.
295
+ The editor supports folding all blocks except for specific named sections.
296
296
This helps the user focus on those sections while
297
- all source code is still there, can be expanded and copied by the user.
297
+ all source code is still there and can be expanded and copied by the user.
298
298
299
299
To fold all blocks except those overlapping with the given named sections:
300
300
@@ -323,8 +323,8 @@ To get the currently folded blocks, read `controller.code.foldedBlocks`.
323
323
324
324
## Hiding Text
325
325
326
- The editor allows to completely hide all code except a specific named section.
327
- This is useful for even more focus than with folding.
326
+ The editor allows you to completely hide all code except for a specific named section.
327
+ This is useful to achieve even more focus than with folding.
328
328
329
329
To hide all the code except the given named section:
330
330
@@ -337,7 +337,7 @@ controller.visibleSectionNames = {'section1'};
337
337
When hiding text, the full text is still preserved
338
338
and available via ` fullText ` property in the Flutter Code Editor.
339
339
340
- Hiding text preserves line numbering which is not possible by just showing a cropped snippet.
340
+ Hiding text preserves line numbering, which is not possible by just showing a cropped snippet.
341
341
Preserving hidden text is also useful if you later need to send
342
342
the full code for further processing but still want to hide
343
343
non-informative parts.
@@ -359,18 +359,18 @@ The editor suggests words as they are typed. Suggested words are:
359
359
- Words set with ` controller.autocompleter.setCustomWords(['word1', 'word2']) `
360
360
361
361
All those words are merged into an unstructured dictionary.
362
- The editor performs no syntax analysis and so cannot tell if a given class really has
363
- the method the user is typing. This feature is meant to simplify typing but not to be relied on
362
+ The editor does not perform any syntax analysis, so it cannot tell if a given class really has
363
+ the method the user is typing. This feature is meant to simplify typing, but should not be relied on
364
364
when exploring classes and methods.
365
365
366
+ ![ Suggestions example] ( https://raw.githubusercontent.com/akvelon/flutter-code-editor/main/example/images/suggestions_example.gif )
367
+
366
368
To disable autocompletion:
367
369
368
370
``` dart
369
371
controller.popupController.enabled = false;
370
372
```
371
373
372
- ![ Suggestions example] ( https://raw.githubusercontent.com/akvelon/flutter-code-editor/main/example/images/suggestions_example.gif )
373
-
374
374
375
375
## Shortcuts
376
376
0 commit comments